Hi James,
Yes, it is possible to print PDF document without any user interactions in Windows Service application using the WinForms
PdfDocumentView control. You can pass the destination printer name as a parameter to the
Print method, that will print the PDF silently into the printer. Refer to the following code snippet to perform the same.
|
protected override void OnStart(string[] args)
{
//Create an instance PdfDocumentView
PdfDocumentView view = new PdfDocumentView();
//Load the document to be exported as image
view.Load("C:/tmp/Barcode.pdf");
//Pass the printer name as a parameter to the print method
view.Print("HP LaserJet Pro MFP M127-M128 PCLmS");
} |
We have created a sample for the same and it can be downloaded from the below location:
Note: Please provide the correct PDF file path in the load method to run the sample properly.
Regards,
Deepak G