Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Properties of a PDF (MetaData)

20190829 A pdf document can have metadata associated with it, often noting the author, creator (software used to create it), and various dates such as the creation date. Using pdftk the metadata can be listed:

$ pdftk mydoc.pdf dump_data
InfoBegin
InfoKey: CreationDate
InfoValue: D:20200830150701+10'00'
InfoBegin
InfoKey: Author
InfoValue: Kayon Toga
InfoBegin
InfoKey: Title
InfoValue: Working With PDFs
InfoBegin
InfoKey: Creator
InfoValue: Writer
InfoBegin
InfoKey: Producer
InfoValue: LibreOffice 6.0
PdfID0: 64782gfac57f34de7228a94e257641d2
PdfID1: 64782gfac57f34de7228a94e257641d2
NumberOfPages: 2
PageMediaBegin
PageMediaNumber: 1
PageMediaRotation: 0
PageMediaRect: 0 0 595.276 841.861
PageMediaDimensions: 595.276 841.861
PageMediaBegin
PageMediaNumber: 2
PageMediaRotation: 0
PageMediaRect: 0 0 595.276 841.861
PageMediaDimensions: 595.276 841.861

This metadata can be used to replace the metadata of another pdf file using the update_info command of pdftk:

$ pdftk mydoc.pdf dump_data > mydoc.info
$ pdftk newdoc.pdf update_info mydoc.info output updated.pdf
The updated.pdf file will now have the same metadata as mydoc.pdf. The relevance of the metadata to the updated file is a separate issue.

Another useful tool that will allow adding relevant metadata to a pdf file is exiftool.

$ exiftool -Title="My Doc Title" \
           -Author="Kayon Toga" \
           -Subject="My Doc Subject" \
           -Keywords="data science;open source;linux" \
           -Creator="Handmade PDF Tech" \
           -Producer="Togaware Productions" \
  mydoc.pdf

The tags that can be modified within a pdf document are listed in exiftool's documentation.


Copyright © 1995-2020 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.