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 Jan 17, 2023 12:54 am

Hi.

When printing a PDF in a loop, some pdf files are not printed.
No errors occur, just the printer is not working.
It doesn't even exist in the printer queue.

If 10 pdf files are printed, 1 ~ 2 files are not printed.

this is the code i used.
could you help me?.
Code: Select all
             foreach (string files in filePaths) {
                PdfDocument pdf = new PdfDocument();
                pdf.PrintSettings.PrinterName = printer_bar.EditValue.ToString();
                pdf.LoadFromFile(files);
                if(copys < 1) {
                    copys = 1;
                }
                pdf.PrintSettings.Copies = (short)copys;
                pdf.Print();
                pdf.Close();
                pdf.Dispose();
            }

Sungkyu_min
 
Posts: 36
Joined: Fri Jan 07, 2022 5:53 am

Tue Jan 17, 2023 9:54 am

Hello,

Thanks for your inquiry.
I created a console project with NetFramework4.8 and the latest version of Spire.Pdf(V9.1.0) to test your scenario, I tested both virtual printer(Microsoft Print to PDF) and physical printer(HP ColorLaserJet MFP M278-M281) but I didn’t reproduce your issue and I get the expected files.
I suggest you using the latest version of Spire.Pdf to test again your scenario. In addition, you also can use virtual printer to test and check whether the issue that some pdf files are not printed occurs, if not occur, the physical printer itself contributes to the problem, this moment, I suggest you can test other physical printer to check whether this issue occurs.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Sun Jan 29, 2023 7:13 am

Hello,

Greeting from E-iceblue.
Could you give some feedback about your issue? Looking forward to your reply.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF