In this guide you’ll learn how to split a PDF into multiple PDF files using Power Automate.
For this specific example, you will use Power Automate to automatically split a newly uploaded PDF file in OneDrive for Business into multiple files containing ten pages each, and then add the split files to SharePoint. You can also use this example for other file formats by first converting them to PDF and then splitting them into more manageable file sizes.
It’s important to note that in this example we are splitting documents in OneDrive and sending them to SharePoint but you can easily split and save them to another destination like Dropbox, Google Drive, or any platform supported by Power Automate.
The key features of the PDF splitting facility are as follows:
- Split a single PDF file into one or more individual PDF files.
- Split based on the number of pages or PDF bookmarks.
- Automatically generate numbered file names using .NET’s formatting syntax, e.g. 'split-{0:D3}.pdf' will use 3 digits for the sequential numbers starting at ‘split-001.pdf’. When splitting by bookmark than an optional {1} parameter can be inserted in the file name to include the name of the bookmark as well.
- Can be combined in combination with other actions, e.g. convert & merge.
Note: When splitting based on bookmark levels, an extra page will always be exported for each file split based on bookmark levels. This is because PDFs store bookmarks at the page level, and so it will not be clear for the converter to identify on what part of the page a heading starts or ends.
Prerequisites
Before we start building the workflow, ensure all prerequisites are in place:
- Muhimbi PDF Converter for Power Automate full, free, or trial subscription.
- Appropriate privileges to create Power Automate(Flow).
- Working knowledge of Power Automate.
Splitting PDF Files Using Power Automate
From a high level, the Flow will look like this:
Create a new Flow and use the OneDrive (Business) trigger ‘When a file is created’.
Folder: Select the OneDrive folder where the files to be converted will be uploaded.
Insert Muhimbi's ‘Split PDF’ action and fill it out as per below:
Source file name: ‘File name’ of the output of ‘When a file is created’ action.
Source file content: ‘File content’ of the output of ‘When a file is created’ action.
Split parameter: When splitting based on the number of pages, then this parameter must be set to the maximum number of pages to include in each split file. When splitting based on the bookmark level then this parameter should contain the ‘depth’ at which to split. E.g. specify ‘1’ to split into top-level chapters (Chapter 1, chapter 2, etc.) or a higher number to split at a deeper level (e.g. ‘2’ splits on Chapter 1, 1.1, 1.2, 2, 2.1 etc.)
File name template: This parameter determines the file name for the returned file. For this demo we are using ‘File name’-(fx (utcnow())).
Insert an MS SharePoint ‘Create file action’ to write the converted file to an MS SharePoint Online location. You can also use providers like Dropbox, OneDrive, and Google Drive, or send the PDF via email. In our case, we have used MS SharePoint provider. Fill the action below:
Site Address: Select the location of the MS SharePoint site where you want to store the split documents.
Folder Path: Select the folder where you want the split files to be saved.
File Name: ‘Base file name’ of the output of Muhimbi’s ‘Convert document’ action. Ensure you add the extension ‘.pdf’ to the file name.
File Content: ‘Processed file content’ of the output of Muhimbi’s ‘Convert document’ action.Publish the workflow and upload a new PDF document to the OneDrive (Business) location. After a few seconds, the Flow will trigger and the PDF file will be split and uploaded to the MS SharePoint location.