title: Append pdf to itext pdf in memory within a servlet
body: <p>I am creating a system that dynamically creates a PDF using iText for Java from within a servlet using a <strong>ByteArrayOutputStream</strong>, and <strong>PdfWriter</strong>, to prevent filesystem usage.</p>
  
  <p>I would like to be able to append some existing PDF file pages to the end of the dynamically created PDF once the dynamic content is complete.</p>
  
  <p>I've looked at the example code to concatenate PDFs using iText, and they use <strong>PdfCopy</strong> to accomplish this. The big assumption for <strong>PdfCopy</strong> is that all files being concatenated exist on the file system.</p>
  
  <p>Is it possible to concatenate the existing files to the end of the in memory PDF, that exists as a <strong>ByteArrayOutputStream</strong>?</p>
  
  <p>In the meantime, I have used a temporary file for the initial dynamic document, but would like to remove that dependency if possible.</p>
  
  <p>Thanks,</p>
  
  <p>Allen</p>