Closed TPS closed 8 years ago
pdfclean
(part of mupdf tools) will reportedly also do this decrypt with same kinds of PDFs while doing garbage collection via -ggg
.
Will think about it. Problem is it will require a per file password to be stored somewhere, which will require lots of changes.
Do not like the idea of prompting the user interactively, since it will prevent automation via command line. So maybe the solution is a setting to ask or not for passwords.
As for pdfclean, I guess this is already done by ghoscript and smpdf. Have you performed any tests with it?
Do not like the idea of prompting the user interactively, since it will prevent automation via command line.
I meant this only for PDFs which don't need interactive processing, where the edit-password/DRM can be removed auto-magically.
Have you performed any tests with it?
Yes, running pdfclean -ggg
usually will inflate an already-FileOptimized PDF, but then re-running FileOptimizer will generally shrink it further than before pdfclean
.
Made ToDo via https://github.com/svn2github/nikkhokkho/commit/f892b80b14fc19e214e5af0a41fc5f7a2df40abc! ☺ 🎉
Did additional tests, and using pdfclean -ggg -z before Ghostcript and smpdf, seems to get better ratios, so it is now added in r567 (https://sourceforge.net/p/nikkhokkho/code/567/).
Thanks, @javiergutierrezchamorro!
Here, it's https://github.com/svn2github/nikkhokkho/commit/53d03ec4b48dfb9240c3ff2719857cb501d184eb.
@javiergutierrezchamorro Another way to handle the recent PDF handling updates would be to optionally decrypt PDFs before optimizing, using, e.g.,
qpdf --decrypt
. Binaries are @ https://sourceforge.net/projects/qpdf/files/qpdf/; most recent source may be @ https://github.com/qpdf/qpdf.N.B.: The above docs mention the need for a password to decrypt. I've found that
qpdf
can handle many kinds of "encrypted" PDFs (e.g., those with "edit" passwords, but no "open" passwords) without supplying such! GhostScript often barfs at these, but not after processing withqpdf
. YMMV.…