Urgent.News

What's breaking now, across thousands of outlets.

Tech

A PDF that opens without a password can still be encrypted

I used to think "encrypted PDF" and "password-protected PDF" meant the same thing. Then I made a handful of test PDFs for a side project and ended up with a file that opened instantly in my browser, no prompt at all, while a compression tool refused it for being encrypted. It took me a while to accept that both were telling the truth, because a PDF can carry two different passwords and only one…

A PDF can be encrypted in two ways: with a permission password or an open password. Both types of passwords only stop certain actions, but they differ in their effect. A permission password restricts printing, copying, and editing once the PDF has been opened, while an open password prevents the PDF from opening altogether until the correct password is entered.

Some PDFs may have both passwords, in which case they are encrypted and restrict permissions even after opening. This can be confusing because some libraries, like pypdf, report such a PDF as encrypted, while others like PyMuPDF do not. The discrepancy arises because each library interprets the /Encrypt dictionary differently. To determine if a PDF is permission-only, look for a viewer that asks for a password before opening the file.

If the viewer does not prompt for a password, it is likely permission-only. To remove restrictions, ask the file's author for an unrestricted version or the source document. If the file belongs to you and you know the owner password, open it in the software that created it, enter the password, and export a new copy.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Thursday 8 October →