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.

Fri Apr 21, 2023 7:24 am

Good morning,
we wrote a simple web service to print documents with your dll.
The method is the following:

Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromFile(filePath);
doc.PrintSettings.PrinterName = HttpUtility.UrlDecode(printerName);
await Task.Run(() =>
{
doc.Print();
});

If two or more different applications call the web service at the same time, it doesnt enter a print queue and we get an unhandled access violation exception on server.

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at sprⳏ.ᜀ(System.Drawing.Bitmap)
at sprⳏ.ᜁ(Byte[], sprᩔ)
at sprⳏ.ᜎ()
at sprⵃ.ᜀ(sprⳓ, System.Drawing.Graphics, sprᥪ)
at sprⳓ.ᜀ(sprᦫ)
at sprⳓ.᜽()
at sprᧇ.ᜀ(System.Drawing.Graphics, sprⳋ, sprⴶ, spr᦬, System.Drawing.Image)
at sprᤆ.ᜀ(System.Drawing.Printing.PrintPageEventArgs, Spire.Pdf.PdfPageBase, System.Drawing.RectangleF)
at sprᤆ.ᜃ(System.Drawing.Printing.PrintPageEventArgs)
at sprᤆ.ᜀ(System.Object, System.Drawing.Printing.PrintPageEventArgs)
at System.Drawing.Printing.PrintDocument.OnPrintPage(System.Drawing.Printing.PrintPageEventArgs)
at System.Drawing.Printing.PrintController.PrintLoop(System.Drawing.Printing.PrintDocument)
at System.Drawing.Printing.PrintController.Print(System.Drawing.Printing.PrintDocument)
at System.Drawing.Printing.PrintDocument.Print()
at Spire.Pdf.PdfDocument.Print(Spire.Pdf.Print.PdfPrintSettings)
at StampaDaRemoto.StampaDocumenti+<>c__DisplayClass1_0.<StampaDocumentoAsync>b__0()
at System.Threading.Tasks.Task.Execute()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
at System.Threading.ThreadPoolWorkQueue.Dispatch()

how can we solve? thanks

svibsrl1
 
Posts: 1
Joined: Thu Feb 23, 2023 2:50 pm

Sun Apr 23, 2023 6:20 am

Hi,

Thanks for your feedback.
We have also created a web service and two web projects that call this web service, which can submit documents to the printer queue without any errors. Therefore, we suggest checking if you are using our latest version of the product. If not, please try upgrading to the latest version and test again. If the issue persists, please send us your project and OS info so that we can further investigate the problem.

Please let us know if you have any questions or concerns.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF