Loic created PDFBOX-4125:
----------------------------
Summary: FDFField.writeXML KO with String
Key: PDFBOX-4125
URL: https://issues.apache.org/jira/browse/PDFBOX-4125
Project: PDFBox
Issue Type: Bug
Components: AcroForm
Affects Versions: 2.0.8
Reporter: Loic
When saving an XFDF into file, all the `<value>` are skiped in the output.
This is due to an incoherence between `writeXML()` which use `value instanceof
COSString`
{code:java}
public void writeXML(Writer output) throws IOException
{
output.write("<field name=\"" + getPartialFieldName() + "\">\n");
Object value = getValue();
if (value != null)
{
if (value instanceof COSString)
{
output.write("<value>" + escapeXML(((COSString)
value).getString()) + "</value>\n");
}
else if (value instanceof COSStream)
{
output.write("<value>" + escapeXML(((COSStream)
value).toTextString()) + "</value>\n");
}
}
{code}
and `getValue()` which transform COSString into String :
{code:java}
public Object getValue() throws IOException
{
COSBase value = field.getDictionaryObject(COSName.V);
if (value instanceof COSName)
{
return ((COSName) value).getName();
}
else if (value instanceof COSArray)
{
return COSArrayList.convertCOSStringCOSArrayToList((COSArray)
value);
}
else if (value instanceof COSString)
{
return ((COSString) value).getString();
}
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]