pdf-security-info

The pdf-security-info
endpoint provides information about security and encryption present in an existing PDF. It takes a PDF as input and returns the security information as JSON (encryption details).
The returning JSON returns the values for the following properties. PDFs without a property value returns a null as the property's value. The endpoint returns the following security information as JSON:
- hasOwnerPassword
- hasUserPassword
- allowPrint
- allowEdit
- allowCopy
- allowUpdateAnnotsAndFields.
For RC4 40-bit, RC4 128-bit, AES-128, and AES-256 encryption the following properties are also returned:
- allowDocumentAssembly
- allowAccessibility
- allowFormFilling
- allowHighResolutionPrinting.
And for AES-128 and AES-256 encryption the following two additional properties are returned:
- encryptAllExceptMetadata
- encryptOnlyFileAttachments.
The encryptionType
property returns one of the following values.
- aes-128-cbc
- aes-256-cbc
- rc4-40
- rc4-128
- none
corresponding to
- AES-128 encryption
- AES-256 encryption
- RC4 40-bit encryption
- RC4 128-bit encryption, or
- no security.
Refer to pdf-security-info in the Client Libraries Users Guide section for this example using the DynamicPDF API's client libraries.
Request/Response
Request | Request Data | Response |
---|---|---|
POST | PDF as byte array | JSON document containing metadata. |
The pdf-security-info
endpoint takes an HTTP POST form submission, where the PDF is sent as binary in the form's body.
POST https://api.dpdf.io/v1.0/pdf-security-info HTTP/1.1
Authorization: Bearer DP.xxx-your-api-key-xxx
Parameters
Parameters | Value | Description | |
---|---|---|---|
Header | |||
Content-Type | application/pdf | Content type sent in request. | |
Authorization | Bearer DP.xxx-your-api-key-xxx | The API key. | REQUIRED |
Request Body | Type | ||
Body | binary | The PDF document to obtain information about. | REQUIRED |
The PDF is sent to the endpoint as binary data. In this example request, the binary is coming from a file, but it could also come from a URL, a database, or other source.
Sample cURL Request
curl -X POST "https://api.dpdf.io/v1.0/pdf-security-info"
-H "accept:application/json"
-H "Authorization: Bearer DP.xxx-your-api-key-xxx"
-H "Content-Type: application/pdf"
--data-binary "@C:/temp/security/aes128-sig-out.pdf"
Sample Response
{
"encryptionType": "aes-128-cbc",
"hasUserPassword": true,
"hasOwnerPassword": true,
"allowPrint": true,
"allowEdit": true,
"allowCopy": false,
"allowUpdateAnnotsAndFields": true,
"allowFormFilling": true,
"allowAccessibility": true,
"allowDocumentAssembly": false,
"allowHighResolutionPrinting": true,
"encryptAllExceptMetadata": false,
"encryptOnlyFileAttachments": false
}
Further Information
You can also use one of DynamicPDF's provided client libraries to integrate the endpoints into your client applications if you prefer. For more information, refer to the relevant Users Guide sections:
- DynamicPDF API's Endpoints - (cloud-api-overview), and
- DynamicPDF API's Client Libraries - (cloud-api-client-libraries).