Set properties of a PDF
Setting the document properties will allow you to set the default properties of a PDF using the PDF.API.
Some of these include author, creation date, subject, and title.
You can view the full Swagger documentation here.
Request
- cURL
- Javascript
- PHP
curl --location 'https://pdf-api.doclabs.cloud/api/v1/MyDocument.pdf/document/properties?storageName=MyBucketName' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ••••••' \
--data '{
"subject": "My new subject",
"title": "My new title"
}'
var settings = {
"url": "https://pdf-api.doclabs.cloud/api/v1/MyDocument.pdf/document/properties?storageName=MyBucketName",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"x-api-key": "••••••"
},
"data": JSON.stringify({
"subject": "My new subject",
"title": "My new title"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json',
'x-api-key' => '••••••'
];
$body = '{
"subject": "My new subject",
"title": "My new title"
}';
$request = new Request('POST', 'https://pdf-api.doclabs.cloud/api/v1/MyDocument.pdf/document/properties?storageName=MyBucketName', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Response
{
"bucketName": "MyBucketName",
"contentPathName": "CopyOfTheOriginal.pdf"
}