DEV Community

Cover image for How to disable security in a PDF that prevents copy & paste
Rafał Sroka
Rafał Sroka

Posted on

How to disable security in a PDF that prevents copy & paste

QPDF is a hefty library that can inspect and manipulate the structure of PDF files. It can encrypt and expose the internals of a PDF file, and do many other operations useful to end users and PDF developers.

Some PDF creators enable the read-only mode for their documents. In reality, this way of protection has little sense. It relies on PDF reader apps implementation letting them decide what to do when user tries to copy the text. Many of them show error alerts with a message about disabled copying.

Of course, the text is visible, so nothing prevents us from reading it. The alerts become especially annoying if you own the PDF. You purchased it but since the protection mechanism is still there, you're not allowed to CTRL + C.

The following recipe shows how to solve the problem.

  1. Download QPDF from the official website.

  2. Install it according to the instructions for your OS.

  3. Run

qpdf --decrypt in.pdf out.pdf
Enter fullscreen mode Exit fullscreen mode

Top comments (0)