I'm appending multiple copies of a PDF to create a larger file. So far that is working fine using the PdfCopy object. Now, if the source PDF has an odd number of pages, I need to add one blank page of the target PDF before appending more copies of the source file. The idea is to send this to a double sided printer and have page one of the source PDF separate from the last page.
I read the tutorial and find that the newPage() will do what I need. My problem is that is not working. I tried the sample program and it works as expected. The only difference is that the sample program is using a PdfWriter class and I'm using the PdfCopy class.
Any idea on why I'm not getting the expected result? Does PdfCopy support the Document.newPage() method? Is this the wrong way to add an empty page to the target document.
I'm using itext-paulo-154.
for ( int ix = 0; ix < formCount; ++ix) {
reader = new PdfReader(fileName);
for ( int ij = 1; ij <= pageCount; ++ij) {
PdfImportedPage page = writer.getImportedPage(reader, ij);
writer.addPage(page);
}
reader.close();
if ( (pageCount % 2) != 0 && (evenPages == true ) ) {
document.newPage();
document.add(Chunk.NEXTPAGE);
document.newPage();
}
}
Saludos,
Orlando
Orlando M. Amador
[EMAIL PROTECTED]
