I build a PDF document from a LaTeX source file as part of static Dwebsite generation, but every run of pdflatex outputs a file that hashes to a different IFPS Content ID. This triggers spurious regeneration of the root CID. Can pdflatex generate a PDF that is binary-equivalent to previous runs (assuming an unchanged input file) so the PDF output hashes to the same CID?

The pdflatex manpage doesn't list any options that appear relevant. Per http://theoval.cmp.uea.ac.uk/~nlct/latex/pdfdoc/pdfdoc/pdfdoc.html, I have added something like this to the top of the LaTeX file:

   /Producer (pdfTeX)
   /Author ()
   /Title  ()
   /CreationDate (D:20040502195600)
   /ModDate (D:20040502195600)
   /PTEX.Fullbanner (Generated with pdfTeX)

Comparing the files in hexdiff shows deltas in an /ID property that looks like a GUID. This property doesn't appear to be modifiable by the \pdfinfo block. Is there any way to hardcode or disable the generation of this property?

1 Answer 1


You can set reproducible behaviour by setting the environment variables SOURCE_DATE_EPOCH and FORCE_SOURCE_DATE see texdoc pdftex section 4.

SOURCE_DATE_EPOCH should be the number of seconds since 1970 that you want to fix the date for, and FORCE_SOURCE_DATE should be 1

You can also control these fields from within the tex document eg \pdftrailerid controls the id at the end and \pdfsuppressptexinfo=-1 would suppress the printing of the info information.

  • I wasn't able to get \pdfsuppressptexinfo=-1 working, but a combination of \pdftrailerid{} and the \pdfinfo block I mentioned in my question seems to have done the trick. Thanks!
    – cqcallaw
    Oct 25, 2020 at 0:06
  • When validating my solution, I got tripped up thinking \pdfsuppressptexinfo=-1 was working, but it turned out to be a clock resolution issue. I was generating both PDFs with a chain of shell commands, and the mod/creation date format didn't have sufficient resolution to measure the delta. The solution: insert a sleep between invocations of pdflatex to make sure the difference in mod times is observable.
    – cqcallaw
    Oct 25, 2020 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.