Repository navigation
Conversation
When a creation date is set with FOUserAgent.setCreationDate(), use it for xmp:MetadataDate and for the date hashed into the trailer /ID, so the same input and creation date give the same PDF. Without a creation date the current time is used, as before.
The PDF specification recommends the current time as part of the file ID digest, so only use the user agent creation date for xmp:MetadataDate.
The file ID keeps the current time by default, as ISO 32000-1 14.4 recommends. With <file-id-from-creation-date>true</file-id-from-creation-date> in the PDF renderer configuration, or the same renderer option on the user agent, the creation date set on the user agent is used instead, so the same input and creation date give the same file.
Author
|
Superseded by #134, which keeps the current time in the file ID by default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/FOP-3367
When a creation date is set with
FOUserAgent.setCreationDate(), FOP uses it for/CreationDateandxmp:CreateDate, butxmp:MetadataDateand the file ID still come from the clock, so the same input and creation date never give the same PDF.IFRendererandPDFRenderingUtil: MetadataDate is the creation date when one is set, the current time otherwise.file-id-from-creation-date, defaultfalse. When enabled,FileIDGeneratorhashes the creation date instead of the current time. Without it the file ID is computed exactly as before.PDFCreationDateTestCase: MetadataDate, two renders with the option give the same bytes, two renders without it do not. The first two fail on main (1301bcf).Enable it in the configuration file:
This completes the API route suggested in https://issues.apache.org/jira/browse/FOP-2854: with the option enabled and a creation date set, the same input gives the same PDF in the same environment (checked in two separate processes). Dates are still written in the local time zone, as before, so a different time zone gives a different file, and the fop command cannot set a creation date yet. Those would be separate changes.
A smaller alternative with only the MetadataDate part is #133. Please merge whichever you prefer.
The full fop-core suite passes (3732 tests) and checkstyle reports no violations.