Merge and Split PDFs Without Third-Party Tools Using Power Automate Desktop
Automate PDF merging and splitting directly on your machine, removing the need for online services or expensive software.
Every professional has encountered the need to merge several PDFs into one, or to extract a few pages from a large report. Free online services are convenient, but they often require uploading sensitive documents to unknown servers, and the file size limits can be frustrating. Paid desktop software like Adobe Acrobat works, but the license cost is hard to justify for occasional use. With Power Automate Desktop (PAD) you can build straightforward flows that merge or split PDF files locally, giving you full control and keeping your data safe.
In this article we will build two sets of desktop flows: one for merging multiple PDFs into a single file, and another for splitting a PDF into separate documents. We will also cover a useful variation that splits a PDF every n pages. Along the way I’ll share practical tips, common pitfalls, and performance considerations.
Example scenario
Your team processes monthly expense reports. Each employee submits a separate PDF containing receipts and a signed approval form. At the end of the month you need to combine all employee PDFs into one consolidated file for the finance department. At other times, a vendor sends a huge catalog (100+ pages) and you only need a handful of sections — splitting the catalog into smaller files makes it easier to distribute.
For the purpose of this guide we will work with a folder called ExpeditionDocuments that contains several PDFs. Inside that folder we create a subfolder CombinedOutput where the merged result will be saved. For splitting, we will place the source PDF in the same folder and send the extracted pages to a subfolder SplitOutput.
Merging PDFs: combining documents
Merging is the simpler operation. You gather all the PDFs you want to combine and feed them into a dedicated PAD action. Below are two approaches: merging all PDFs from a folder, and merging only the files you manually select.
Merge all PDFs from a folder
Create a new desktop flow and add the following actions in order:
- Display select folder dialog – Prompt the user to pick the folder that contains the PDFs. Set the title to “Select folder with PDFs to merge”.
- Get files in folder – Point this action to the folder obtained in step 1. Sort the files by Full name so they are merged in the order they appear in the file system (alphabetical).
- Merge PDF files – The action’s input is the collection
%Files%produced in step 2. Specify an output path inside yourCombinedOutputfolder and name the merged file, for exampleConsolidatedReport.pdf.
Display select folder dialog → folder path → %SelectedFolder% Get files in folder → %Files% (sort by Full name) Merge PDF files → %Files% → output: CombinedOutput\ConsolidatedReport.pdf
When you run the flow, a browse dialog appears. After you pick the folder, all PDFs inside it are merged into one file. If the folder contains non-PDF files, they are ignored.
Merge only selected PDFs
Sometimes you don’t want every file in the folder. For that case you can let the user handpick the PDFs. The flow differs only in the first two actions:
- Display select file dialog – Set the title to “Select PDFs to merge” and enable Allow multiple selection. Keep the file filter as
*.pdf. - Reverse list – The select-file action returns the chosen files in reverse order of selection. To fix this, pass
%SelectedFiles%through a Reverse list action. The reversed list is stored in a new variable (e.g.,%ReversedFiles%). - Merge PDF files – Use the reversed list as input.
Display select file dialog → %SelectedFiles% Reverse list → %SelectedFiles% → %ReversedFiles% Merge PDF files → %ReversedFiles% → output: CombinedOutput\ConsolidatedReport.pdf
The reverse step is essential because the selection dialog delivers files in the opposite order you clicked them. Without reversing, the merged PDF would have pages in the wrong sequence.
Run the flow, select the PDFs in the correct order (click the first file you want at the top, then the second, etc.), and the merged result will respect that order.
Splitting a PDF: extracting pages
Splitting is a bit more involved because PAD does not have a built‑in action to count the number of pages in a PDF. To work around this we use a loop with error handling: we attempt to extract a page, and when the extraction fails (because the page number is out of bounds) we break out of the loop.
Split after every page
This creates one new PDF file for each page of the source document.
- Display select file dialog – Let the user choose the PDF to split.
- Set variable – Create a numeric variable named
%PageIndex%and initialise it to1. - Loop condition – Use a condition loop that always evaluates to
True(both operands set toTrue). This creates an infinite loop; we will exit it when an error occurs. - Extract PDF file pages to new PDF file – Use
%PageIndex%as the page number to extract (use the setting “Page selection” with the value%PageIndex%). Specify an output path likeSplitOutput\\Page_%PageIndex%.pdf. - Increase variable – After extraction, increase
%PageIndex%by1. - Label – Add a label named
SplitCompleteat the very end of the flow. - Configure error handling – Go to the OnError tab of the Extract PDF file pages action. Choose the Page out of bounds error type. Add a new rule: continue the flow run when this error occurs, and when it does, jump to the label
SplitComplete.
Display select file dialog → %FileToSplit% Set variable → %PageIndex% = 1 Loop condition → True Extract PDF file pages → source: %FileToSplit%, page selection: %PageIndex%, output: SplitOutput\Page_%PageIndex%.pdf Increase %PageIndex% by 1 Label: SplitComplete
Without the error handler the loop would crash on the first page that does not exist. The “Page out of bounds” rule gracefully ends the loop after the last page.
Run the flow, select a PDF, and you’ll find the individual pages in the SplitOutput folder.
Split after every n pages
If you need to group pages (e.g., every 3 pages), the flow changes slightly. We introduce a variable that holds the group size and build a page range string like 1-3, 4-6, 7-9.
- Replace the simple
%PageIndex%variable with a Set variable action that defines%EveryNPages% = 3. - Inside the loop, before extracting, add a Create new list action to generate an empty list named
%PageRange%. - Add two Add item to list actions:
- Add
%PageIndex%to the list. - Add
%PageIndex% + %EveryNPages% - 1to the list.
- Add
- Use a Join text action to convert the list into a string with a hyphen: delimiter =
-. Store the result as%PageRangeText%. - In the Extract PDF file pages action, change the page selection to
%PageRangeText%instead of a single number. - Adjust the Increase variable action to increment by
%EveryNPages%instead of1. - After extraction, add a Clear list action to empty
%PageRange%for the next iteration.
Set %EveryNPages% = 3 Inside loop: Create new list → %PageRange% Add item to list → %PageIndex% Add item to list → %PageIndex% + %EveryNPages% - 1 Join text → list: %PageRange%, delimiter: "-" → %PageRangeText% Extract PDF file pages → page selection: %PageRangeText% Increase %PageIndex% by %EveryNPages% Clear list → %PageRange%
The Join text action produces a string like 1-3 from a two‑item list. This is exactly what the Extract PDF file pages action expects for a range of pages.
Run the flow; you will get PDF files containing groups of n pages (the last group may be smaller if the document length is not a multiple of n).
Security, performance, and reliability
- Local processing – All actions happen on your machine. No data is uploaded to a cloud service, making this suitable for confidential documents.
- Performance – Merging a handful of PDFs is near instantaneous. Splitting a large file (hundreds of pages) can take a few seconds per page. For extreme volumes, consider batch processing or using a more dedicated tool.
- Preserving fidelity – The extracted pages are identical to the originals; the action copies the PDF objects without re‑compression.
- Error handling – The split flows rely on a single error type to detect the end of the document. If an unexpected error occurs (e.g., corrupted PDF), the loop may break prematurely. You can add a second error rule to log such failures.
Common mistakes and troubleshooting
- Output folder does not exist – The Extract PDF file pages action will fail if the target folder is missing. Always create the output folder before running the flow (manually or with a Create folder action).
- Wrong file order in merge – If the merged result has pages in an unexpected order, verify you sorted by Full name or used the Reverse list workaround.
- Page numbering starts at 1 – PAD’s page selection is 1‑based. Do not use 0 as the initial page index.
- Infinite loop when splitting – If the error handling is not set up correctly, the loop may run forever. Double‑check that you selected “Continue flow run” and specified the correct label.
- Non‑PDF files picked up by folder scan – The Get files in folder action returns all files, not just PDFs. Although Merge PDF files ignores non‑PDFs, it is cleaner to use a Filter list action before merging if your folder contains other file types.
Final recommendation
Power Automate Desktop is a capable, free tool for basic PDF manipulation. The flows described here handle the most common merge and split tasks without exposing your documents to the internet. While they lack the polish of dedicated PDF editors (no page reordering, no visual preview), they are perfectly sufficient for routine office work.
If you need to extend these flows — for instance, merging only PDFs whose names contain “approved” or splitting by a custom page list — you can easily adapt the core logic using PAD’s wealth of actions.
References
- Matthew Devaney, “Merge & Split PDF Files With Power Automate Desktop” (the original inspiration for this article): https://www.matthewdevaney.com/merge-split-pdf-files-with-power-automate-desktop/
- Microsoft documentation for Power Automate Desktop: https://learn.microsoft.com/en-us/power-automate/desktop-flows/
- PDF file actions reference: https://learn.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/pdf (placeholders – check official doc for latest actions)