Preview in macOS Catalina cannot save some PDFs, #

returning errors like "The document 'foo.pdf' could not be saved as 'bar.pdf'." and "The file couldn't be saved." Previous and succeeding versions of macOS/Preview do not suffer from this bug, saving the same PDF file without complaint, albeit with significant bloat even when simply duplicating:

Preview's "Export as PDF..." or the print dialog's "Save as PDF" are often cited as solutions, but those methods resulted in the largest PDFs of all, at 974KB and 975KB respectively.

Iman Mahmoudinasab's unjustifiably-low-scoring answer on Ask Different contained the necessary clue: "Another common reason for this issue is the PDF file is password protected." Rather than relying on the recommended cloud-based service ("Try 7 days free"), I used qpdf:

% qpdf --show-encryption in.pdf
...
modify document assembly: not allowed
modify other: not allowed
modify anything: not allowed
% qpdf --decrypt in.pdf out.pdf

The resultant PDF (which could be freely duplicated, saved, etc.) was actually smaller than the original, at just 269KB.

While Acrobat PDF owner passwords are easily bypassed as in this case, user passwords require decryption:

The standard security provided by Acrobat PDF consists of two different methods and two different passwords: a user password, which encrypts the file and prevents opening, and an owner password, which specifies operations that should be restricted even when the document is decrypted, which can include modifying, printing, or copying text and graphics out of the document, or adding or modifying text notes and AcroForm fields. The user password encrypts the file, while the owner password does not, instead relying on client software to respect these restrictions. An owner password can easily be removed by software, including some free online services. Thus, the use restrictions that a document author places on a PDF document are not secure, and cannot be assured once the file is distributed; this warning is displayed when applying such restrictions using Adobe Acrobat software to create or edit PDF files.

/mac | Dec 28, 2021


Subscribe or visit the archives.