Splitting a PDF at a page
Splitting a PDF at a page will allow you to break the document down into 2 separate documents using the PDF.API.
The page
parameter dictates at what page the PDF should be split.
You can view the full Swagger documentation here.
Request
- cURL
- Javascript
- PHP
curl --location 'https://pdf-api.doclabs.cloud/api/v1/MyDocumentWith5Pages.pdf/atpage?storageName=MyBucketName' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ••••••' \
--data '{
"page": 2
}'
var settings = {
"url": "https://pdf-api.doclabs.cloud/api/v1/MyDocumentWith5Pages.pdf/atpage?storageName=MyBucketName",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"x-api-key": "••••••"
},
"data": JSON.stringify({
"page": 2
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json',
'x-api-key' => '••••••'
];
$body = '{
"page": 2
}';
$request = new Request('POST', 'https://pdf-api.doclabs.cloud/api/v1/MyDocumentWith5Pages.pdf/atpage?storageName=MyBucketName', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Response
{
"bucketName": "MyBucketName",
"contentPathNames": [
"DocumentContaining2Pages.pdf",
"DocumentContainingTheRest.pdf",
]
}