StartDoc always fails

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
zmac20s
Posts: 3
Joined: Mon Jun 21 2004

StartDoc always fails

Post by zmac20s »

I'm calling the GDI function StartDoc through Interop to kick off print jobs using PDF Converter 2.10e. The function always returns -1, with a Win32 error code of 21 ("device not ready").

Some notes:
  • 1. This happens when the code is part of a Web Forms application, even with ASPNET in the Administrators group.
    2. It also happens when the code is part of a Windows Forms application.
    3. Equivalent code in straight C++ works fine (StartDoc returns a print job number).
    4. I'm calling EnablePrinter during initialization, and again immediately before StartDoc. EnablePrinter returns 1 in both places.
Any ideas? Point #3 is especially puzzling.

I can post relevant source code snippets, if requested.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Try to run the service under a particular user name rather than the
LocalSystem user.

Will this help?
zmac20s
Posts: 3
Joined: Mon Jun 21 2004

Post by zmac20s »

I have tried running the service under my own user account and the ASPNET account, both with and without Administrator privileges. Nothing seems to work, so I don't think it's a rights issue...
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Microsoft added a new user name for .NET web servers. The user name is something like ASP_NET_machinename, and this replaces IUSER_machinename. So you have to give this user the needed rights to be able to use the PDF Printer (more details are available in TN01 available in our technical notes page).

If you already tried to print from the ASPNet account while giving it administrative rights and this is not working I would suggest that you contact our Technical Support support@amyuni.com

Thanks.
zmac20s
Posts: 3
Joined: Mon Jun 21 2004

Post by zmac20s »

I tried making both ASPNET and IUSR_xxxx members of the Administrators group, but the call still fails. My guess is that I have a problem with my interop code... I'll get in touch with support. Thank you.
Post Reply