Removing security from a PDF
Removing security from a PDF will allow you to unset a user password.
If you need to modify the current permissions of a PDF, take a look at the adding security example. You can view the full Swagger documentation here.
Request
- cURL
- Javascript
- PHP
curl --location 'https://pdf-api.doclabs.cloud/api/v1/MyDocument.pdf/security/unprotect?storageName=MyBucketName' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ••••••' \
--data '{
"ownerPassword": "MyStrongPassword"
}'
var settings = {
"url": "https://pdf-api.doclabs.cloud/api/v1/MyDocument.pdf/security/unprotect?storageName=MyBucketName",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"x-api-key": "••••••"
},
"data": JSON.stringify({
"ownerPassword": "MyStrongPassword"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json',
'x-api-key' => '••••••'
];
$body = '{
"ownerPassword": "MyStrongPassword"
}';
$request = new Request('POST', 'https://pdf-api.doclabs.cloud/api/v1/MyDocument.pdf/security/unprotect?storageName=MyBucketName', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Response
{
"bucketName": "MyBucketName",
"contentPathName": "CopyOfTheOriginal.pdf"
}