The current code for displaying a check when a checkbox is toggled
includes the comment:
According to the PDF spec the off state must be named "Off", and the
on state can be named anything, but Acrobat apparently looks for
"Yes" and treats anything else as off.
However, my experience is that this is not true--the form at
http://www.irs.gov/pub/irs-pdf/f1040.pdf includes some checkboxes with
differently-named states. (Specifically, near the end of the second
page, "Third Party Designee" has a "Yes" and a "No" checkbox, both part
of the same group so that only one can be selected at a time. The first
checkbox has states called /Yes and /Off, but the second has states /No
and /Off.)
The attached patch changes this behavior, so that it is possible to
select any of the checkboxes in the document.
(I wonder about the documents the comment referred to; this patch would
presumably break those. The behavior of Acrobat is presumably a bit
more complex. It might be that more complete processing of the
appearance dictionary is needed, but that would be a more intrusive
patch.)
--Michael Vrable
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 9e866aa..e938b42 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1156,10 +1156,8 @@ void Annot::generateFieldAppearance(Dict *field, Dict *annot, Dict *acroForm) {
}
// checkbox
} else {
- // According to the PDF spec the off state must be named "Off",
- // and the on state can be named anything, but Acrobat apparently
- // looks for "Yes" and treats anything else as off.
- if (Form::fieldLookup(field, "V", &obj1)->isName("Yes")) {
+ if (Form::fieldLookup(field, "V", &obj1)->isName() &&
+ strcmp(obj1.getName(), "Off") != 0) {
if (!caption) {
caption = new GooString("3"); // ZapfDingbats checkmark
}
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler