Java/PDF RTF/Form

Материал из Java эксперт
Перейти к: навигация, поиск

Concatenate Forms from existing pdf documents

import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfCopyFields;
import com.lowagie.text.pdf.PdfReader;
public class ConcatenateFormsPDF {
  public static void main(String[] args) {
    try {
      PdfReader reader1 = new PdfReader("SimpleRegistrationForm.pdf");
      PdfReader reader2 = new PdfReader("SimpleRegistrationForm.pdf");
      PdfCopyFields copy = new PdfCopyFields(new FileOutputStream("ConcatenateFormsPDF.pdf"));
      copy.addDocument(reader1);
      copy.addDocument(reader2);
      copy.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}