Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct datetime format in XMP Metadata for CreateDate/ModifyDate #166

Closed
flensrocker opened this issue Sep 4, 2024 · 1 comment
Closed

Comments

@flensrocker
Copy link

I'm looking into getting PDFsharp generate PDF/A compliant documents (my goal is PDF/A-3, but since PDF/A-1A is already included I start there).

I ran PdfATests.Simple_PDF_A_document and uploaded the file here: https://www.pdfforge.org/online/en/validate-pdfa

Result:

ISO 19005-1:2005, 6.7.3
If a document information dictionary does appear at a document, then all of its entries that have analogous properties in predefined XMP schemas, shall also be embedded in the file in XMP form with equivalent values.

Running the document through one of the many online converter tools and looking at the differences, one outstanding difference is the format of the CreateDate and ModifyDate entries in the XMP metadata.

Wrong:

<xmp:CreateDate>2024-09-04T10:34:16.0000000</xmp:CreateDate>

Right:

<xmp:CreateDate>2024-09-04T10:34:16+02:00</xmp:CreateDate>

So instead of using the format string "o" the following should be used: "yyyy-MM-ddTHH:mm:ssK"

But this doesn't work, if the provided DateTime object doesn't specify a DateTimeKind. So setting DateTimeKind.Local if DateTimeKind.Unspecified resolves this problem (it doesn't really matter if it's Local or Utc, because none knows the original kind - but when creating the document from scratch with the test it matches local time).

I will provide a PR with this minimal changes, after that the validator doesn't complain anymore.

@ThomasHoevel
Copy link
Member

Issue should be resolved with PDFsharp 6.2.0 Preview 2.

Thanks for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants