Copy three PDF files into one PDF : PDF Copy « PDF « Java Tutorial






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

}








29.7.PDF Copy
29.7.1.Copy three PDF files into one PDF
29.7.2.Combine the different PDFs with forms and fields into one