How to Encrypt and Password Protect a PDF using Go

Reliable document security is one of the chief advantages of PDF format. Encryption and password protection features make it possible to keep viewership of a document static between a trusted group of peers, eliminating the risk of unwanted parties appending or revising the document. With our free-to-use PDF Encryption & Password Protection API, you can programmatically set custom permissions for dozens of PDF documents (one API call per document) in a one-step process that involves setting a user password, owner password, and encryption key length (values include 128-bit RC4 encryption and 256-bit AES encryption; the latter is the default setting).

Taking advantage of this API is easy; all you need to do is copy & paste the complementary Go code examples provided below and register a free account on our website to get a free-tier Cloudmersive API key (this key will yield a limit of 800 API calls per month & no additional commitments).

To use this API, include the below code examples in your file and fill the required header fields as directed by the code comments:

Simple as that — you’re all done.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.