PDFBox
  1. PDFBox
  2. PDFBOX-948

Don't use temporty files by default for all PDF sizes

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.5.0
    • Component/s: None
    • Labels:
      None

      Description

      PDFBOX uses by default temporary files as work space (regardless of the PDF size).

      org.apache.pdfbox.io.RandomAcessFile is not buffered, so each read/write acess is a system call. There are functions like readlong, which call read 4 times to read 4 bytes. Additionally, it adds the usual problems with tempory files.

      For normal sized PDFs files, the in-memory implementation RandomAccessBuffer should not increase the memory usage too much, while providing faster IO as all access operations are only memory copies.

      Therefore, please consider switching the default to in-memory scratch buffers. Users with very large files can still pass a temporary directory.

        Issue Links

          Activity

          Martin Koegler created issue -
          Martin Koegler made changes -
          Field Original Value New Value
          Attachment default-inmemory-workfile.patch [ 12469104 ]
          Martin Koegler made changes -
          Link This issue depends on PDFBOX-946 [ PDFBOX-946 ]
          Andreas Lehmkühler made changes -
          Affects Version/s 1.4.0 [ 12315444 ]
          Affects Version/s 1.5.0 [ 12316012 ]
          Hide
          Andreas Lehmkühler added a comment -

          I added the patch in revision 1072678 as proposed.

          Thanks for the contribution!

          Show
          Andreas Lehmkühler added a comment - I added the patch in revision 1072678 as proposed. Thanks for the contribution!
          Andreas Lehmkühler made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Andreas Lehmkühler [ lehmi ]
          Fix Version/s 1.5.0 [ 12316012 ]
          Resolution Fixed [ 1 ]
          Jukka Zitting made changes -
          Issue Type Wish [ 5 ] Improvement [ 4 ]
          Jukka Zitting made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Link This issue depends on PDFBOX-946 [ PDFBOX-946 ]
          Gavin made changes -
          Link This issue depends upon PDFBOX-946 [ PDFBOX-946 ]

            People

            • Assignee:
              Andreas Lehmkühler
              Reporter:
              Martin Koegler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development