title: How to use source document with form as a template for multiple page target document in PDFBox
body: <p>I am using PDFBox 1.2.1 in Java and I am trying to use single page pdf document which has an acro form in it as a template for making multiple page target pdf.</p>
  
  <pre><code>PDDocument sourceDocument = PDDocument.load(fileStream);
  PDDocument targetDocument = new PDDocument();
  PDDocumentCatalog sourceDocCatalog = sourceDocument.getDocumentCatalog();
  PDAcroForm acroFormFromSource = sourceDocCatalog.getAcroForm();
  targetDocument.getDocumentCatalog().setAcroForm(acroFormFromSource);
  PDPage templatePdfPage = (PDPage) sourceDocument.getDocumentCatalog().getAllPages().get(0);
  
    for (int i = 0; i &lt; 5; i++) {
  
      targetDocument.addPage(templatePdfPage);
      PDDocumentCatalog targetDocumentsDocumentCatalog = targetDocument.getDocumentCatalog();
      PDAcroForm acroForm = targetDocumentsDocumentCatalog.getAcroForm();
      acroForm.getField("Text1").setValue("Car " + i);
    }
  </code></pre>
  
  <p>Unfortunately the generated target pdf contains 5 pages but every page has Text1 field with same value "Car 4". So every page is the same acro form. Is it somehow possible to generate new unique acro form for every page or is there other possible solution for my use case?</p>