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.
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...
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
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.