Skip to content

Commit 1bb1b2c

Browse files
jakejackson1claude
andauthored
Give every active form widget its own appearance, and ask the viewer to redraw only text it cannot shape (#348, #59) (#387)
* Draw every active form widget in a PDF/A document instead of asking the viewer to (#348) Checkboxes and radio buttons switched to ZapfDingbats, which mPDF cannot embed, so PDF/A and PDF/X threw. They now draw the shapes mPDF already has for formUseZapD = false, in the colour space the output intent allows. Under PDF/A, text fields, choices and push buttons get an appearance stream laid out when the widget is placed (value, password mask, wrapped textarea, selected option, list box highlight, caption or icon), the AcroForm drops /NeedAppearances, hidden inputs and noprint buttons are printed, and JavaScript, submit and reset actions are left out. Without PDFAauto the dropped actions and noprint are reported as PDF/A warnings. Other documents still ask the viewer to redraw widgets, and now name the ZaDb font it redraws checkboxes with in /DR, which stops poppler warning of an unknown font tag (#59). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Give every active text field, choice and push button its own appearance Viewers that ignore /NeedAppearances, as many mobile, print and preview ones do, drew these widgets empty. The appearances PDF/A needed are now written for every document, with core-font text in Windows-1252 and embedded-font text in UTF-16. Outside PDF/A the form still asks the viewer to redraw them, and keeps its actions and its hidden and noprint flags. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Ask the viewer to redraw form fields only for text their appearances cannot shape Every widget now carries an appearance, so /NeedAppearances is written only when a field's value, options or caption is in a right-to-left script or a script with a shaper of its own (Otl::hasComplexScript), which mPDF's appearances neither reorder nor shape (#408). PDF/A never writes it. /ZaDb joins /DR only alongside the flag, when there is a checkbox or radio button to redraw (#59). Without the flag, viewers draw checkboxes and radio buttons from their own appearances, and the ZapfDingbats ones have no bounding box and no off state to draw. Every document now uses the vector shapes PDF/A and PDF/X already drew, and the formUseZapD property that chose between them is gone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the form snapshots for the appearances every widget now carries Ghostscript draws a widget from its appearance where it has one. In page-break-avoid-forms the select shows its selected option rather than its export value, the buttons show their captions, and the checkboxes and radio buttons are the vector shapes; in page-break-avoid-references only the text field is drawn differently. Neither document asks the viewer to redraw its widgets any more, so /NeedAppearances and /ZaDb are gone from both. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Keep the check box and radio paths on one source line, so a Windows checkout writes no CR The paths were string literals running over two lines. With text=auto, Git checks them out with CRLF on Windows, and the carriage return reached the appearance stream, so the page-break-avoid-forms snapshot differed there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Snapshot every form field, drawn statically, as active widgets and in PDF/A The same page of fields renders three ways: into the page without active forms (form-fields-static), as widgets with their own appearances (form-fields-active) and as a PDF/A-2b document drawn from the appearances alone (form-fields-pdfa). The page has text, password, read-only, disabled, required and maxlength inputs, short and wrapped text areas, a combo box, a list box and a multiple select, checkboxes and a radio group, submit, reset, script and image buttons, a hidden input, a field styled in CSS, and an Arabic value, which has the active document ask the viewer to redraw its widgets. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 864533b commit 1bb1b2c

17 files changed

Lines changed: 869 additions & 106 deletions

‎phpstan-baseline.neon‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ parameters:
5757
-
5858
message: '#^Variable \$radio_background_color might not be defined\.$#'
5959
identifier: variable.undefined
60-
count: 2
60+
count: 1
6161
path: src/Form.php
6262

6363
-
6464
message: '#^Variable \$radio_color might not be defined\.$#'
6565
identifier: variable.undefined
66-
count: 10
66+
count: 1
6767
path: src/Form.php
6868

6969
-

0 commit comments

Comments
 (0)