#1485·pdfcpu

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

Image

input.pdf

Actual output

Filling the second option with pdfcpu v0.15.0 succeeds, but the output is broken in multiple viewers.

bash
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.pdf

output.pdf

Acrobat 2026.002.21901

Image

MacOs Preview 11.0 (1113.5.3)

Image

Poppler 26.02.0

Image

Expected output

Image

fixed.pdf

Suspected cause

The example uses named appearance states without optional /Opt entry. Inspecting the output with:

bash
qpdf --qdf --object-streams=disable output.pdf output-qdf.pdf

shows:

pdf
/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