Menu

#151 Exported PDF is non-reproducible

fig2dev
closed
nobody
None
2023-08-25
2023-03-11
No

fig2dev itself honors SOURCE_DATE_EPOCH for generating reproducible output (e.g. for PS and SVG), but unfortunately this does not work when the PS/EPS file is converted to PDF by ghostscript.

ghostscript does not honor CreationDate/ModDate from the preamble, but uses the current time to set both dates/times in the PDF DocInfo and XMP metadata.

Fortunately, this can be overridden using the pdfmark operator and setting the DocInfo explicitly to the same date/time as used in the PostScript preamble.

Discussion

  • Stefan Brüns

    Stefan Brüns - 2023-03-11

    The attached patch forces ghostscript to use the same Creation/ModDate as used in the PostScript preamble.

    The PDF file is still not fully deterministic as ghostscript uses the current time in some other places, but suffices to create a file which can be included in a TeX file without making the final output unreproducible. Notably the PDF trailer ID and DocumentUUID are not part of the final PDF produced by e.g. pdflatex.

     
  • tkl

    tkl - 2023-03-12
    • status: open --> pending
    • xfig / fig2dev: xfig --> fig2dev
     
  • tkl

    tkl - 2023-03-12

    Applied with commit [fc429e]. Thank you for the contribution. In the commit afterwards creationdate.c was modified a little bit, since now I keep more strictly to the kernel coding style since creationdate.c was first written.

     

    Related

    Commit: [fc429e]

  • tkl

    tkl - 2023-08-25
    • status: pending --> closed
     

Log in to post a comment.