PDF Get Metadata
PDF Get Metadata
Section titled “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.
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the PDF file. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns a Dictionary<string,object> with these keys, always present:
| Key | Type | What it is |
|---|---|---|
Title | string or null | Document title. |
Author | string or null | Author. |
Subject | string or null | Subject. |
Creator | string or null | Application that created the original (e.g. a word processor). |
Producer | string or null | Application that produced the PDF. |
Keywords | string or null | Keywords, as stored in the document. |
CreationDate | string or null | Creation date in PDF date format, unconverted: D:YYYYMMDDHHmmSS with an optional time zone, e.g. D:20260115093000-05'00'. |
ModDate | string or null | Date of the last modification, in the same format. |
PageCount | int | Number 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).
Common errors
Section titled “Common errors”| Message | Cause 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 file | Password-protected, damaged or not a PDF. See Protected and damaged PDFs. |
Example
Section titled “Example”PDF Get Metadata path = filePath → output: metaLog 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"Related activities
Section titled “Related activities”- PDF Get Page Count — just the number of pages.
- PDF Get Text — the content of the document.