2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-10 23:20:58 +00:00

Allow other than /Yes and /Off in a check box (fixes #1056)

This commit is contained in:
Jay Berkenbilt 2023-12-22 14:42:16 -05:00
parent b670565abc
commit 86ea2012bd
3 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2023-12-22 Jay Berkenbilt <ejb@ql.org>
* When setting a check box value, allow any value other than /Off
to mean checked. This is permitted by the spec. Previously, any
value other than /Yes or /Off was rejected. Fixes #1056.
2023-12-21 Jay Berkenbilt <ejb@ql.org> 2023-12-21 Jay Berkenbilt <ejb@ql.org>
* Fix to QPDF JSON: a floating point number that appears in * Fix to QPDF JSON: a floating point number that appears in

View File

@ -304,10 +304,10 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances)
bool okay = false; bool okay = false;
if (value.isName()) { if (value.isName()) {
std::string name = value.getName(); std::string name = value.getName();
if ((name == "/Yes") || (name == "/Off")) { okay = true;
okay = true; // Accept any value other than /Off to mean checked. Files have been seen that use
setCheckBoxValue((name == "/Yes")); // /1 or other values.
} setCheckBoxValue((name != "/Off"));
} }
if (!okay) { if (!okay) {
this->oh.warnIfPossible("ignoring attempt to set a checkbox field to a value of " this->oh.warnIfPossible("ignoring attempt to set a checkbox field to a value of "

View File

@ -56,6 +56,11 @@ Planned changes for future 12.x (subject to change):
in scientific notation to fixed-point notation since PDF doesn't in scientific notation to fixed-point notation since PDF doesn't
accept scientific notation. accept scientific notation.
- When setting a check box value, allow any value other than
``/Off`` to mean checked. This is permitted by the spec.
Previously, any value other than ``/Yes`` or ``/Off`` was
rejected.
- Build Enhancements: - Build Enhancements:
- The qpdf test suite now passes when qpdf is linked with an - The qpdf test suite now passes when qpdf is linked with an