Free Support Forum -

Printing from windows service not working


I am trying to print a pdf from windows service which is running as admin in my local machine. It is getting stuck at viewer.PrintLargePdf(fileName, pgs, ps);. I dont get any exception as well.

However the same code works well in a console application.
I am licensed version of aspose 9 version.
Cdde sample is as follows

PdfViewer viewer = new PdfViewer();
var fileName = @“C:\NTCEmailPrinter\Items.pdf”;

        viewer.AutoResize = false;         // Print the file with adjusted size
        viewer.AutoRotate = false;         // Print the file with adjusted rotation
        viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing

        System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
        System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
        System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();

        ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

        viewer.PrintLargePdf(fileName, pgs, ps);



Please create a small Window Service application and make sure that it reproduces the same problem in your environment, and send us a ZIP of this project along with source PDF document. We will investigate your scenario in our environment and share our findings with you.