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

Invisible Signature should have empty Appearance Dictionary

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.17
    • Fix Version/s: 2.0.18, 3.0.0 PDFBox
    • Component/s: Signing
    • Labels:
      None

      Description

      According to TechNote 0006: Digital Signatures in PDF/A-1
      http://www.pdfa.org/wp-content/uploads/2011/08/tn0006_digital_signatures_in_pdfa-1_2008-03-141.pdf Section 2.4 "The visual appearance must also exist for an invisible signature but may be empty." 

      This should be easily handled by modifying PDDocument as indicated below:

      private void prepareNonVisibleSignature(PDSignatureField signatureField)
              throws IOException
      {
          // "Signature fields that are not intended to be visible shall
          // have an annotation rectangle that has zero height and width."
          // Set rectangle for non-visual signature to rectangle array [ 0 0 0 0 ]
          signatureField.getWidgets().get(0).setRectangle(new PDRectangle());
      +    signatureField.getWidgets().get(0).setAppearance(new PDAppearanceDictionary());
      }
      
      

      If this is an acceptable solution I would be happy to provide a PR

        Attachments

        1. PDFA_signed.pdf
          54 kB
          Tilman Hausherr
        2. PDFA_signed2.pdf
          54 kB
          Tilman Hausherr

          Issue Links

            Activity

              People

              • Assignee:
                tilman Tilman Hausherr
                Reporter:
                sstrobl Stefan Strobl
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: