How do I create multiple-page pdfs?

It's not possible to create a multiple-page PDF off the bat, but Bannerbear has a utility for joining PDF files together into a single PDF.

Join the PDFs

To join the PDFs, you'll need to send a POST request to the /utilities/pdf/join endpoint with a list of the files you want to join.

var data = {
  "pdf_inputs": [
    "https://images.bannerbear.com/direct/wBpLjEMXNj6zNmPak0/requests/000/017/506/830/LWXrA1qRoQvVOvkvQypMJegBj/4e3b3e303f8ff9caae87ed68bed15c18df448ce1-compressed.pdf",
    "https://images.bannerbear.com/direct/wBpLjEMXNj6zNmPak0/requests/000/017/506/845/9e2VGL0qn6VPWoDXYEAv5mxr1/80360378d620b6fd490c9db0bb2720d4a84a61c8-compressed.pdf",
    "https://images.bannerbear.com/direct/wBpLjEMXNj6zNmPak0/requests/000/017/506/856/BjdZ0l7VAYA7N3P763Kn1DLqe/400b91737a51d520a5a237de2cc91f136413b6e6-compressed.pdf"
  ],
}
fetch('https://api.bannerbear.com/v2/utilities/pdf/join', {
  method: 'POST',
  body: JSON.stringify(data),
  headers: {
    'Content-Type' : 'application/json',
    'Authorization' : `Bearer ${API_KEY}`
  }
})
	

Retrieve the joined PDF

You'll need to poll the GET endpoint via /utilities/pdf/join/:uid for status updates and to retrieve the completed joined PDF.

fetch(`https://api.bannerbear.com/v2/utilities/pdf/join/${UID}`, {
  method: 'GET',
  headers: {
    'Authorization' : `Bearer ${API_KEY}`
  }
})
	

You may also use the synchronous base URL ( https://sync.api.bannerbear.com ) which will hold the request open until the process is completed. There is a timeout of 10 seconds on synchronous requests so you may experience timeouts for requests that take a longer time. Timeouts respond with a 408 status code.

Using a webhook

A webhook allows you to be notified when the process is complete. Use the webhook_url parameter to tell Bannerbear where to POST the joined PDF, once the rendering is completed. The result will be posted to your webhook as JSON.

Check the API Reference ↗ page for more information on this topic.

Have a question?

Contact our customer support team anytime via chat or email