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.

Tue Jun 14, 2022 5:51 am

Hello,

printing a PDF takes a long time. From calling PdfDocument.Print() to starting the actual printout, it takes 20 seconds for a PDF with 3 pages.

Here our code for printing:
Code: Select all
        public static void PrintPdfWithForcedPageSize(string file,
            string printJobName,
            string printerName,
            SupportedPageSizes pageSize,
            bool disableDuplex = false)
        {
            var paperSize = new PaperSize();

            switch (pageSize)
            {
                case SupportedPageSizes.A5:
                    {
                        paperSize.Width = 580;
                        paperSize.Height = 830;
                        paperSize.RawKind = (int)PaperKind.A5;
                        break;
                    }
                default:
                    {
                        paperSize.Width = 830;
                        paperSize.Height = 1170;
                        paperSize.RawKind = (int)PaperKind.A4;
                        break;
                    }
            }

            using (var doc = new PdfDocument())
            {
                doc.LoadFromFile(file);
                doc.PrintSettings.PrintController = new StandardPrintController();
                doc.PrintSettings.PaperSize = paperSize;
                doc.PrintSettings.PrinterName = printerName;
                doc.PrintSettings.DocumentName = printJobName;
                if (doc.PrintSettings.CanDuplex && disableDuplex)
                {
                    doc.PrintSettings.Duplex = Duplex.Simplex;
                }
                doc.Print();
                doc.Close();
            }
        }


What can I do to reduce printing time?

Kind regards,
Peter

muellerp
 
Posts: 1
Joined: Mon Jun 13, 2022 3:38 pm

Tue Jun 14, 2022 9:53 am

Hi,

Thank you for your inquiry.
I simulated a three-page PDF document and did an initial test, but did not reproduce your problem. If you were not using the latest version(Spire.PDF Pack(Hot Fix) Version:8.6.1), I suggest you give it a try. If the problem still exists, please provide the following information to help us further investigate your issue. You can send your document to us via email (support@e-iceblue.com). Thank you in advance.
1) Your PDF document and the name of your printer.
2) Test environment, such as win10, 64bit.
3) Application type, such as Console App, .NET Framework 4.8.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.PDF