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