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

Adding font (or changing font subset) not coming through in saveIncremental

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.24
    • None
    • AcroForm, PDModel, Signing
    • None

    Description

      In an effort to keep file sizes small, we leverage Font Subsets in our PDFs.

      Also, we already have "incremental change and signing" (where fields are changed after a signature, without voiding the prior signature thanks to using `saveIncremental` and signing the changes) working just fine in most cases.

      However, when the Font on a field is changed or a new Font Subset must be added to the document because the characters used in a field with a tightly-subsetted Font, things don't work correctly:

      • The signatures stay valid, which is great
      • But the new Font information does not appear to get written to new version appendix, so you get nonsense rendering in a PDF viewer since the field still points to a Font resource that is either not there or is a subset that does not contain all the necessary characters. I'm not super proficient in this so I don't know exactly what's going on.

       

      I have ensured that the fields we update are getting marked as `setNeedToBeUpdated(true)` (this is, I believe, why the fields changes do end up in the version changes), it just seems that the Font resources are not getting updated in the version.

      I have also tried to mark the document's PDResource as `setNeedToBeUpdated(true)` but to no avail.

       

      Is this behavior possible/allowed? Is it a bug or am I doing something wrong?

       

      I have included an example file where the field named `incrementalChangeField` goes from `NotoSans-Regular` to `NotoSansCJK-Regular` during the incremental change, but the font resource does not get added.

      Thanks for your time!

      Attachments

        1. update-after-signature-includes-font-change.pdf
          169 kB
          Chris Newhouse
        2. image-2023-03-31-17-40-48-710.png
          234 kB
          Chris Newhouse
        3. update-after-signature-that-changes-font-two.pdf
          290 kB
          Chris Newhouse

        Activity

          People

            Unassigned Unassigned
            newhouse-anvil Chris Newhouse
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: