Copy three PDF files into one PDF

by Mohan 2012-09-21 13:49:01

Copy three PDF files into one PDF


import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfCopy;
import com.lowagie.text.pdf.PdfReader;

public class CopyThreePDFToOne {

public static void main(String[] args) throws Exception {
PdfReader reader = new PdfReader("Hello1.pdf");
Document document = new Document(reader.getPageSizeWithRotation(1));
PdfCopy copy = new PdfCopy(document, new FileOutputStream(
"Pdf.pdf"));
document.open();
copy.addPage(copy.getImportedPage(reader, 1));
reader = new PdfReader("Hello2.pdf");
copy.addPage(copy.getImportedPage(reader, 1));
reader = new PdfReader("Hello3.pdf");
copy.addPage(copy.getImportedPage(reader, 1));
document.close();
}

}
459
like
0
dislike
0
mail
flag

You must LOGIN to add comments