How to copy text in Preview in password protected PDF
According to this question preview previously didn't care about password protection on pdfs. Now in big sur I'm finding pdfs fairly often that don't allow me to copy text unless I have a password. Is there a way to prevent preview from doing this or do I need to find a different pdf reader? It's incredibly frustrating to have to re-type text from a pdf if I want to google something I just read.
Solution 1:
AFAIK, Preview has respected the security features of the PDF standard for a long time, so I don't understand/agree with the answer in the other question.**
A document that has been restricted must have the password supplied to be either printed, and/or copied, and/or opened. Preview itself can add security restrictions to saved PDFs. The security is baked into the PDFKit API that Preview and other macOS PDF utilities use.
(As far back as OS X Tiger, it was an open secret that ColorSync Utility would ignore security, letting you save a 'clean' version, but this has long been fixed. Even then, Preview respected security.)
However, I would say that 99.9% of PDFs in the wild are not restricted, so it's curious that you say 'fairly often', unless you're mining a reserve of PDFs that the authors expressly don't want you to copy for some reason. You could try contacting the authors and asking for permission: it's conceivable they may have added the protection against copying by mistake.
Needless to say, no DRM protection is impregnable, and there are several scripts and apps devoted to removing copy protections from PDFs. The simplest method is that if you can print it, then you can 're-print' the document as a new PDF.
At worst, you could use OCR software on a screenshot.
** As for the other question, the method by which images are 'lifted' from the PDF is not explicitly stated, and that may be different from copy/pasting text.
Solution 2:
There's probably not a realistic way to get preview to ignore the owner password, but it is fairly easy to just remove it. This answer goes into better detail, but on MacOs assuming you have homebrew first install qpdf
brew install qpdf
Then decrypt the pdf
qpdf -decrypt my_file.pdf output_file.pdf