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

IllegalStateException on saveIncrementalForExternalSigning

    XMLWordPrintableJSON

Details

    Description

      When adding a signature to a PDF document which already contains an invisible signature, the following exception is thrown:

      java.lang.IllegalStateException: signature reserve byte range has been changed after addSignature(), please set the byte range that existed after addSignature()
      

      Step to reproduce:

      • Get a simple PDf document having an empty signature field and signed (using Adobe) with an invisible signature.
      • Run the org.apache.pdfbox.examples.signature.CreateVisibleSignature setting lateExternalSigning = true

      Full Stack trace:

      java.lang.IllegalStateException: signature reserve byte range has been changed after addSignature(), please set the byte range that existed after addSignature()
      	at org.apache.pdfbox.pdmodel.PDDocument.saveIncrementalForExternalSigning(PDDocument.java:1361)
      	at org.apache.pdfbox.examples.signature.CreateVisibleSignature.signPDF(CreateVisibleSignature.java:270)
      

      Use the attached PDF as reference to reproduce

      Maybe related to: PDFBOX-3811

      Attachments

        1. Test_certified_invisible.pdf
          126 kB
          Alessandro Marini

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              ale.marini Alessandro Marini
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: