When I try to print my PDF file from the webserver using Spire.Pdf PdfDocument I get the following error message:
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
How can I print a PDF file using Spire.Pdf PdfDocument without it attempting to display a message box from the webserver?
Here is my code:
PdfDocument pdfdocument = new PdfDocument();
pdfdocument.LoadFromFile(strFilePath);
pdfdocument.PrinterName = printerName;
pdfdocument.PageScaling = PdfPrintPageScaling.FitSize;
pdfdocument.PrintDocument.PrinterSettings.DefaultPageSettings.Margins.Left = 25;
pdfdocument.PrintDocument.PrinterSettings.DefaultPageSettings.Margins.Right = 25;
pdfdocument.PrintDocument.PrinterSettings.DefaultPageSettings.Margins.Bottom = 25;
pdfdocument.PrintDocument.PrinterSettings.DefaultPageSettings.Margins.Top = 25;
pdfdocument.PrintDocument.PrinterSettings.Copies = 1;
pdfdocument.PrintDocument.
pdfdocument.PrintDocument.Print();
pdfdocument.Dispose();
Thanks!