[NTG-pdftex] Deterministic PDFs (switch to disable addition of timestamps and random ID nonces)

Markus Kuhn Markus.Kuhn at cl.cam.ac.uk
Fri Jun 19 12:03:18 CEST 2015

For some applications, especially where the output of pdftex
lives in any kind of version-control system, it would be extremely
helpful to have a switch that causes pdftex to output deterministic
PDF files.

At present, there are three fields in each PDF generated by
pdfTeX that change at each run on identical source files:

$ pdftex '\hbox{}\vfill\eject\end'
Output written on texput.pdf (1 page, 8182 bytes).
$ mv texput.pdf texput2.pdf
$ pdftex '\hbox{}\vfill\eject\end'
Output written on texput.pdf (1 page, 8182 bytes).
$ diff -a texput.pdf texput2.pdf
< /CreationDate (D:20150619105331+01'00')
< /ModDate (D:20150619105331+01'00')
> /CreationDate (D:20150619105323+01'00')
> /ModDate (D:20150619105323+01'00')
< /ID [<BA26D54E6C14BF8195356C4A7162A40A> <BA26D54E6C14BF8195356C4A7162A40A>]
> /ID [<D5B098C606C27E75987095F36CDCFED7> <D5B098C606C27E75987095F36CDCFED7>]

Looking at the PDF 1.7 specification in ISO 32000 at


I believe that all these non-deterministic elements are
optional, and could be suppressed without violating
the PDF specification:

Table 317 on page 550 says that the CreatingDate entry
of the document information directory is optional, and the
ModDate entry is optional unless PieceInfo is present.
Pdftex does not output PieceInfo, right? So ModDate is also
optional here.

Likewise, the ID element appears to be optional as long as
the PDF document is not encrypted.

For DVI mode, we have already "-output-comment ''" to suppress
the addition of a timestamp.

Feature request:

Would it be possible to add a switch, for example a command-line option
like "-deterministic-output" that suppresses the automatic
addition of timestamps and random ID byte strings to the
generated PDF, such that repeated runs of pdftex produce
identical output?



Markus Kuhn, Computer Laboratory, University of Cambridge
http://www.cl.cam.ac.uk/~mgk25/ || CB3 0FD, Great Britain

More information about the ntg-pdftex mailing list