Merging multiple PDFs into one
This endpoint will allow you to merge multiple PDFs into one using the PDF.API.
It is important to note that documents will be merged in the order they are sent via the payload.
You can view the full Swagger documentation here.
Request
- cURL
- Javascript
- PHP
curl --location 'https://pdf-api.doclabs.cloud/api/v1/merge?storageName=MyBucketName' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ••••••' \
--data '{
"documents": [
"MyFirstDocument.pdf",
"MySecondDocument.pdf",
"MyThirdDocument.pdf"
]
}'
var settings = {
"url": "https://pdf-api.doclabs.cloud/api/v1/merge?storageName=MyBucketName",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"x-api-key": "••••••"
},
"data": JSON.stringify({
"documents": [
"MyFirstDocument.pdf",
"MySecondDocument.pdf",
"MyThirdDocument.pdf"
]
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json',
'x-api-key' => '••••••'
];
$body = '{
"documents": [
"MyFirstDocument.pdf",
"MySecondDocument.pdf",
"MyThirdDocument.pdf"
]
}';
$request = new Request('POST', 'https://pdf-api.doclabs.cloud/api/v1/merge?storageName=MyBucketName', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Response
{
"bucketName": "MyBucketName",
"contentPathName": "MergedDocuments.pdf"
}