We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to tell if printing was successful? It seems your missing event in SDK

Support,

use following code to print PDF:

          PdfViewer viewer = new PdfViewer();
                        PrintDocument prtdoc = new PrintDocument();
                        Aspose.Pdf.License license = new Aspose.Pdf.License();
                        license.SetLicense("Aspose.Pdf.lic");
                        license.Embedded = true;
                        viewer.PrintPageDialog = false;
                        viewer.AutoResize = false;
                        viewer.AutoRotate = false;
                        viewer.FormPresentationMode = Aspose.Pdf.Devices.FormPresentationMode.Production;
                        viewer.PrintAsImage = false;
                        viewer.Resolution = 600;

                        if (job.DocumentType == PrinterDocumentType.PDF)
                        {
                            viewer.BindPdf(job.DocumentDataStream);
                        }
                        if (job.DocumentType == PrinterDocumentType.TIFF)
                        {
                            TiffHelper helper = new TiffHelper();
                            Stream stream = helper.ConvertTIFFToPDF(job);
                            viewer.BindPdf(stream);
                        }
                        //pgs.PaperSource = ps.PaperSources[3]; Tray three.

                        System.Drawing.Printing.PrinterSettings ps = viewer.GetDefaultPrinterSettings();
                        PageSettings pgs = viewer.GetDefaultPageSettings();
                        ps.PrinterName = job.Printer.UNCPath;
                        //pgs.PaperSource = ps.PaperSources[3]; Tray three.
                        viewer.EndPrint += ViewerOnEndPrint;
                        viewer.PrintDocumentWithSettings(pgs, ps);
                        viewer.Close();

I thought end print event would tell if it was successful or not. But it has no such information.

How to tell if printing was successful or not?

@ARRT,
The PDFViewer class offers PrintStatus property to get the status of print. Please refer to this help topic: Checking Print Job Status

1 Like

Thank you! That was the ticket!