Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4943

PDF Merge of large document, memory usage?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.0.21
    • None
    • Utilities
    • None
    • Windows, java x64

    Description

      We are trying to use the PDFMergerUtility to merge a number of PDF files, but are having an issue with exhausting java heap with a specific PDF file.  This file is about 50mb, but merging with it requires a java heap of 8gb.  We've tried using setupTempFileOnly() but that doesn't seem to help. 

      Looking further, just doing a PDDocument.load() operation for this file uses 3.5gb of heap, regardless of MemoryUsageSetting() values.

      For instance, with the following main()

      public static void main(String arg[]) public static void main(String arg[])

      { try

         

      { // load the document         PDDocument sourceDoc = PDDocument.load( new File("c:\\tmp\\testfile.PDF"),                           MemoryUsageSetting.setupTempFileOnly().setTempDir(new File("c:\\tmp")) );         sourceDoc.close(); LogMessage.log( "Completed");     }

        catch (Exception e)

       

      {   LogMessage.log( "Exception in document load: "+e.toString());   }

      }

      Setting a breakpoint at the sourceDoc.close(), the heap has increased to 3.5gb.

       

      Our test case can be downloaded from:

      https://s3.amazonaws.com/webdl.equorum.com/misc/testfile.pdf

       

      Thanks,

      Rich Stafford

      Chief Scientist

      eQuorum Corporation

      Attachments

        Activity

          People

            Unassigned Unassigned
            RichStafford Richard Stafford
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: