title: iTextSharp merging PDF's without persisting page size
body: <p>I have the following piece of .NET code to merge two PDFs via iTextSharp.</p>
  
  <pre><code>        byte[] result;
          using (var ms = new MemoryStream())
          {
              using (var doc = new Document())
              {
                  using (PdfCopy copy = new PdfSmartCopy(doc, ms))
                      doc.Open();
                      var d1 = new PdfReader(coverSheetPdf);
                      copy.AddDocument(d1);
                      var d2 = new PdfReader(reportPdf);
                      copy.AddDocument(d2);
                      doc.Close();
                  }
              }
              result = ms.ToArray();
          }
  </code></pre>
  
  <p>The above merges a Letter/Landscape PDF with a Tabloid/Landscape PDF.  In most cases the page size of each PDF is maintained however in certain cases the merged document is all one size.</p>
  
  <p>The image below shows the page sizes when in Debug
  <a href="https://i.stack.imgur.com/yDJbh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yDJbh.png" alt="Page sizes"></a></p>
  
  <p>I have attached the following files</p>
  
  <ul>
  <li><p>Coversheet file: represented by variable d1 in the code
  (<a href="http://www.mediafire.com/file/be4x8fzyqle6hdt/Coversheet.pdf/file" rel="nofollow noreferrer">http://www.mediafire.com/file/be4x8fzyqle6hdt/Coversheet.pdf/file</a>)</p></li>
  <li><p>Report file: represented by variable d1 in the code
  (<a href="http://www.mediafire.com/file/8z5q260h8j32b6l/Report.pdf/file" rel="nofollow noreferrer">http://www.mediafire.com/file/8z5q260h8j32b6l/Report.pdf/file</a>)</p></li>
  <li><p>Merged file of both of the above
  (<a href="http://www.mediafire.com/file/5ob79holw3yfaz7/Merged_Coversheet%252BReport.pdf/file" rel="nofollow noreferrer">http://www.mediafire.com/file/5ob79holw3yfaz7/Merged_Coversheet%252BReport.pdf/file</a>)</p></li>
  </ul>
  
  <p>Any ideas why the merged PDF contains pages all the same size?</p>