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();
}
}
|