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 11, 2015 9:06 am

Hi Support Team!

I want to write a Windows Service which prints PDFs and I though Spire.PDF is able to do the printing. In the end it comes down to code similar to this:

Code: Select all
Spire.Pdf.PdfDocument doc = new PdfDocument()
doc.LoadFromFile(document);
doc.PrinterName = printerName;


Spire.PDF integrates with System.Drawing.Printing. I found this warning on the MSDN page about the System.Drawing.Printing namespace:

Classes within the System.Drawing.Printing namespace are not supported for use within a Windows service or ASP.NET application or service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.


This tells me not to use System.Drawing.Printing in the context of a Windows Service. Hence this would also role Spire.PDF out. Is this correct?

In your feature list says that Spire.PDF cab be used in ASP.NET applications. This contradicts with the MSDN warning. How is this possible?

In the case Spire.PDF be used in the context of an ASP.NET application, does this also apply to Windows Service applications?

Best regards,
Olaf

olaf2
 
Posts: 8
Joined: Fri Aug 07, 2015 3:09 pm

Wed Aug 12, 2015 9:11 am

Hello,

Thanks for your inquiry.
1)The MSDN warning tell us try not to to use System.Drawing.Printing in the context of a Windows Service, instead of not to use.
2)Spire.PDF can be used in ASP.NET applications. This didn't contradict with the MSDN warning.
Because the MSDN warning said it "may" produce unexpected problems, not always.
3)Yes, this also apply to Windows Service applications.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF