You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Ranjeet Kuruvilla <ra...@yandex.com> on 2021/05/07 09:02:48 UTC
Missing Field Values
I am converting a byte[] to PDDocument and had a shocking experience:
There were field values (not the fields themselves) missing. I compared
PDFBox 2.0.23 to IText.
Acroform acroform = PDDocument.load(source, password);
HashMap<String, AcroFields.Item> fields2 = (new PDFReader(source,
password)).getAcroFields().getFields(); // Fields from IText
for(PDField field: acroform.getFields()) // Fields from PDFBox
{
System.out.println("Field " + field.getFullyQualifiedName() + "
IText [" + acroform.getField(field.getFullyQualifiedName()) + "] PDFBox
[" + field.getValueAsString() + "]");
}
The result was occassionally akin to
Field KEY IText [Value] PDFBox []
I expected it to be
Field KEY IText [Value] PDFBox [Value]
. It might be, that that particular PDF has Fields with the same key,
because I did not experience that problem with other PDFs.
May I ask whether there is a known bug with PDFBox 2.0.23, that allows
for such a behaviour? How come, that PDFs created in C++ are no longer
readable in PDFBox? How can I fix the bug? I do not wish to use IText to
solve it.
Re: Missing Field Values
Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Could you upload a sample PDF to a shared hoster to take a look?
BR
Maruan
Am Freitag, dem 07.05.2021 um 11:02 +0200 schrieb Ranjeet Kuruvilla:
> I am converting a byte[] to PDDocument and had a shocking experience:
> There were field values (not the fields themselves) missing. I
> compared
> PDFBox 2.0.23 to IText.
>
> Acroform acroform = PDDocument.load(source, password);
>
> HashMap<String, AcroFields.Item> fields2 = (new PDFReader(source,
> password)).getAcroFields().getFields(); // Fields from IText
>
> for(PDField field: acroform.getFields()) // Fields from PDFBox
>
> {
>
> System.out.println("Field " + field.getFullyQualifiedName() + "
> IText [" + acroform.getField(field.getFullyQualifiedName()) + "]
> PDFBox
> [" + field.getValueAsString() + "]");
>
> }
>
> The result was occassionally akin to
>
> Field KEY IText [Value] PDFBox []
>
> I expected it to be
>
> Field KEY IText [Value] PDFBox [Value]
>
> . It might be, that that particular PDF has Fields with the same key,
> because I did not experience that problem with other PDFs.
>
> May I ask whether there is a known bug with PDFBox 2.0.23, that
> allows
> for such a behaviour? How come, that PDFs created in C++ are no
> longer
> readable in PDFBox? How can I fix the bug? I do not wish to use IText
> to
> solve it.
>
>
>
--
--
Maruan Sahyoun
FileAffairs GmbH
Josef-Schappe-Straße 21
40882 Ratingen
Tel: +49 (2102) 89497 88
Fax: +49 (2102) 89497 91
sahyoun@fileaffairs.de
www.fileaffairs.de
Geschäftsführer: Maruan Sahyoun
Handelsregister: AG Düsseldorf, HRB 53837
UST.-ID: DE248275827
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org