title: copy pdf form with PdfCopy not working in itextsharp 5.4.5.0
body: <p>In the release notes of iText 5.4.4 it says:</p>
  
  <blockquote>
    <p>From now on you can now merge forms and preserve the tagged PDF
    structure when using the addDocument() method in PdfCopy. At the same
    time, we've deprecated PdfCopyFields.*</p>
  </blockquote>
  
  <p>I try to merge multiple pdf documents into one pdf document. If one of these documents is a pdf form with acroFields, those fields will be invisible in the output document. This is the case when I use the addDocument() method in PdfCopy.
  When I use the addDocument() method in PdfCopyFields it works fine. PdfCopyFields is deprecated in iTextSharp, but is PdfCopy working correctly? There is another reason not to use PdfCopyFields (from "iText in Action":</p>
  
  <blockquote>
    <p>Don’t use PdfCopyFields to concatenate PDF documents without form
    fields. As opposed to concatenating documents using PdfCopy, Pdf-
    CopyFields needs to keep all the documents in memory to update the
    combined form. This can become problematic if you’re trying to
    concatenate large documents.</p>
  </blockquote>
  
  <p>This is the code I use:</p>
  
  <pre><code>public static void MergePdfs4()
  {
      var f1 = @"C:\Users\paulusj\Downloads\OoPdfFormExampleFilled.pdf";
      var f2 = @"c:\GEODAN\work\EV_Original.pdf";
  
      using (
          Stream outputPdfStream = new FileStream("combined4.pdf ", FileMode.Create, FileAccess.Write,
              FileShare.None))
      {
          var document = new Document();
          var copy = new PdfCopy(document, outputPdfStream);
          document.Open();
          copy.AddDocument(new PdfReader(f1));
          copy.AddDocument(new PdfReader(f2));
          copy.Close();
      }
  }
  </code></pre>
  
  <p>The strange thing is that when I copy EV_Original.pdf using Adobe Reader "Save As", the copy is merged (almost) correctly. So in the output pdf I can see the form fields.<br>
  When I use this code:</p>
  
  <pre><code>public static void MergePdfs3()
  {
      var f1 = @"C:\Users\paulusj\Downloads\OoPdfFormExampleFilled.pdf";
      var f2 = @"c:\GEODAN\work\EV_Original.pdf";
  
      using (Stream outputPdfStream = new FileStream("combined3.pdf ", FileMode.Create, FileAccess.Write,
              FileShare.None))
      {
  
          var copy = new PdfCopyFields(outputPdfStream);
          copy.AddDocument(new PdfReader(f1));
          copy.AddDocument(new PdfReader(f2));
          copy.Close();
      }
  }
  </code></pre>
  
  <p>It works fine. But in this code PdfCopyFields is used.</p>
  
  <p>The pdfs used can be found here:<br>
  <a href="https://drive.google.com/file/d/0B1wUkETtl3SVWWJicVZhOG5ZdFE/edit?usp=sharing" rel="nofollow">Example.pdf</a><br>
  <a href="https://drive.google.com/file/d/0B1wUkETtl3SVZG0xQWFsVzFTMms/edit?usp=sharing" rel="nofollow">EV_Original.pdf</a>  </p>
  
  <p>Is there something wrong with EV_Original.pdf, or is PdfCopy not implemented correctly?</p>