Repository navigation
Give an active form field the width and style of its CSS border (#431), restoring #445 - #469
Merged
jakejackson1 merged 1 commit intoSep 23, 2026
Conversation
#445) * Give an active form field the width and style of its CSS border (#431) An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the active field colour fallback and the no-border rules between the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the active border helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the active form snapshots for the CSS border width and the select's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Cherry-picked from c675d3f. PR #445 was merged into fix/432-static-field-css after #442 had already merged that branch into feature/pdfa-2-conformance, so it never reached this branch.
jakejackson1
added a commit
that referenced
this pull request
Sep 23, 2026
#445) (#469) * Give an active form field the width and style of its CSS border (#431) An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the active field colour fallback and the no-border rules between the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the active border helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the active form snapshots for the CSS border width and the select's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Cherry-picked from c675d3f. PR #445 was merged into fix/432-static-field-css after #442 had already merged that branch into feature/pdfa-2-conformance, so it never reached this branch.
jakejackson1
added a commit
that referenced
this pull request
Sep 23, 2026
#445) (#469) * Give an active form field the width and style of its CSS border (#431) An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the active field colour fallback and the no-border rules between the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the active border helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the active form snapshots for the CSS border width and the select's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Cherry-picked from c675d3f. PR #445 was merged into fix/432-static-field-css after #442 had already merged that branch into feature/pdfa-2-conformance, so it never reached this branch.
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.
Fixes #431
Restores #445, which was merged into the wrong branch. #442 merged
fix/432-static-field-cssintofeature/pdfa-2-conformancefirst. #445, stacked on #442, was then merged intofix/432-static-field-css(c675d3f), so its changes never reachedfeature/pdfa-2-conformance. This PR is that squash commit cherry-picked ontofeature/pdfa-2-conformance. #442's squash (9581528) has the same content as the commit #445 was merged on, so the cherry-pick applied cleanly and the resulting tree is identical to c675d3f. Nothing changed from what was reviewed in #445.The description below is #445's, with the verification counts refreshed.
What changed
/BS /Wnow comes from the CSS border width in points./BS /Scomes from its style:/S/D /D [3]/D /D [1]/I/B/S, since PDF has no equivalent.border: noneorborder-style: hiddengives/W 0, and/MKleaves out/BC, because a viewer that redraws the field draws a border wherever/BCis present. The same applies to text and choice fields left atSetFormBorderWidth('0').appearanceColor(), so they follow the output intent./MKis also CMYK when the document is restricted to CMYK.SetFormChoicealso takes the select's CSSborder-colorandbackground-colornow; before, it ignored them.Form::activeBorder($objattr)turns the recorded CSS into['W' => …, 'S' => …].SetFormText,SetFormChoice,SetFormButtonand the reset, submit and JS button wrappers take it as a new trailing optional$borderarray. When the array leavesWorSout, the existingform_border_*orform_button_border_*default is used for it.SetFormChoicealso gains the$background_coland$border_colparameters the others already had.Snapshots
Refreshed in their own commit and checked by rasterising with
pdftoppm:form-fields-activeandform-fields-pdfa: the "Styled" field's border goes from 1pt to 0.5mm (1.417pt) in both/BSand the appearance. Otherwise only the PDF/A document ID changes.page-break-avoid-formsandpage-break-avoid-references: these setborder: 0.2mm solid #404040on fields. The active fields now draw that thinner 0.567pt border, and the select picks up the grey border colour too.Verification
tests/Mpdf/ActiveFieldBorderTest.phphas 18 tests:/BS << /W 1.417 /S /S >>,/MK <</BC [ 0 0 1 ] /BG [ 1 1 0.8 ], and an appearance stroking0 0 1 RG 1.417 w;noneandhidden:/W 0, no/BC, no stroke;restrictColorSpace3.composer test: 3828 tests, 5 skipped (these were already skipped before this change), no failures.composer test -- --group=snapshot: 89 OK.composer test -- --group=conformance(veraPDF): 29 OK.composer csis clean. PHPStan 2.2.15 reports no errors.php -lunder PHP 5.6 is clean.SetJSButton()'s movedSetFormButton()call needed$borderpassed through. Thebuttoncase ofActiveFieldBorderTestfails without it.Limits and follow-ups
/BS, but Give every active form widget its own appearance, and ask the viewer to redraw only text it cannot shape (#348, #59) #387's appearance draws them as a flat border. Only viewers that redraw the field show the bevel./BS << /W 1 /S /S >>andform_radio_colorborder, because their drawn appearances are fixed shapes.restrictColorSpaceset to 3 and no CMYK ICC profile fails veraPDF 6.2.4.3-3 even with no form at all. That problem predates this PR (A PDF/A document restricted to CMYK without a CMYK ICC profile fails veraPDF, and its sRGB profile is labelled as four components #449).activeBorder(), the new$borderparameters, the/BS//MKchanges andSetFormChoice's colours don't depend on Give every active form widget its own appearance, and ask the viewer to redraw only text it cannot shape (#348, #59) #387. ThewriteAppearancedash and width changes are fork-only.🤖 Generated with Claude Code