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

Leftover file in temp directory when signing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1, 2.0.2, 3.0.0 PDFBox
    • 2.0.2, 3.0.0 PDFBox
    • Signing
    • None

    Description

      As reported by Damien Butaye on the mailing list:

      I'm trying to add a signature to a PDF using PDFBOX 2.0.1. During the
      process, a tmp file (e.g: tmpPDFBoxXXX.pdf) is stored inside the /tmp
      directory (RehHat server). This file is not deleted after completion.
      After some checks, it seems that the object responsible of the file
      creation is "RandomAccessBufferedFileInputStream(InputStream is)". This
      object is used by the PDFParser object which doesn't close the stream
      after
      completion.

      and his solution:

      For your information I found a workaround to avoid the problem of tmp file
      deletion. In the SignatureOptions object, I modified the method *public
      void setVisualSignature(InputStream is) *with the following content :

      RandomAccessBufferedFileInputStream tmp=new
      RandomAccessBufferedFileInputStream(is); --> NEW LINE
      PDFParser parser = new PDFParser(tmp); --> NEW LINE
      parser.parse();
      visualSignature = parser.getDocument();
      tmp.close(); --> NEW LINE

      Tmp files are well deleted and all unit tests passed without error on the
      pdfbox maven project.

      Attachments

        Activity

          People

            tilman Tilman Hausherr
            tilman Tilman Hausherr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: