Skip to content

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.

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 output folder if it doesn’t exist and overwrites the file if it already exists.
ParameterTypeDefaultDescription
pathsList—List of paths of the PDFs to merge, in order. It must be a list: a single text is not accepted.
outputstring—Path of the resulting PDF.

None.

Returns a string with the path of the merged PDF (the same as output).

MessageCause 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 fileOne of the PDFs is password-protected or damaged. See Protected and damaged PDFs.

Merge every PDF in a folder:

List Files path = "C:/annexes" pattern = "*.pdf" → output: files
If condition = count(files) > 0
└─ then:
PDF Merge paths = files output = "C:/case-file.pdf" → output: caseFile
Log message = "Case file created: " + caseFile