PDF Merge
PDF Merge
Section titled “PDF Merge”Type: pdf-merge · Package: PDF Activities v1.2.4 · Output: string
Merges several PDFs into one, in the order you give. Useful to consolidate documents: join several invoices into a single file, put a report together with its annexes, assemble a case file.
How it works
Section titled “How it works”Takes the list of paths paths (in order) and creates a new PDF at output with all their pages, one after the other. Returns the path of the merged file. The originals stay intact.
- Before starting it checks that all the files exist: if one is missing, it fails without creating anything and tells you which one (by its position in the list).
- It creates the
outputfolder if it doesn’t exist and overwrites the file if it already exists.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
paths | List | — | List of paths of the PDFs to merge, in order. It must be a list: a single text is not accepted. |
output | string | — | Path of the resulting PDF. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns a string with the path of the merged PDF (the same as output).
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'paths' must be a list of file paths. | You passed a text or another value instead of a list. For a single file, wrap it in a list. |
'paths' cannot be empty. | The list has no paths (for example, List Files found no files). Check it first with count(files) > 0. |
File not found (item … of 'paths'). | The path at that position (from 1) doesn’t exist. |
'paths' is required. / 'output' is required. | The parameter was left empty or its expression returned null. |
| PDF library error when opening a file | One of the PDFs is password-protected or damaged. See Protected and damaged PDFs. |
Example
Section titled “Example”Merge every PDF in a folder:
List Files path = "C:/annexes" pattern = "*.pdf" → output: filesIf condition = count(files) > 0 └─ then: PDF Merge paths = files output = "C:/case-file.pdf" → output: caseFile Log message = "Case file created: " + caseFileRelated activities
Section titled “Related activities”- PDF Split — the reverse operation: split pages.
- PDF Extract Pages — take only some pages.