Skip to content

Merge PDF files

The “Merge PDF files” service task combines multiple PDF documents into a single file. Provide the list of PDF files to merge and the desired name of the final document.

Input parameters

Provide the following fields as task input:

{
  "pdfsToCombine": [
    "s3://bucket-name/path-to-file1.pdf",
    "s3://bucket-name/path-to-file2.pdf",
    "s3://bucket-name/path-to-file3.pdf"
  ],
  "filename_output": "combined_document.pdf"
}

Explanation:

  • pdfsToCombine: Array of file references (e.g., from an S3 bucket) that should be merged.
  • filename_output: Name of the final PDF created after merging.

Output

The task returns a file reference to the merged PDF.

{
  "file_reference": "s3://bucket-name/combined_document.pdf"
}

Explanation:

  • file_reference: File reference of the final PDF created after merging.

JSONata examples

Example expression for dynamic input:

{
  "pdfsToCombine": [
    "{{$.attachments.invoice}}",
    "{{$.attachments.contract}}",
    "{{$.attachments.appendix}}"
  ],
  "filename_output": "Final_Document_{{$.invoice.number}}.pdf"
}

Notes

  • Ensure that the specified PDF files exist and are accessible.
  • The task merges all PDFs in the order provided.
  • Generate the final filename dynamically with JSONata if needed.

Tip

Use the JSONata Playground to test expressions and refine the inputs.