How to print a PDF file to Network Printer from Windows Service?

Continue to following article,

http://www.verypdf.com/wordpress/201310/run-docprint-pro-doc2pdf-exe-from-a-service-account-to-convert-office-files-to-pdf-files-39067.html
------------------------------------------------

VeryPDF,

Many Thanks for this info..... I don't appear to have a copy "doc2pdf.exe" nor "docPrint_Service.exe". I am using "docPrint-sdk" which provides "demo_converter_cmd.exe"

During my evaluation, I've found that I needed to use both "Document Printer SDK" as well as "DocPrint Pro" (plus MS-Word) to convert DOC(x) to PDF; While "PDF Print command Line" is required to physically print the files.

This is basically what I'm doing - all via a DOS script (that is created at run time (providing the document names)) which is running on the server as a service account (without a terminal):

1) demo_converter_cmd.exe doc1.doc doc1.pdf
2) demo_converter_cmd.exe doc2.docx doc2.pdf
3) header.pdf template.pdf doc1.pdf doc2.pdf
footer.pdf > output1.pdf
4) pdfprint.exe -printer \\svr\printer output1.pdf
5) delete doc1.doc doc2.docx doc1.pdf doc2.pdf output1.pdf

Assuming this is deemed as the best solution for the desired output (please confirm) - To complete my evaluation I need to undertake end-to-end testing. This is currently being hindered by the necessity of user interaction - to acknowledge the "Buy or Trial" dialog box. Could you please advise if it is feasible to provide a time-limited license, so I can complete my proof of concept.

Many Thanks,
Customer
------------------------------------------------
There is no way to disable "Buy or Trial" dialog box in trial version of docPrint Pro product.

However, for evaluation purpose, we suggest you may download "DOC to Any Converter Command Line" from following web page to try, "DOC to Any Converter Command Line" can convert office documents to PDF files and without popup any dialog, we hoping this product will useful to you,

http://www.verydoc.com/doc-to-any.html
http://www.verydoc.com/doc2any_cmd.zip

You can look at more questions for "DOC to Any Converter Command Line" software from following web page,

http://www.verydoc.com/blog/category/doc-to-any-converter

VeryPDF
------------------------------------------------
VeryPdf,

While using "\pdfprint_cmd\pdfprint.exe" I'm constantly hitting "Return Code - 4" (which I understand to be an Unrecognized printer)

Following is the example - This only errors when running the command from a service account, not when logged into the server:

C:\pdfprint_cmd\pdfprint.exe -printer prt2013 h:\test.pdf

Could you please advise if there are any set-up steps or which I may have missed, or if there is another EXE I should be using in this instance.

Many Thanks,
Customer
------------------------------------------------
You need set your Windows Service run inside an interactive user account instead of default LocalSystem user account, then you can call pdfprint.exe from your Windows Service properly.

VeryPDF
------------------------------------------------

Do you have any product which would allow me to print from a system account?

Thanks,
Customer
------------------------------------------------
As previously communicated, I'm trying to convert, merge and ultimately print several documents. I have everything working (as I'd expect) from a service account which is:

1) Collecting all the necessary documents into a directory on the server (Win2008 (64bit))
2) Convert any non-PDF files into PDF (via Doc2Any.exe)
3) Merge all files together into a "final" PDF (via 3rd party software)

However I'm now struggling to get the final document to output to a; locally installed printer or straight to a network print (with UNC path).

I'm trying to use "pdfprint.exe" for this (d:\pdfprint_cmd\pdfprint -printer ptr01 h:\sample.pdf) but it is always returning an Error Code -4. Having re-read the previous reply a few times, I'm uncertain what is mean by "Starting the Windows service". This may be because I have not been involved in the installation of the server (which is managed remotely as part of an outsourced agreement).

If you could kindly advise what should be setup and running before I attempt to use "pdfprint.exe" that would be much appreciated.

...and again - if you believe there is a better route to achieve the same result; I'd be happy to hear your suggestions.

Many Thanks,
Customer
------------------------------------------------
>>Do you have any product which would allow me to print from a system account?

Because Windows System user account hasn't network ability, so when you call pdfprint.exe from Windows Service, you will not able to use network printer, because network is prohibited in System user account.

We have a solution to allow you to print PDF files from Windows Service, please look at following web pages 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/201109/pdf-printer-cant-print-pdf-file-to-network-printer-from-windows-service-2309.html

The general solution is switch user account from System to Administrator or other interactive user accounts, you can run the service from Administrator user account directly or use CmdAsUser.exe to call pdfprint.exe from Administrator user account, this will overcome the limitation of System user account.

You can also grant Network Access ability to System user account, if you like to do, please refer to following web pages,

http://stackoverflow.com/questions/510170/the-difference-between-the-local-system-account-and-the-network-service-acco

http://social.technet.microsoft.com/Forums/windowsserver/en-US/e50abc9a-2141-42ba-a6ee-b228a01acfe8/how-to-grant-network-access-to-local-user?forum=winservergen

http://serverfault.com/questions/135867/how-to-grant-network-access-to-localsystem-account

http://stackoverflow.com/questions/3439760/localsystem-vs-system-vs-local-system-windows-system-accounts

http://kb.ucla.edu/articles/local-system-accountnt-authoritysystem-and-network-resource-access

VeryPDF
------------------------------------------------

btw, you can also send the requests from Windows Service to a normal Windows Monitor application, this Monitor application will execute conversion and printing tasks, this solution will overcome the limitation of Windows Service System account too.

We have already finished this work, you may download "Free docPrint Service (4)" from following web page to try, "Free docPrint Service (4)" is able to send requests from Windows Service by "docPrint_client.exe" application, "docPrint_client.exe" will deliver the requests to docPrint_Service.exe application, docPrint_Service.exe application will execute all actions.
 
http://www.verydoc.com/exeshell.html

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!