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

getLastSignatureDictionary modifies internal structure of PDDocument

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.12
    • Fix Version/s: 3.0.0 PDFBox
    • Component/s: AcroForm
    • Labels:
      None

      Description

      If one calls PDDocument#getLastSignatureDictionary, the AcroFrom is populated with the defaults even if not needed. This modifies the internals of the PDDocument and therefore there are changes to be saved, even if the file is not modified by "real" changes.

      For example:

                  PDDocument pdfDocument = PDDocument.load(pdfBytes);
                  pdfDocument.getLastSignatureDictionary();
      

      This calls the verifyOrCreateDefaults() method, which initializes the DR-Dictionary if not yet done. This is even done if getLastSignatureDictionary returns null.

      Why this bothers me: it is very unexpected behaviour that a getter modifies an objects state. This is no big deal for our usecase, the other issue (PDFBOX-4303) was a bigger problem as we are diffing objects between revisions (current vs last signed revision).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                weisskopf beat weisskopf
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: