Hi,

> Am 04.05.2016 um 15:55 schrieb Morgan GRIGNARD <[email protected]>:
> 
> 
> Hi,
> I encountered an error when i try to export an fdf in a pdf containing 
> PDRadioCollection. (1.8.12 version)
> 
> The first export is correct
> 
> <field name="horizon">
> *<value>4</value>*
> </field>
> 
> But after an fdf import, a direct pdf modification to choose another value 
> ("8"), the next export contain :

what was the content of the FDF?

BR
Maruan

> 
> <field name="horizon">
> *<value>4</value>*
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>4</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> <field name="null">
> <value>Off</value>
> </field>
> </field>
> 
> when i analyse source code, the kids management check and uncheck element 
> during import, but this state doesn't change when i directly edit pdf.
> 
> 
> To correct this i was obliged to adapt import code to ignore kids part :
> 
> 
> List<FDFField> fields = fdf.getCatalog().getFDF().getFields();
> 
> if (fields != null) {
>    for (FDFField fdfField : fields) {
>        PDField docField = form.getField(fdfField.getPartialFieldName());
>        if (docField != null) {
>            try {
> *if (docField instanceof PDRadioCollection) {**
> **                    String value = (String) fdfField.getValue();**
> **                    if (value != null) {**
> **docField.getDictionary().setString(COSName.V, value);**
> **
> **                        List<PDAnnotationWidget> widgets = 
> docField.getWidgets();**
> **                        int index = Integer.valueOf(value) - 1;**
> **                        if (widgets.size() > index) {**
> **widgets.get(index).getDictionary().setName(COSName.AS, value);**
> **                        }**
> **                    }**
> **                } *else {
>                    docField.importFDF(fdfField);
>                }
>            } catch (NumberFormatException e) {
>                errors.append("Field 
> (").append(fdfField.getPartialFieldName()).append(",").append(e.getMessage()).append(");");
>            } catch (IOException e) {
>                errors.append("Field 
> (").append(fdfField.getPartialFieldName()).append(",").append(e.getMessage()).append(");");
>            }
>        }
>    }
> }
> 
> Is this a misunderstanding on my part?
> 
> Regards
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to