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();
}