Printing: Print all copies as one single print job
This commit is contained in:
@@ -24,19 +24,19 @@ namespace Elwig.Helpers.Printing {
|
|||||||
|
|
||||||
using var printer = new Win32Printer.Printer(PrinterName);
|
using var printer = new Win32Printer.Printer(PrinterName);
|
||||||
printer.TrySetDuplex(doublePaged ? Duplexing.TwoSidedLongEdge : Duplexing.OneSided);
|
printer.TrySetDuplex(doublePaged ? Duplexing.TwoSidedLongEdge : Duplexing.OneSided);
|
||||||
for (int i = 0; i < copies; i++) {
|
|
||||||
printer.StartDocument(Path.GetFileName(pdfPath));
|
printer.StartDocument(Path.GetFileName(pdfPath));
|
||||||
bool documentStarted = true;
|
bool documentStarted = true;
|
||||||
try {
|
try {
|
||||||
|
for (int i = 0; i < copies; i++) {
|
||||||
for (int j = 0; j < pageCount; j++) {
|
for (int j = 0; j < pageCount; j++) {
|
||||||
PrintPage(document, printer, j);
|
PrintPage(document, printer, j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
printer.EndDocument();
|
printer.EndDocument();
|
||||||
documentStarted = false;
|
documentStarted = false;
|
||||||
} finally {
|
} finally {
|
||||||
if (documentStarted) printer.AbortDocument();
|
if (documentStarted) printer.AbortDocument();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
PdfiumNative.FPDF_CloseDocument(document);
|
PdfiumNative.FPDF_CloseDocument(document);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user