1

这是我的代码:

   public string PrintPdfAspose(string printerName)
        {
            // For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-.NET
            // The path to the documents directory.
            string dataDir = filePath;

            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf(dataDir);


            viewer.PrintDocumentWithSettings(pgs, ps);
            // Check the print status
            if (viewer.PrintStatus != null)
            {
                // An exception was thrown
                Exception ex = viewer.PrintStatus as Exception;
                if (ex != null)
                {
                    return ex.ToString();
                }
            }
            else
            {
                // No errors were found. Printing job has completed successfully
                viewer.Close();
                return "printing completed without any issue..";

            }

        }

我总是得到 PrintStatus null,当打印机由于某种原因没有打印时,我应该得到某种错误。有什么帮助吗?

4

0 回答 0