PDF Password And Security
Add password and security limitations to PDF or remove existing limits and password from existing PDF files.
Available Methods
[POST] /pdf/security/add
Attributes |
---|
url required URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more. |
ownerPassword required The main owner password that is used for document encryption and for setting/removing restrictions. |
userPassword optional The optional user password will be asked for viewing and printing document. |
encryptionAlgorithm optional Encryption algorithm. Valid values: RC4_40bit , RC4_128bit , AES_128bit , AES_256bit . AES_128bit or higher is recommended. |
allowAccessibilitySupport optional Allow or prohibit content extraction for accessibility needs. true/false . Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
allowAssemblyDocument optional Allow or prohibit assembling the document. true/false . Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
allowPrintDocument true/false Allow or prohibit printing PDF document. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
allowFillForms true/false Allow or prohibit the filling of interactive form fields (including signature fields) in the PDF documents. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
allowModifyDocument true/false Allow or prohibit modification of PDF document. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
allowContentExtraction true/false Allow or prohibit copying content from PDF document. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
allowModifyAnnotations true/false Allow or prohibit interacting with text annotations and forms in PDF document. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
printQuality optional Allowed printing quality. Valid values: HighResolution , LowResolution .Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if the user enters Owner Password . |
async optional Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working , failed , aborted and success ). Must be one of: true , or false . |
name optional File name for the generated output. |
expiration optional Output link expiration in minutes. The default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage.Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead. |
profiles optional Use this parameter to set additional configurations for fine-tuning and extra options. Data must need to be in a “string” format. Explore PDF.co knowledgebase for profile examples. |
- Method: POST
- URL: /v1/pdf/security/add
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-merge/sample1.pdf",
"ownerPassword": "12345",
"userPassword": "54321",
"EncryptionAlgorithm": "AES_128bit",
"AllowPrintDocument": false,
"AllowFillForms": false,
"AllowModifyDocument": false,
"AllowContentExtraction": false,
"AllowModifyAnnotations": false,
"PrintQuality": "LowResolution",
"name": "output-protected.pdf",
"async": false
}
Example responses
/pdf/security/add
{
"url": "https://pdf-temp-files.s3.amazonaws.com/eaa441ade38548b8a3a96d8014c4f463/sample1.pdf",
"pageCount": 1,
"error": false,
"status": 200,
"name": "sample1.pdf",
"remainingCredits": 616208,
"credits": 14
}
Code Snippet
CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/security/add' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-merge/sample1.pdf",
"ownerPassword": "12345",
"userPassword": "54321",
"EncryptionAlgorithm": "AES_128bit",
"AllowPrintDocument": false,
"AllowFillForms": false,
"AllowModifyDocument": false,
"AllowContentExtraction": false,
"AllowModifyAnnotations": false,
"PrintQuality": "LowResolution",
"name": "output-protected.pdf",
"async": false
}'
[POST] /pdf/security/remove
Attributes |
---|
url required URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more. |
password required The owner/user password to open files and remove security features. |
async optional Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working , failed , aborted and success ). Must be one of: true , or false . |
name optional File name for the generated output. |
expiration optional Output link expiration in minutes. The default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage.Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead. |
profiles optional Use this parameter to set additional configurations for fine-tuning and extra options. Data must need to be in a “string” format. Explore PDF.co knowledgebase for profile examples. |
- Method: POST
- URL: /v1/pdf/security/remove
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-security/ProtectedPDFFile.pdf",
"password": "admin@123",
"name": "unprotected",
"async": false
}
Example responses
/pdf/security/remove
{
"url": "https://pdf-temp-files.s3.amazonaws.com/9f2a754f76db46ac93781b3d2c6694c3/ProtectedPDFFile.pdf",
"pageCount": 1,
"error": false,
"status": 200,
"name": "ProtectedPDFFile.pdf",
"remainingCredits": 616187,
"credits": 21
}
Code Snippet
CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/security/remove' \
--header 'x-api-key: ' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-security/ProtectedPDFFile.pdf",
"password": "admin@123",
"name": "unprotected",
"async": false
}'
Samples
- AWS Lambda - Protect PDF Document
- AWS Lambda - Remove PDF Document Protection
- C# - Protect PDF Document
- C# - Remove PDF Document Protection
- GoogleAppsScript - Add Password to PDF files
- Java - Protect PDF Document
- Java - Remove PDF Document Protection
- JavaScript - Protect PDF Document
- JavaScript - Remove PDF Document Protection
- PHP - Protect PDF Document
- PHP - Remove PDF Document Protection
- PowerShell - Protect PDF Document
- PowerShell - Remove PDF Document Protection
- Python - Protect PDF Document
- Python - Remove PDF Document Protection
- Salesforce - Protect PDF Document
- Salesforce - Protect PDF Document From Uploaded File
- Salesforce - Remove PDF Document Protection
- Salesforce - Remove PDF Document Protection From Uploaded File
- VB.NET - Protect PDF Document
- VB.NET - Remove PDF Document Protection
- cURL - Protect PDF Document
- cURL - Remove PDF Document Protection
Copyright © 2016 - 2023 PDF.co