We love our Robots, so it's always a pleasure to announce the release of a new one! In today's blog, we get the opportunity to do just that, by welcoming our /document/merge Robot to the team.

Bright blue background with a paint splat in the middle revealing the text 'Introducing /document/merge' in a graffiti style

As you may have already assumed, the /document/merge Robot concatenates several PDFs, to form a single output document. Moreover, the Robot supports merging several password-protected PDFs – simply supply it with an array of input passwords. You can protect the output PDF as well, by providing an output password. This way, you can be sure that your secrets stay secret.

Merging two PDFs

Let's see it in action! The below Template will take two password-protected PDFs and merge them together. You may also be interested in using one of our SDKs, to easily automate the bulk processing of documents, or for sanitizing user-inputted documents.

{
  "steps": {
    ":original": {
      "robot": "/upload/handle"
    },
    "merge": {
      "use": {
        "steps": [":original"],
        "bundle_steps": true
      },
      "robot": "/document/merge",
      "input_passwords": ["password1", "password2"],
      "result": true
    },
    "exported": {
      "use": ["merge", ":original"],
      "robot": "/s3/store",
      "credentials": "demo_s3_credentials",
      "url_prefix": "https://demos.transloadit.com/"
    }
  }
}

As you can see, by passing in an array of passwords to the input_passwords parameter, Transloadit processes the PDFs. The documents are then stitched together into a single output PDF, which is shown below.

The open PDF showing two documents merged together, with Transloadit on the left page and Uppy on the right page.

And if you're looking to password protect the output file too, that's no problem! Simply add the output_password parameter, and supply the password you'd like to use.

{
  "steps": {
    "merge": {
      "use": {
        "steps": [":original"],
        "bundle_steps": true
      },
      "robot": "/document/merge",
      "input_passwords": ["password1", "password2"],
      "output_password": "transloadit",
      "result": true
    },
    "exported": {
      "use": ["merge", ":original"],
      "robot": "/s3/store",
      "credentials": "YOUR_AWS_CREDENTIALS",
      "url_prefix": "https://demos.transloadit.com/"
    }
  }
}

Now your important PDF is safely kept away from unwanted eyes, even if a third party manages to get their hands on your documents.

Wrapping up

That's it for today's look at our latest Robot. We've got a few more that are ready to be introduced, so stay tuned for future updates on all things Transloadit by signing up for the Dev Times below.