Skip to content

fix(render): write checkbox V and DV as names - #3624

Open
cYoren wants to merge 1 commit into
diegomura:masterfrom
cYoren:oss-contrib/checkbox-value-name
Open

cYoren wants to merge 1 commit into
diegomura:masterfrom
cYoren:oss-contrib/checkbox-value-name

Conversation

@cYoren

@cYoren cYoren commented Nov 11, 2026

Copy link
Copy Markdown

a <Checkbox> writes its value as a literal string, so the field reads /V (/Yes) instead of /V /Yes. viewers that draw from /AS show a tick, but anything reading the value sees an unchecked box. pdf-lib's isChecked() returns false, mupdf reports /Yes with the slash, and a tool that rebuilds appearances from /V unticks it. iso 32000 12.7.4.2.3 wants a name object there.

cause: parseCheckboxOptions passed value: '/Yes' and defaultValue: '/Yes'. pdfkit maps those to V/DV and wraps them in a String object, which serialises as a literal. /AS escapes this because addFormAnnotation merges it into the field dict as a plain string.

fix: V and DV now go into the dict next to AS, as plain strings without the slash, so pdfkit writes them as names.

before  /V (/Yes)  /DV (/Yes)  isChecked() false
after   /V /Yes    /DV /Yes    isChecked() true

the unchecked box still writes /V /Off and reports false.

verified by rendering a document with one checked and one unchecked box, then reading it back with pdf-lib, and by a unit test for the field dict and annotation. the render and svgkit suites pass, eslint and prettier clean. packages/render typecheck fails on addBookmarks.ts and renderSvgImage.ts, which this change does not touch.

closes #3617

@vercel

vercel Bot commented Nov 11, 2026

Copy link
Copy Markdown

@cYoren is attempting to deploy a commit to the diegomura Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 345444e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Checkbox writes /V as a string (/Yes) instead of the name /Yes, so data readers see it unchecked

1 participant