PDF meta-data can be about either the main document or included PDFs.
Main PDF
We can remove the main PDF meta-data from the Document Catalog. If you are not using the hyperref
package you can use the following tex code (credit to NVaughan/Werner):
\pdfinfo{ /Creator () /Producer () /ModDate () /CreationDate () }
(You can also zero-out Title
,Author
, Subject
, and Keywords
but these aren't usually set, at least by MiKTeX.) If you are using the hyperref
package then it will write some of these fields again. It will write Creator
and Producer
with values, Subject
and Keywords
that are usually blank, and Author
and Title
which it may autopopulate. So you will have to at least do either
\hypersetup{pdfinfo={ Creator={}, Producer={}, ModDate={...}, CreationDate={...} }}
or
\pdfinfo{ /ModDate () /CreationDate () }
\hypersetup{pdfinfo={ Creator={}, Producer={} }}
If you are using pdfTeX
version 1.40.17 or greater (included in MiKTeX already), then the following will remove the trailer ID (often a hash of content and timestamp) and the PTEX.Fullbanner
\pdftrailerid{} %Remove ID
\pdfsuppressptexinfo15 %Suppress PTEX.Fullbanner and info of imported PDFs
For earlier versions of pdfTeX
you will have to post-process to get rid of these field (see perl example below).
Included PDFs
For removing meta-data from included PDFs, the line above works for pdfTeX
1.40.17
\pdfsuppressptexinfo15 %Suppress PTEX.Fullbanner and info of imported PDFs
(See the full bit mask options for pdfsuppressptexinfo
.) Otherwise, you can post-process the PDF to at least remove the file-names using:
perl -pe 's|(/PTEX.FileName \()([^\)]+)|$1 . " " x length($2)|ge' orig.pdf > orig.anon.pdf
This post-processing will not remove the PTEX.PageNumber
(likely harmless) or PTEX.InfoDict
(which you may want to ensure doesn't contain anything sensitive).
LuaTeX
PDFs made from LuaTeX can also be made reproducible, by adding options
\pdfvariable suppressoptionalinfo 767
Some packages seem to rewrite some of the suppressed fields (e.g. hyperref
or doi
), in which case the document can be made reproducible with the additional line (which will include blank entries)
\hypersetup{pdfinfo={ Creator={}, Producer={} }}
Edited 2016-05-25 to include options for newer versions of pdfTeX
.
Edited 2017-08-31 to include options for newer versions of LuaTeX
.
pdftex
.grep
for known directory names etc.pdftk
to strip metadata from PDF files.