[ https://issues.apache.org/jira/browse/PDFBOX-6062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18018174#comment-18018174 ]
Tilman Hausherr commented on PDFBOX-6062: ----------------------------------------- Do you mind if the fraction is cut at 3 digits? cal: java.util.GregorianCalendar[time=1756914227989,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2025,MONTH=8,WEEK_OF_YEAR=36,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=246,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=43,SECOND=47,MILLISECOND=989,ZONE_OFFSET=0,DST_OFFSET=0] > XMPMetadata can only be parsed if xmp:CreateDate does not contain fractions > of seconds > -------------------------------------------------------------------------------------- > > Key: PDFBOX-6062 > URL: https://issues.apache.org/jira/browse/PDFBOX-6062 > Project: PDFBox > Issue Type: Bug > Components: XmpBox > Affects Versions: 3.0.5 PDFBox > Reporter: Jochen Stärk > Priority: Critical > Attachments: invoice.gs.pdf, invoice.pdf > > > Attached PDF/A file invoice.pdf (valid according to veraPDF) raises a > > {{{}org.apache.xmpbox.xml.XmpParsingException: Failed to instantiate DateType > property with value 2025-09-03T15:43:47.989082+00:00 in > xmp:CreateDate{}}}{{{}at > org.apache.xmpbox.xml.DomXmpParser.createProperty(DomXmpParser.java:373){}}} > > > when Metadata is parsed using \{{xmpParser.parse }}(snippet below) . It has a > createDate of > 2025-09-03T15:43:47.989082+00:00. I ran the PDF file through ghostscript > (attached invoice.gs.pdf) and that file works and displays XMP code and the > PDF/A Version as instructed. Notably the creation date of the ghostscript > version is only > 2025-09-04T10:34:57+02:00, i.e. without nanoseconds. > > Snippet: > > {{try {}} > {{PDDocument document = > Loader.loadPDF(Files.readAllBytes(Paths.get("invoice.pdf")));}} > {{PDDocumentCatalog catalog = document.getDocumentCatalog();}} > {{PDMetadata metadata = catalog.getMetadata();}} > > {{if (metadata != null) {}} > {{DomXmpParser xmpParser = new DomXmpParser();}} > {{System.out.println(metadata.getCOSObject().toTextString());}} > {{XMPMetadata xmp = xmpParser.parse(metadata.createInputStream());}} > {{PDFAIdentificationSchema pdfaSchema = xmp.getPDFAIdentificationSchema();}} > {{if (pdfaSchema != null) {}} > {{System.out.println(pdfaSchema.getPart());}} > {{}}} > {{}}} > {{document.close();}} > {{} catch (XmpParsingException e) {}} > {{e.printStackTrace();}} > {{} catch (IOException e) {}} > {{e.printStackTrace();}} > {{}}} > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org