Tick many documents - invoices, receipts, certificates, templates - and print them in one job: one merged PDF
(one print job, pages in order), a ZIP with one PDF each, or straight to a printer.
How it works
Each ticked key (invoice:3, certificate:2 ...) is built by DocumentCatalog.build().
Merged: OpenPDF PdfCopy appends the pages of every PDF to one new file. Each document keeps its own
"Page x of y", because the pages are copied as they are.
ZIP: java.util.zip.ZipOutputStream, one entry per document.
PdfCopy copy = new PdfCopy(document, out);
document.open();
for (GeneratedDoc d : docs) {
PdfReader reader = new PdfReader(d.bytes());
for (int page = 1; page <= reader.getNumberOfPages(); page++) {
copy.addPage(copy.getImportedPage(reader, page));
}
}
document.close();