How to Split PDF Pages into Separate Documents in Power Automate
Processing PDF documents isn’t always a linear exercise. If we’re involved in creating programmatic workflows around PDF file processing, it’s possible we’ll find ourselves in scenarios where different stakeholders need to receive different pages from a single PDF document at the end of our workflow.
As long as we know exactly what content to expect on any given page of a PDF, we can easily automate the process of splitting those files into new documents, and we can just as easily share relevant pages with stakeholders.
In fact, we can handle this entire workflow in Power Automate — which means we don’t need to write any code whatsoever. We can simply use the Cloudmersive Document Conversion connector to generate one new PDF document per page of our original multi-page PDF, and we can then store our new files with new name designations containing the original page numbers. This makes it easy to build subsequent flows that share content from specific pages with specific stakeholders.
We’ll now walk through a quick example flow that splits a single multi-page PDF into one new document per page. We’ll build a manually triggered, instant cloud flow in this test case so we can have full control over our data.
We’ll first use a Get file content action to retrieve a multi-page PDF document from our file system. My example file is a four-page PDF (containing Lorem Ipsum text content) that lives in OneDrive, so I’ll be using the OneDrive for Business connector version of the Get file content action.
In our next step, we’ll open a new action and type “Cloudmersive” in the connector search bar. This brings up a list of Cloudmersive connectors; we’re looking for the Cloudmersive Document Conversion connector on this list.
We’ll click “See more” to view the actions list, and from here, we’ll CTRL+F search for an action called Split a PDF file into separate PDF files, one per page.
After we select this action, it’s time to create our connection.
We’ll notice the “premium” tag next to all these connector actions — and that means we’ll need a premium Power Automate license to access them. We can, however, use these connector actions for free with a free Cloudmersive API key, which allows a limit of 800 API calls per month and zero additional commitments. That’s the same API key I’m using in my demonstration.
To configure our request, we’ll add our PDF file bytes and file name (this can be any name we want) to each of our two primary request parameters.
We’ll next click “Show all” to view the advanced parameters. Here, we’ll want to set the dropdown to “Yes”. This returns file bytes for each new PDF document to our flow directly.
This action returns an array of PDF file bytes which we can use to create new PDF documents. Each set of file bytes is returned relative to its original page number, and we can use that information to name our new PDF documents appropriately.
We’ll use a Create file action to generate the new PDF documents in our system, and we’ll use the PageNumber value in our document names. We’ll notice that Power Automate wraps our Create file action in a For each control to ensure it cycles through each set of values in our response array.
When we save and test this flow, we’ll find one new document per page of our original PDF populated in the folder we selected.
My example flow created what we see in the below screenshot.
We can now share specific pages of our original PDF document with relevant stakeholders in our flows without needing to share the entire document.