Repository navigation
Conversation
…mes it When a form's font is written inline in /AcroForm /DR (a dictionary inside /DR, not an object of its own), the appearance a fill writes got an inline copy of it, and Acrobat showed none of the editable fields filled that way: nothing drawn, no highlight, no click. Acrobat minds the font /DR holds inline; the appearance's own copy alone does not matter. The first appearance written into the file that names such a font now makes it an object of its own, which /DR and the appearance both name.
A field without /Kids was taken to be its own widget even when it is not a widget annotation. The engine creates a field, sets its flags, then attaches its widgets, so making a new field read-only drew an appearance with an empty box onto the field dictionary itself. Such a field is its own widget only with /Subtype /Widget, as CPDF_InteractiveForm reads it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
Filled fields blank in Acrobat. When a form's font is written inline in
/AcroForm /DR(a dictionary inside/DR, not an object of its own),CPDF_AnnotFontMap::PrepareFontResourcesgives the appearance a fill writes an inline copy of it (font_dict->Clone()). Acrobat 26 then shows none of the editable text fields filled that way: nothing is drawn, the field has no highlight, and it can't be clicked. Read-only fields still show.Acrobat was checked one change at a time, starting from the engine's filled file:
/DRstill inline: still blank;/DRfont made an object of its own, the appearances keeping their inline copies: every field shows, live;So Acrobat minds the font that
/DRholds inline. Real forms keep their/DRfonts as objects of their own (none of 131 real-world forms in a local scan writes them inline); hand-written and generated files often don't.A stray appearance on a created field.
CollectRawTxnControlstakes a field without/Kidsto be its own widget even when it is not a widget annotation. The engine creates a field, sets its flags, then attaches its widgets, so making a new field read-only (EPDFForm_SetFieldFlags, thenRegenerateFieldAppearances) drew an appearance with/BBox [0 0 0 0]onto the field dictionary itself, beside its widget's real one. A value written and redrawn before the widget is attached did the same.Change
ResolveDaFontForPersistentTargetmakes a/DRfont that is written inline an object of its own (MakeInlineDrFontAnObject, written through the document's writable catalog chain, as the fallback beside it is) before an appearance written into the file names it./DRand the appearance then name the same object. Form fields, free text and redaction overlays all resolve their font there; ephemeral appearances are unchanged. A font that already is an object is used as it is, and/DRis not written./Kidsis its own widget only with/Subtype /Widget, asCPDF_InteractiveForm::AddTerminalFieldreads it. A field with no widget yet has no controls: its value is written, and nothing is drawn.own-appearance-generatorrule names the new helper and its tests.Tests
EPDFFormEmbedderTest.AFillMakesAnInlineFormFontAnObject: two fills of a form whose/DRfont is inline./DRand both appearances name one new object, in memory and in the saved file.AnInlineFormFontBecomesAnObjectInATransaction: the same in a layer transaction, as the engine writes.AFormFontThatIsAnObjectIsNamedAsItIs:text_form.pdf's font is named as it is, and/DRis not written (nothing of it is promoted on a layer).AFieldWithoutWidgetsGetsNoDrawing: create a field, make it read-only, fill it, then attach a widget. The field dictionary never gets an/AP; the widget does.AFillMakesAnInlineFormFontAnObjectandAFieldWithoutWidgetsGetsNoDrawingare listed as layer-mode writers.Checked
Checked on the branch head (both commits together).
check-fork-tags.py --strict,check-c-api.py(604 functions),check-globals.pyon the macOS library./DRfont was inline, then filled (so this change makes the font an object after the signature): with an approval signature Acrobat says the signed revision is unaltered and lists "Form Fields Filled In"; with a certification at P=2 it says the changes are permitted by the certifying party, with the same list. The engine's signature analysis says permitted for both.Left
check-globals.pyon the Linux library: not run.CPDF_BAFontMap) copies an inline font into the appearances it writes the same way. The engine does not write through it.