How to run pdfprint.exe from PHP and Windows Service on a dedicated server? pdfprint command line can not be run from Local System User Account

Hello VeryPDF,

We bought your command-line PDF print software for use in one of our applications. However we are unable to get it to work properly, which is now getting critical:

When called from a PHP script, we can list a complete list with printers using -listprinter but when trying to print to any of these, it returns the error,

'Can't locate the "XXX" printer in this computer, please double check the printer name and to try again.'

When using it via a logged-in user (which has a desktop open) and we run the exact same script, the application DOES print. However as we run this on a dedicated server, we cannot have a user session open continuously.

Below is the result of a print when we run the -listprinter first and after that the print with -debug property.

AEW-L001
AEW-T001
ES-ESMDH-24142-T001
FR-FRSWI-XXXX-L001
Microsoft XPS Document Writer
NL-NLRRM-20022-T001
NL-NLTSW-24244-L001
NL-NLTSW-24244-L002
NL-NLTSW-24244-L003
NL-NLTSW-24244-L004
NL-NLTSW-24244-L005
NL-NLTSW-24244-L006
NL-NLTSW-24244-L007
NL-NLTSW-24244-L008
NL-NLTSW-24244-L009
NUS-L001
NUS-L002
NUS-T001
NUS-T002
SWA-T001

Reading Command Line options...
Copyright (C) VeryPDF.com
"C:\inetpub\wwwroot\LBIPUAT\application/libraries\pdfprint_cmd\pdfprint.exe" "-$" "XXXXXXXXXXXXXXXXXXXX" "-debug" "-printer" "ES-ESMDH-24142-T001" "-pdforient" "2" "-scalex" "100" "-scaley" "100" "C:\inetpub\wwwroot\LBIPUAT\application\modules\QA_Weight\download\LB-cf47a67a6899c940d7fdbf89371e7d99.pdf"
***************************
Version Build Date: Aug 7 2016
Try to load 'WINSPOOL.DRV' file...
Load 'WINSPOOL.DRV' file OK.
SetDefaultPrinter to 'ES-ESMDH-24142-T001' printer, return code = 0.
Can't locate the "ES-ESMDH-24142-T001" printer in this computer, please double check the printer name and to try again.
***************************

Customer
------------------------------------------------
Thanks for your message, we known this problem, this problem is caused by Local System user account, because your local system user account hasn't permissions to access to these printers.

You can run pdfprint.exe inside an interactive user account to solve this problem, you can use CmdAsUser.exe to run pdfprint.exe inside an interactive user account, please look at following web page for more information,

http://www.verypdf.com/wordpress/201109/how-do-i-call-pdfprint-from-windows-service-or-local-system-to-print-the-pdf-file-to-network-printer-2310.html

http://www.verypdf.com/wordpress/201602/privileges-required-to-print-pdf-files-from-local-system-or-local-service-accounts-42230.html

http://www.verypdf.com/wordpress/201109/pdf-printer-cant-print-pdf-file-to-network-printer-from-windows-service-2309.html

You can also use "VeryPDFComRunCmd COM Component" to run pdfprint.exe inside an interactive user account, please look at following web pages to study how to use "VeryPDFComRunCmd COM Component",

http://www.verydoc.com/exeshell.html#VeryPDFComRunCmd_COM_Component

http://www.verydoc.com/blog/verydoc-release-notes-verydoc-releases-an-exe-com-of-verypdfcomruncmd-exe-today-verypdf-exe-com-does-allow-you-to-call-ms-office-and-any-exe-application-from-asp-php-c-net-etc-program-languag.html

After you run pdfprint.exe inside an interactive user account, pdfprint.exe will able to see these printers and able to print the PDF file to these printers 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

This entry was posted in PDF Print and tagged , . Bookmark the permalink.

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!