View Issue Details

IDProjectCategoryView StatusLast Update
0015411ScribusGeneralpublic2019-06-04 20:56
Reportertanimientras Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.4 
Fixed in Version1.5.5.svn 
Summary0015411: Checkbox value is rendered as "4" (or some other value) by iText
DescriptionWhen using scribus 1.4.7, exported pdf values for checked checkboxes are "Yes"
Using scribus 1.5.4 seems to be checkbox name (eg: "mycheck")

This results in issues when flattening files in Itext, displaying numbers instead of cross/check/whatever.
Steps To ReproduceGenerate a document with a checkbox named "myCheck" and print its value in console.
When checked, 1.4.7 will show "Yes"
while 1.5.4. will print "myCheck"
Additional InformationRelated: https://bugs.scribus.net/view.php?id=7322
TagsNo tags attached.
PatchNo

Activities

tanimientras

2018-08-27 13:37

reporter  

a154.pdf (13,429 bytes)
a147.pdf (3,288 bytes)

jghali

2018-08-28 02:12

administrator   ~0045418

Last edited: 2018-08-28 06:26

According to SVN changelog the change in 1.5.x was performed in order to implement radio buttons behavior. Fyi in PDF forms, check boxes and radio buttons are basically described in the same way, just with a different set of flags. As far as I can see the reason for that change is that a "Yes" value is completely insufficient to describe the state of a checkbox/radio group.

Anyway assuming that the value of a checkbox will be "Yes" if checked is incorrect as PDF specifications do not provide such guarantee at all. iText would be in error if it is performing such assumption. In fact PDF specifications only guarantee the value will be "Off" if the check box is unchecked.

tanimientras

2018-08-28 09:06

reporter   ~0045420

Itext apart (going to ask on their forums), what it would be the proper way to set a checkbox value from Javascript?

  var f=this.getField("myCheck");
  f.value="Yes";

The above doesn't work, as it _expects_ "Off"/myCheck. Is value="myCheck" Acrobat Forms "compliant"? What value Acrobat (Pro) uses when checked?

jghali

2018-08-28 17:48

administrator   ~0045421

>> what it would be the proper way to set a checkbox value from Javascript?

var f=this.getField("myCheck");
f.checkThisBox(0, true); // Check the box
f.checkThisBox(0, false); // Uncheck the box

Assigning any value other than "Off" to a checkbox makes the Javascript form dependent. As mentionned in my previous notes, PDF specifications only guarantee the value will be "Off" if the check box is unchecked. The other states are defined in the PDF itself, and the names of those states are left completely to the PDF generating application. That means if an application choose to name the "Checked" state "On", you need to assign "On" to field value to check it by script whereas if another application choose to name the "Checked" state "Checked", you would need to assign "Checked" to field value to check it. So in the end it's better using checkThisBox() method to make Acrobat figure things by itself.

In the same way, never test against value "Yes" to check if a checkbox is checked. You should test if value is different than "Off".

tanimientras

2018-09-05 10:14

reporter   ~0045428

Tested checkThisBox but it failed too.

Do you have any source to support your statement: 'PDF specifications only guarantee the value will be "Off" if the check box is unchecked.'
Third-Party would argue they're doing it right unless proven.
Thanks a lot for your help.

jghali

2018-09-05 19:24

administrator   ~0045429

Here is a link to PDF 1.5 specification which is the last PDF version we export to:
https://wwwimages2.adobe.com/content/dam/acom/en/devnet/pdf/pdf_reference_archive/PDFReference15_v6.pdf

Page 626, Checkboxes:

"Each state can have a separate appearance, defined by an appearance stream in
the appearance dictionary of the field’s widget annotation (see Section 8.4.4, “Appearance
Streams”). The appearance for the off state is optional, but if present
must be stored in the appearance dictionary under the name Off. The recommended
name for the on state is Yes, but this is not required.

The V entry in the field dictionary (see Table 8.60 on page 615) holds a name object
representing the checkbox’s appearance state, which is used to select the appropriate
appearance from the appearance dictionary."

Here, "the V entry in the field dictionary" correspond to the field value. The field value contains a name which must match the name of the corresponding appearance stream. Notice then the wording for the "Off" state, " ... *must* be stored in the appearance dictionary under the name Off", vs the wording for the checked state, ".. but this is not required".

PDF specs leave in fact the possibility for check boxes to represent more than two states. Tri-state checkboxes can be perfectly represented if appearance stream dictionary contains the proper data.

tanimientras

2018-09-06 07:45

reporter   ~0045432

THANKS

jghali

2018-09-07 21:04

administrator   ~0045445

I restored the old behavior for simple check boxes, so that the exported values is "Yes" again. The radio button behavior will remain as is, ie checked state value is the field name, as this is what PDF Specs requires for radio buttons.

For your information software such as Indesign allows to choose checkbox export value for checked state and set that value to something other than "Yes". So my complaint vs iText remains valid.

tanimientras

2018-09-10 06:37

reporter   ~0045452

If I remember correctly, using exportValues didn't help at all. The value changed to "Yes", but after iText processing they were rendered blank/unchecked
I'll try 1.5.5.svn as soon as i can to check if this change works in any way.
Thanks.

Issue History

Date Modified Username Field Change
2018-08-27 13:37 tanimientras New Issue
2018-08-27 13:37 tanimientras File Added: a154.pdf
2018-08-27 13:37 tanimientras File Added: a147.pdf
2018-08-28 02:12 jghali Note Added: 0045418
2018-08-28 02:13 jghali Note Edited: 0045418
2018-08-28 06:26 jghali Note Edited: 0045418
2018-08-28 09:06 tanimientras Note Added: 0045420
2018-08-28 17:48 jghali Note Added: 0045421
2018-09-05 10:14 tanimientras Note Added: 0045428
2018-09-05 19:24 jghali Note Added: 0045429
2018-09-06 07:45 tanimientras Note Added: 0045432
2018-09-07 19:52 jghali Summary Checkbox value is rendered as "4" (may be other value) => Checkbox value is rendered as "4" (or some other value) by iText
2018-09-07 21:04 jghali Note Added: 0045445
2018-09-07 21:04 jghali Assigned To => jghali
2018-09-07 21:04 jghali Status new => resolved
2018-09-07 21:04 jghali Resolution open => fixed
2018-09-07 21:04 jghali Fixed in Version => 1.5.5.svn
2018-09-07 21:26 jghali Severity block => minor
2018-09-10 06:37 tanimientras Note Added: 0045452
2019-06-04 20:56 cbradney Status resolved => closed