Skip to content

PDF Get Metadata

Type: pdf-get-metadata  ·  Package: PDF Activities v1.2.4  ·  Output: Dictionary<string,object>

Returns the metadata of a PDF: title, author, creation and modification dates, number of pages and more. Useful to classify documents, check where they come from or log information about the file.

Reads the document’s information dictionary and returns it with fixed keys. It doesn’t modify the file. Many PDFs don’t fill in every field: missing ones come back as null.

ParameterTypeDefaultDescription
pathstring—Path of the PDF file.

None.

Returns a Dictionary<string,object> with these keys, always present:

KeyTypeWhat it is
Titlestring or nullDocument title.
Authorstring or nullAuthor.
Subjectstring or nullSubject.
Creatorstring or nullApplication that created the original (e.g. a word processor).
Producerstring or nullApplication that produced the PDF.
Keywordsstring or nullKeywords, as stored in the document.
CreationDatestring or nullCreation date in PDF date format, unconverted: D:YYYYMMDDHHmmSS with an optional time zone, e.g. D:20260115093000-05'00'.
ModDatestring or nullDate of the last modification, in the same format.
PageCountintNumber of pages.

To use a date as a date, extract its parts from the text: substring(meta["CreationDate"], 2, 8) gives "20260115" (year, month and day).

MessageCause and fix
File not found.The path doesn’t exist.
'path' is required.path was left empty or its expression returned null.
PDF library error when opening the filePassword-protected, damaged or not a PDF. See Protected and damaged PDFs.
PDF Get Metadata path = filePath → output: meta
Log message = "Title: " + str(meta["Title"]) + " — " + str(meta["PageCount"]) + " pages"
If condition = meta["Producer"] == null
└─ then:
Log level = warning message = "The PDF doesn't say which application produced it"