How do I call pdfprint from Windows Service or Local System to print the PDF file to network printer?

You should run pdfprint.exe from an interactive user account instead of default Local System User Account, because Local System User account can't access to network printer, we suggest you may use CreateProcessAsUser() function or RunAs.exe application to run pdfprint.exe from an interactive user account, then pdfprint.exe will able to print your PDF file to network printer properly.

Please refer to following solution, we hoping the following solution will helpful to you,

1. Please download CmdAsUser.exe from following page first,

http://verydoc.com/exeshell.html
http://verydoc.com/download/cmdasuser.zip

2. You can use CmdAsUser.exe to run pdfprint.exe from a special user account, e.g., Administrator user account,

CmdAsUser.exe Administrator . /p password /c "C:\pdfprint.exe" –printer \\verypdf-printerserver\myprinter C:\test.pdf

Please notice, you need modify user name and password in above command line.

3. You can call CmdAsUser.exe from your code to launch pdfprint.exe inside an interactive user account, then you can print your PDF files properly.

You may encounter Error #1314 when you switch the user account, please refer to following solution to solve Error #1314,

~~~~~~~~~~~~~~~
To resolve this issue:
1. Click Start, click Run, type "secpol.msc", and then press ENTER.
2. Double-click "Local Policies".
3. Double-click "User Rights Assignment".
4. Double-click "Replace a process level token".
5. Click "Add", and then double-click the "Everyone" group
6. Click "OK".
7. You may have to logout or even reboot to have this change take effect.

Please refer to two screenshots at below,

http://www.verydoc.com/images/err1314-1.png
http://www.verydoc.com/images/err1314-2.png

"To resolve Error #1314 error, you'll need to elevate the rights of the account calling CreateProcessAsUser() with the "Replace a process level token" right. To do so, open the Control Panel / Administrative Tools / Local Security Policy and add the user account to the "Replace a process level token" right. (You may have to logout or even reboot to have this change take effect.)"
~~~~~~~~~~~~~~~

Sometimes, Windows system can’t map computer name to IP address properly, for example, the following command line may not work in computers,

pdfprint -debug -chgbin 257 -printer "\\verypdf-server\Xerox Global Print Driver PCL"  "c:\temp\verypdf.pdf"

however, after we change the “\\verypdf-server” to IP address, it does work,

pdfprint -debug -chgbin 257 -printer "\\192.168.1.10\Xerox Global Print Driver PCL"  "c:\temp\verypdf.pdf"

so, you should better use IP address to instead of computer name if your system can’t map from computer name to IP address properly.

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!