title: PDFBox: working with very large PDFs.
body: <p>I am working with some very large PDFs, some over 7GB in size. The PDFs have up to 20,000 pages and many full page color images. I'd like to use PDFBox to work with the PDFs, but due to the size I get OutOfMemoryError's when I attempt to open the PDFs. </p>
  
  <p>I'm working with version pdfbox-app-1.6.0, on Windows 7 using Intellij, java 6.</p>
  
  <p>First I tried writing a simple program that just opened the PDF in a PDDocument and coping each page over to another PDDocument: <a href="http://ideone.com/arKhB" rel="noreferrer">http://ideone.com/arKhB</a></p>
  
  <p>Next I tried using the PDFBox <a href="http://pdfbox.apache.org/apidocs/org/apache/pdfbox/examples/persistence/CopyDoc.html" rel="noreferrer">CopyDoc</a> example.</p>
  
  <p>Both example run out of memory.  </p>
  
  <p>I'm assuming this is because PDFBox is trying to read the whole document into memory. Is there a way to have it only open 1 page at a time? I know it would be slower processing, but at the moment I can't process anything. </p>