Our /document/merge Robot

Merge documents into one

🤖/document/merge concatenates several PDF documents into a single file.

Note: This Robot can merge PDF files only at the moment.

Input files are sorted alphanumerically unless you provide the as-syntax in the "use" parameter. For example:

{
  "use": [
    { "name": "my_step_name", "as": "document_2" },
    { "name": "my_other_step_name", "as": "document_1" }
  ]
}

Usage example

Merge all uploaded PDF documents into one:

{
  "steps": {
    "merged": {
      "robot": "/document/merge",
      "use": {
        "steps": [
          ":original"
        ],
        "bundle_steps": true
      }
    }
  }
}

Parameters

  • use

    String / Array of Strings / Object required

    Specifies which Step(s) to use as input.

    • You can pick any names for Steps except ":original" (reserved for user uploads handled by Transloadit)

    • You can provide several Steps as input with arrays:

      "use": [
        ":original",
        "encoded",
        "resized"
      ]
      

    💡 That’s likely all you need to know about use, but you can view Advanced use cases.

  • input_passwords

    Array of Strings ⋅ default: []

    An array of passwords for the input documents, in case they are encrypted. The order of passwords must match the order of the documents as they are passed to the /document/merge step.

    This can be achieved via our as-syntax using "document_1", "document_2", etc if provided. See the demos below.

    If the as-syntax is not used in the "use" parameter, the documents are sorted alphanumerically based on their filename, and in that order input passwords should be provided.

  • output_password

    String ⋅ default: ""

    If not empty, encrypts the output file and makes it accessible only by typing in this password.

Related blog posts