You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Martin Hilpert (JIRA)" <ji...@apache.org> on 2010/09/08 17:54:33 UTC
[jira] Updated: (PDFBOX-823) NullPointerException in
DateConverter.toISO8601(DateConverter.java:221)
[ https://issues.apache.org/jira/browse/PDFBOX-823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Hilpert updated PDFBOX-823:
----------------------------------
Summary: NullPointerException in DateConverter.toISO8601(DateConverter.java:221) (was: DocumentInformation is not visible (with Acrobat Reader))
Affects Version/s: 1.2.1
(was: 1.3.0)
Description:
I tried to add metadata as shown in AddMetadataFromDocInfo.java. There's also the line
basicSchema.setModifyDate( info.getModificationDate() );
but I get a NullPointerException at this line:
java.lang.NullPointerException
at org.apache.jempbox.impl.DateConverter.toISO8601(DateConverter.java:221)
at org.apache.jempbox.xmp.XMPSchema.setDateProperty(XMPSchema.java:249)
at org.apache.jempbox.xmp.XMPSchemaBasic.setModifyDate(XMPSchemaBasic.java:266)
because the info.getModificationDate() returns null. It would be better to catch null parameters in the metadata set methods.
Workaround:
if (pddi.getModificationDate() != null) {
basicSchema.setModifyDate(pddi.getModificationDate());
}//else: avoid NPE
was:
I try to set PDF document inforamtion (http://pdfbox.apache.org/userguide/metadata.html), but the final PDF doesn't have my information set! E.g.
final PDDocumentInformation pddi = doc.getDocumentInformation();
pddi.setAuthor("MeAndMyself");
I debugged and ensured that after creation of PDF with APache FOP, this is the last action on the PDF done. But when viewing with Acrobat Reader, only the information that I set during FOP rendering is shown.
But then I noticed that when I view the PDF file with FoxIt Reader (4.0), File > Properties show all the properties I set like Title, Author, Producer. Viewing this exact same PDF file with Acrobat Reader (9.3.4), this properties are not shown (and some other properties are shown I set during the first FOP PDF Rendering to produce the PDF).
I wonder if there are multiple ways to store such information in a PDF? Why is showing FoxItReader the properties I set afterwards with PDFBox, but Adobe Reader ignores those Properties and show the properties set on the first PDF generation?
Component/s: JempBox
(was: PDModel)
Found XMP Metadata example.
> NullPointerException in DateConverter.toISO8601(DateConverter.java:221)
> -----------------------------------------------------------------------
>
> Key: PDFBOX-823
> URL: https://issues.apache.org/jira/browse/PDFBOX-823
> Project: PDFBox
> Issue Type: Bug
> Components: JempBox
> Affects Versions: 1.2.1
> Environment: JDK 1.6.0_21, Windows XP 32 Bit
> Reporter: Martin Hilpert
>
> I tried to add metadata as shown in AddMetadataFromDocInfo.java. There's also the line
> basicSchema.setModifyDate( info.getModificationDate() );
> but I get a NullPointerException at this line:
> java.lang.NullPointerException
> at org.apache.jempbox.impl.DateConverter.toISO8601(DateConverter.java:221)
> at org.apache.jempbox.xmp.XMPSchema.setDateProperty(XMPSchema.java:249)
> at org.apache.jempbox.xmp.XMPSchemaBasic.setModifyDate(XMPSchemaBasic.java:266)
> because the info.getModificationDate() returns null. It would be better to catch null parameters in the metadata set methods.
> Workaround:
> if (pddi.getModificationDate() != null) {
> basicSchema.setModifyDate(pddi.getModificationDate());
> }//else: avoid NPE
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.