Hello, I am merging a number of PDFs (the single pages of a magazine) into
files of a fixed amount of pages to print them in booklet format with the
following code
numBooklets48=numTotalPages/48;
for (int i=1;i<=numBooklets48;i++) {
strTemp = ("" + (1000+i)).substring(2);
//rectangle contains the right size;
Document document = new Document(rectangle);
PdfCopy copy = new PdfCopy(document, new FileOutputStream("Booklet"+i
+ ".pdf"));
document.open();
for (int j=1;j<=48;j++){
strTemp="page" + j + 48*(i-1) + ".pdf";
File f = new File(strTemp);
if (f.exists()) {
reader=new PdfReader(strTemp);
copy.addPage(copy.getImportedPage(reader, 1));
}
else {
reader=new PdfReader("emptypage.pdf");
copy.addPage(copy.getImportedPage(reader, 1));
}
}
document.close();
}
This is working, but I would like 1) to be able to insert an empty page when
the original page is missing. Now I am adding a page coming from an existing
PDF. 2) I would like to crop the inserted pages to the trim box, while
inserting them.
How could I do? Thanks in advance for any help.
Marcello
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/