4

When I run pdflatex on the same .tex file twice, it produces similar results to my eyes but the contents of the file are slightly different (as revealed with an md5 checksum). Is there any flag I can pass to pdflatex that will keep the output consistent?

What environment sensitive metadata might be in my pdf? How can I control it?

Update: Doing a diff -a, I find the following:

> /CreationDate (D:20100413035938Z)
< /ModDate (D:20100413035938Z)
---
> /CreationDate (D:20100413041320Z)
> /ModDate (D:20100413041320Z)
106c106
< /ID [<41D2805AE64117914EDF6E09554EABAE> <41D2805AE64117914EDF6E09554EABAE>] >>
---
> /ID [<071832DAA2E77E13D96460479D9C6664> <071832DAA2E77E13D96460479D9C6664>] >>

2 Answers 2

2

You can change the contents of the PDF's Info dictionary using Pdftex's \pdfinfo primitive:

\def\fixedpdfdate{D:20100413000000+00’00’}
\pdfinfo{
    /CreationDate (\fixedpdfdate)
     /ModDate (\fixedpdfdate) }

Put this right at the beginning of the document: there's some risk that the dictionary gets written out in several chunks.

Postscript Thanks to a duplicate of the question being asked at tex.stackexchange.com, I learnt that the /ID value passed at the end of the PDF to startxref still changes from invocation to invocation of Pdftex. You can clobber the contents of /ID, apparently without ill effects: edit the text of the PDF between the /ID identifier to startxref from something like:

/ID [<B74AEC0FBDE0F25D7D2F5099291FEC6F> <B74AEC0FBDE0F25D7D2F5099291FEC6F>] >>
startxref
to: /ID [<0> <0>] >> startxref

I doubt that it is possible to ensure that /ID is unchanging from within Pdftex, but maybe it can be done in Luatex.

0
1

Take a look at the -I option of diff:

   -I PATTERN  --ignore-matching-lines=PATTERN
          Ignore changes whose lines all match PATTERN.
2
  • Thanks. This is exactly what I wanted except that I can't control /ID. If I add it to pdftex, ID gets printed twice -- once how I have it, and wants how pdflatex wants it. Apr 14, 2010 at 14:33
  • In theory you don't have to control the ID because you can ignore patterns (i.e. -I"\ID .*"). The -I option is not well documented so I am not able to tell you more.
    – mrucci
    Apr 15, 2010 at 12:38

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.