Overview
The 'PDF - Merge Files' flow merges up to 1000 documents provided in a JSON array into a single PDF document.
Please refer to the Supported Document Types articles for a complete list of the different file formats/document types which are supported for conversion.
Example Flows
Please refer to the following article showcasing the 'PDF - Merge Files' action
Video Tutorial
Please refer to the following YouTube Video we published: Merge Documents to PDF with Power Automate and Encodian
Power Automate Templates
Credit Count
The final merge credit count is determined using the following calculation:
Merge Action (1) + (No. of Documents Converted to PDF) = Total Credits Used
For example, merging 48 PDF documents;
1 + 0 = 1 credits used
For example, merging 48 non-PDF documents which are also converted to PDF before merging:
1 + 48 = 49 credits used
For example, merging 100 documents of which 9 are also converted to PDF before merging:
1 + 9 = 10 credits used
Default Parameters
The default 'PDF - Merge Files' flow action parameters are detailed below:
- PDF Filename: The filename to assign to the resulting PDF document (including the file extension).
- Documents: A JSON array containing a filename and a Base64 encoded string for each document which should be merged.
-
Advanced Parameters
The advanced 'PDF - Merge Specific Files' flow action parameters are detailed below:
- Generate Bookmarks: Generate a bookmark for each merged PDF document
- Preserve Bookmarks: Preserve bookmarks contained within each merged PDF document
- Remove Markup:Set MS Office document comments and tracked changes removal option
- PDF/A Compliant:Set PDF/A Compliance option
- PDF/A Compliance Level: Set the PDF/A Compliance Level, the default value is PDF_A_2A
- Return File: (Advanced) Sets whether the action should return a file or alternatively an operation ID: Flow Action Return Options: File Content vs. Operation ID
Documents - JSON Schema
The JSON provided within the documents parameter should conform to the following schema:
{
"fileName": "filename including extension",
"fileContent": "File content"
}
Troubleshooting
Please review the following article if you experience an issue executing the 'PDF - Merge Files' action: Errors processing Document Arrays
Creating the JSON Array
Flow provides the actions required to build the JSON array which is required by the 'Documents' parameter. The following example shows how to retrieve documents from a SharePoint folder and dynamically build the array.
1. Utilise the 'Get Files (properties only)' action to retrieve a list of target files
2. Create a new variable which will be utilised to store the files we will later merge
3. Add a 'Get file content' action to retrieve the file.
3.a Site Address: Set as per the site address from step #1
3.a. File Identifier: Select the 'Identifier' property provided by the 'Get Files (properties only)' action
4. Add an 'Append to array variable' action to add the JSON for the current document to the variable created in step #3.
4.a. Add the following JSON to the Append to array variable' actions 'Value' property:
{
"fileName": "",
"fileContent":
}
5.b. Place the cursor as per the image and select the 'File name with extension' property from the SharePoint 'Get Files (properties only)' action.
5.c. Place the cursor as per the image and select the 'File content' property from the SharePoint 'Get file content' action.
The competed JSON value is as follows:
{
"fileName": "@{items('For_each')?['{FilenameWithExtension}']}",
"fileContent": @{body('Get_file_content')}
}
6. Add the 'PDF - Merge Files' action underneath the 'For each' action
6.a. PDF Filename: Enter a value or use dynamic data to construct a filename
6.b. Click the 'Switch to input entire array' icon
6.c. Pass the 'Files' variable created in step #2
7. Add a SharePoint 'Create file' action passing the returned 'Filename' and 'File Content' properties from the 'PDF - Merge Files' action.
Advanced Parameters
The advanced 'PDF - Merge Files' flow action parameters are detailed below:
- Generate Bookmarks: Generate a bookmark for each merged PDF document within the final PDF document
- Remove Markup: Sets whether comments and tracked changes should be removed from the document(s) upon conversion. This option is only executed for Microsoft Office documents.
- PDF/A Compliant: Sets whether the resulting document should conform to PDF/A format.
- PDF/A Compliance Level: Sets the required level of PDF/A compliance.
- Return File: (Advanced) Sets whether the action should return a file or alternatively an operation ID: Flow Action Return Options: File Content vs. Operation ID
4 Comments