Add a Password to an Existing PDF using REST API
Add a Password to an Existing PDF using REST API
You may be generating PDFs in bulk using our API, or you might already have the PDFs from somewhere else. In either case, your product owners told you that these PDFs need to have a password on them. You can do this easily using the API2PDF /pdfsharp/password endpoints. Provide your PDF to this endpoint, specify the password, and retrieve a new PDF back in response, but with the password required to unlock the file.
Create an account and check out our documentation to get started for free.
We also offer client libraries in popular languages:
Otherwise, you can write very simple code against the REST API. Below is a simple Merge PDFs example using Python.
#python example
import requests
import json
api_key = 'your-api-key'
endpoint = 'https://v2.api2pdf.com/pdfsharp/password'
url_to_pdfs = 'https://url-to-your-pdf'
password = 'hello'
api_response = requests.post(endpoint, json={'url': url_to_pdf, 'ownerpassword': password, 'userpassword': password}, headers={'Authorization': api_key})
print(json.loads(api_response.content)['FileUrl'])
Adding passwords to PDFs on Cloud Run offers some huge benefits. First, we do not have any rate limits, unlike other services out there. Hit the API as many times as you wish. And second, the cost to service the API is substantially less, resulting in much lower fees than competing services.
Our API is also available as a standalone docker container that you can run in your own cloud environment. Contact us if you are interested in learning more.