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

SignatureOptions object must not be closed before calling saveIncremental in trunk's CreateVisibleSignature example

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Signing
    • Labels:
      None

      Description

      As reported by Rafael Gomez on the user mailing list:

      Exception in thread "main" java.io.IOException: COSStream has been closed and cannot be read. Perhaps its enclosing PDDocument has been closed?
      	at org.apache.pdfbox.cos.COSStream.checkClosed(COSStream.java:78)
      	at org.apache.pdfbox.cos.COSStream.createRawInputStream(COSStream.java:126)
      	at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1138)
      	at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:372)
      	at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:158)
      	at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:538)
      	at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:450)
      	at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1039)
      	at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:409)
      	at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1289)
      	at org.apache.pdfbox.pdmodel.PDDocument.saveIncremental(PDDocument.java:1118)
      	at org.apache.pdfbox.examples.signature.CreateVisibleSignature.signPDF(CreateVisibleSignature.java:169)
      	at org.apache.pdfbox.examples.signature.CreateVisibleSignature.main(CreateVisibleSignature.java:261)
      

      He got rid of the exception by moving options.close() after doc.saveIncremental(fos))

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tilman Tilman Hausherr
                Reporter:
                tilman Tilman Hausherr
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: