Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Aug 30, 2016 2:34 pm

We are using Spire.PDF version 3.7, and are experiencing similar issues as forum/can-spire-pdf-be-used-in-a-window-service-t5494.html

Specifically, we are experiencing inconsistencies with the print service, sometimes it works, sometimes it doesn't. The above referenced entry doesn't appear to address this. I was wondering if a solution has been found to address this issue or if there is a workaround?

Thanks,
Brad

beallen
 
Posts: 2
Joined: Tue Aug 30, 2016 1:52 pm

Tue Aug 30, 2016 3:47 pm

We have narrowed it down to printing to a network printer, even with the service using a network logon. Any solution for printing to a network printer using a windows service?

beallen
 
Posts: 2
Joined: Tue Aug 30, 2016 1:52 pm

Wed Aug 31, 2016 4:04 am

Dear Brad,

Thanks for your inquiry.
At present there is a solution, please convert the PDF to XPS firstly and then print the XPS document using the XpsPrint API. And I have attached the API, please check.
Also, here is sample code for your reference.
Code: Select all
public void PrintOnServer(string fileName)
    {
        MemoryStream ms = new MemoryStream();
        PdfDocument pdfDoc = new PdfDocument();
        pdfDoc.LoadFromFile(fileName);
        pdfDoc.SaveToStream(ms, FileFormat.XPS);
        ms.Position = 0;
        XpsPrint.XpsPrintHelper.Print(ms, @"\\192.168.1.104\HP LaserJet P1007", "SpireTest",true);
    }

If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Wed Sep 07, 2016 8:10 am

Dear Brad,

Did you try the solution I provided ? Has your issue been resolved ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF

cron