1

I am trying to have fully reproducible builds of PDF documents with TeX, i.e. building the document is to generate the exact same PDF file each time.

This is my input:

\documentclass[a4paper]{article}

\begin{document} Hello, World!

\directlua{ pdf.setinfo (table.concat({ "/Creator (TeX)", "/CreationDate ()", "/ModDate ()", }, " ")) } \end{document}

I use pdf.setinfo to remove all dates in the PDF's info since they are not reproducible and would introduce differences. A simple test setup is now to have this document in two directories, tmp and tmp2, build each and then compare:

$ diff -a tmp/test.pdf tmp2/test.pdf
46c46
< << /Type /XRef /Index [ 0 16 ] /Size 16 /W [ 1 2 1 ] /Root 13 0 R /Info 14 0 R /ID [ <EF9FA73153F46159221BD732A4AD2EAC> <EF9FA73153F46159221BD732A4AD2EAC> ] /Filter /FlateDecode /Length 60 >>
---
> << /Type /XRef /Index [ 0 16 ] /Size 16 /W [ 1 2 1 ] /Root 13 0 R /Info 14 0 R /ID [ <6B938059DF29ED0C100BAD9A76677994> <6B938059DF29ED0C100BAD9A76677994> ] /Filter /FlateDecode /Length 60 >>

As you can see, there are two seemingly random IDs in the PDFs XRef table that differ between the files. How can I instruct LuaTeX not to emit those IDs (or set them to a fixed value) so that the files will be equal?

flyx
  • 2,051

0 Answers0