title: iTextSharp merge and preserve plugins
body: <p>I have a PDF that has a plugin control on one page.  I need to merge it with another pdf but when I do, the plugin is redendered as a blank rectangle.  Is there a way to merge and preserve the plugin control?  If important, the plugin is a Dessault Systemes 3D Via Composer Player control as installed from <a href="http://www.3ds.com/products/3dvia/3dvia-composer/resource-center/" rel="nofollow">http://www.3ds.com/products/3dvia/3dvia-composer/resource-center/</a></p>
  
  <p>The code I'm using is simple writer getinstance, contentbyte directcontent, getimportedpage, addtemplate.  Nothing fancy.</p>
  
  <pre><code>FileStream docStream = new FileStream(@"C:\Temp\Merged.pdf", FileMode.Create);
              Document newDocument = new Document(PageSize.A4.Rotate());
              PdfWriter pdfWriter = PdfWriter.GetInstance(newDocument, docStream);
          try
          {
              newDocument.Open();
              PdfContentByte pdfContentByte = pdfWriter.DirectContent;
  
              newDocument.NewPage();
              PdfReader mainPage = new PdfReader(@"C:\Temp\PageWithPlugin.pdf");
              PdfImportedPage importedPage1 = pdfWriter.GetImportedPage(mainPage, 1);
              pdfContentByte.AddTemplate(importedPage1, 0, 0);
              mainPage.Close();
  
              PdfReader smgPages = new PdfReader(@"C:\Temp\MorePages.pdf");
              for (int page = 1; page &lt;= smgPage.NumberOfPages; page++)
              {
                  newDocument.NewPage();
                  PdfImportedPage importedPage = pdfWriter.GetImportedPage(smgPages, page);
                  pdfContentByte.AddTemplate(importedPage, 0, 0);
              }
              smgPages.Close();
  
              }
          finally
          {
              docStream.Flush();
              if (newDocument != null)
                  newDocument.Close();
              docStream.Close();
          }
  </code></pre>