form fill: radio option names containing spaces are double-encoded in /V and /AS
Author: ftesCreated Sep 16, 2026Updated Sep 17, 2026
Labelsinvestigate
Example
A PDF has two radio options: first and now only job.
Input
Actual output
Filling the second option with pdfcpu v0.15.0 succeeds, but the output is broken in multiple viewers.
data='{"forms":[{"radiobuttongroup":[{"name":"choice","value":"now only job"}]}]}'
printf '%s\n' "$data" > data.json
pdfcpu form fill -c disable input.pdf data.json output.pdfAcrobat 2026.002.21901
MacOs Preview 11.0 (1113.5.3)
Poppler 26.02.0
Expected output
Suspected cause
The example uses named appearance states without optional /Opt entry. Inspecting the output with:
qpdf --qdf --object-streams=disable output.pdf output-qdf.pdfshows:
/V /now#2320only#2320job
/AS /now#2320only#2320job
% Existing /AP /N key:
/now#20only#20job#23 decodes to a literal #, so /AS does not match the appearance key. The value is double-encoded.
Related
Source: pdfcpu/pdfcpu