How to Set PDF Metadata in Power Automate
Any time we create a PDF, key information about the document is automatically recorded in its metadata, including details like the document title, author, creator, and creation date. Document keywords can also be listed in the metadata object, which help improve document searchability and organization.
By setting a PDF’s metadata with custom values, we gain a level of control over who people see as the creator, what the title of the document is, and how easy to find the document will be in a database of other PDF files.
In some cases, setting PDF metadata amounts to a “nice to have” quality-of-life improvement for folks accessing myriad PDFs from a single search bar, and in other cases, setting metadata is a legal/compliance necessity, ensuring industry standards are met for the organization and management of documents — particularly in fields like law, healthcare, and finance.
Set PDF Metadata in Power Automate
In Power Automate, we can set metadata for our PDF documents programmatically without writing a line of code.
In this quick walkthrough, we’ll learn how to set a PDF document’s metadata and update the original file with that information in a Power Automate flow. We’ll build an instant cloud flow in this context so we can have full control over our data when we run our test.
To begin, we’ll add a Get file metadata action to retrieve some important information (including the File ID and File Name) about our example PDF as it appears in our file system. This will make it easier to dynamically retrieve our file bytes and, eventually, update our file with a new PDF metadata object.
Next, we’ll add a Get file content action that retrieves our PDF file bytes using the File ID (Id).
Now that we’ve retrieved our file bytes, we’ll add the PDF metadata action into our flow. To find it, we’ll search for Cloudmersive connectors and locate the Cloudmersive PDF connector from the list of options below.
We’ll next click “See more” to view the actions list, and from there, we’ll look for an action titled Sets PDF document metadata.
After we select this action — and before we can begin configuring our request parameters — we’ll need to create our connection. To use this connector, we’ll need a premium Power Automate license and a free Cloudmersive API key. Free API keys allow a limit of up to 800 API calls per month with zero additional commitments.
After we’ve created our connection, we’ll click “Show all” to view the request parameters, and we’ll add our PDF file bytes in the Request/InputFileBytes parameter.
Below this, we’ll find a list of PDF metadata values we can customize in our request. We can specify the document Author, Creator, Subject, and Title, and we can enter keywords that accurately represent our document’s contents. We can even go as far as to specify the exact date our document was created and modified if we want.
In this example flow, we’ll need to fill out most of this content manually or with data from our instant flow run. In the context of an automated flow, we could fill these fields with dynamic content from a wide range of other sources.
Once we’ve set our new PDF metadata values, we’ll incorporate our Update file action and apply our changes to the original PDF.
Now we’ll save and test our flow.
Once our flow finishes running, we’ll open our updated PDF document and review its metadata. To view our PDF metadata with the file opened in our browser, we’ll select Settings > View document properties.
For reference, my example PDF (which was a MS Word document exported to PDF) had the following metadata originally:
In one quick flow, we’ve improved the organization and searchability of our document by applying custom metadata values.