[ 
https://issues.apache.org/jira/browse/FOP-3367?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Juan Manuel Méndez Rey updated FOP-3367:
----------------------------------------
    Description: 
[PATCH]

The date set with FOUserAgent.setCreationDate() is only used for /CreationDate 
and xmp:CreateDate. xmp:MetadataDate, the page piece LastModified, embedded 
file dates and the file ID still use the current time, so the same input never 
gives the same PDF.

The patch:
* uses the creation date, when set, for those other dates
* adds a PDF renderer option, file-id-from-creation-date (default false), to 
use it for the file ID too. By default the ID keeps the current time.
* adds -creationdate to the command line, which sets the date and turns that 
option on

Nothing changes when no creation date is set. With -creationdate and a fixed 
time zone, two fop runs give the same PDF, which is what reproducible builds 
need.

PR: https://github.com/apache/xmlgraphics-fop/pull/134
Related: FOP-2854, FOP-3040

  was:
[PATCH]

When a creation date is set with FOUserAgent.setCreationDate(), FOP uses it for 
/CreationDate and xmp:CreateDate, but xmp:MetadataDate and the date hashed into 
the trailer /ID still come from the clock. So two runs with the same input and 
the same creation date give different PDFs.

In FOP-2854 the advice was to set the dates through the FOP API. This patch 
makes the API date apply everywhere. It adds no environment variable or new 
option.
 * IFRenderer and PDFRenderingUtil: MetadataDate is the creation date when one 
is set, the current time otherwise.
 * FileIDGenerator: hashes the document creation date instead of the current 
time.
 * New test PDFCreationDateTestCase: renders the same FO twice with a fixed 
creation date. Both cases fail on main (1301bcf) and pass with the patch.

When no creation date is set, nothing changes. The full fop-core suite passes 
(3731 tests) and checkstyle reports no violations.

Pull request: 
[https://github.com/apache/xmlgraphics-fop/pull/134|https://github.com/apache/xmlgraphics-fop/pull/132]

Related: FOP-2854, FOP-3040, 
[https://github.com/apache/xmlgraphics-fop/pull/65] and 
[https://github.com/apache/xmlgraphics-fop/pull/87] (its first two commits, by 
t-8ch, cover the same two places).


> Not all PDF dates use the creation date set on FOUserAgent
> ----------------------------------------------------------
>
>                 Key: FOP-3367
>                 URL: https://issues.apache.org/jira/browse/FOP-3367
>             Project: FOP
>          Issue Type: Bug
>          Components: renderer/pdf
>    Affects Versions: 2.12
>            Reporter: Juan Manuel Méndez Rey
>            Priority: Major
>         Attachments: FOP-3367.patch
>
>
> [PATCH]
> The date set with FOUserAgent.setCreationDate() is only used for 
> /CreationDate and xmp:CreateDate. xmp:MetadataDate, the page piece 
> LastModified, embedded file dates and the file ID still use the current time, 
> so the same input never gives the same PDF.
> The patch:
> * uses the creation date, when set, for those other dates
> * adds a PDF renderer option, file-id-from-creation-date (default false), to 
> use it for the file ID too. By default the ID keeps the current time.
> * adds -creationdate to the command line, which sets the date and turns that 
> option on
> Nothing changes when no creation date is set. With -creationdate and a fixed 
> time zone, two fop runs give the same PDF, which is what reproducible builds 
> need.
> PR: https://github.com/apache/xmlgraphics-fop/pull/134
> Related: FOP-2854, FOP-3040



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
  • [jira] [Updated] (FOP-3367) Not... Juan Manuel Méndez Rey (Jira) via fop-dev

Reply via email to