pdf_add_password
Add password protection to a PDF file to secure it with owner and user passwords, restricting access and setting permissions for printing, editing, and copying.
Instructions
Add password protection to a PDF file.
Ref: https://developer.pdf.co/api-reference/pdf-password/add.md
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files. | |
| owner_password | Yes | The main owner password that is used for document encryption and for setting/removing restrictions. | |
| user_password | No | The optional user password will be asked for viewing and printing document. | |
| encryption_algorithm | No | Encryption algorithm. Valid values: RC4_40bit, RC4_128bit, AES_128bit, AES_256bit. AES_128bit or higher is recommended. | AES_256bit |
| allow_accessibility_support | No | Allow or prohibit content extraction for accessibility needs. | |
| allow_assembly_document | No | Allow or prohibit assembling the document. | |
| allow_print_document | No | Allow or prohibit printing PDF document. | |
| allow_fill_forms | No | Allow or prohibit the filling of interactive form fields (including signature fields) in the PDF documents. | |
| allow_modify_document | No | Allow or prohibit modification of PDF document. | |
| allow_content_extraction | No | Allow or prohibit copying content from PDF document. | |
| allow_modify_annotations | No | Allow or prohibit interacting with text annotations and forms in PDF document. | |
| print_quality | No | Allowed printing quality. Valid values: HighResolution, LowResolution. | |
| httpusername | No | HTTP auth user name if required to access source url. (Optional) | |
| httppassword | No | HTTP auth password if required to access source url. (Optional) | |
| password | No | Password of the PDF file if it's already password-protected. (Optional) | |
| name | No | File name for the generated output. (Optional) | |
| api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) |
Implementation Reference
- pdfco/mcp/services/pdf.py:101-106 (helper)The service-layer helper function add_pdf_password that executes the actual API call. It sends a request to the 'pdf/security/add' endpoint, passing additional keyword arguments as the custom payload (ownerPassword, EncryptionAlgorithm, permission flags, etc.).
async def add_pdf_password( params: ConversionParams, api_key: str | None = None, **kwargs ) -> BaseResponse: return await request( "pdf/security/add", params, custom_payload=kwargs, api_key=api_key )