Open GoogleCodeExporter opened 8 years ago
Thank you for taking time for submitting a useful bug report, with all details
needed to reproduce the problem included.
The attached PDF is indeed encrypted, it's trailer contains /Encrypt.
Please note that the PDF file format supports encryption without a (user)
password, so viewer software can decrypt it without asking for a password. This
is what happens with the attached test.pdf .
pdfsizeopt at r166 doesn't support encrypted input at all. This means that it's
behavior is undefined on encrypted input. The behavior for test.pdf is to
finish successfully, but generate an invalid (useless, bad) output PDF, which
confuses xpdf and evince. (Most probably there is no bug in xpdf and evince.)
As a quick fix, I've added the proper error message to r168 if the input PDF is
encrypted, so pdfsizeopt should fail early and clearly. You can use the
following command to decrypt the PDF before passing it to pdfsizeopt:
qpdf --decrypt test.pdf test.decrypted.pdf
Adding encrypted file reading support to pdfsizeopt would be a huge effort, and
I don't have time for that in a foreseeable future, but I'm keeping this issue
open just to track the progress, should there be any.
Original comment by pts...@gmail.com
on 25 Aug 2011 at 8:33
> Please note that the PDF file format supports encryption without a (user)
password, so viewer software can decrypt it without asking for a password. This
is what happens with the attached test.pdf .
Sorry for my early claim that it's not "protected". I should have been able to
become aware easily of the opposite using e.g. pdfinfo and not merely a pdf
viewer.
Thanks you for your quick reaction and the bypass solution using qpdf in the
new revision.
Please note, that I deleted the attached file test.pdf from my first post.
Anyway it can be downloaded freely from
http://www.swp-berlin.org/de/produkte/swp-studien-de/swp-studien-detail/article/
private_militaerfirmen_im_voelkerrecht.html
Original comment by garbage-collection@gmx.net
on 25 Aug 2011 at 11:30
Original comment by pts...@gmail.com
on 2 Apr 2012 at 5:25
Many users would find this useful, especially if it was automated manual
decryption with qpdf.exe would not be necessary.
There are many external tools to decrypt PDFs:
* qpdf --decrypt (doesn't change anything else)
* Multivalent tool.pdf.Compress
* gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c
.setpdfwrite -f encrypted.pdf
, but some of them (e.g. Ghostscript and tool.pdf.Compress) do extra, unwanted
transformations as well. We could also integrate decryption to pdfsizeopt, but
it may be a bit slow.
Multivalent and qpdf are both able to decrypt PDFs. Maybe addn
Original comment by pts...@gmail.com
on 2 Jul 2012 at 11:01
qpdf --decrypt removed pdf-pseudo-encryption without unwanted changes in all of
my test cases.
Multivalent and Ghostscript had unwanted side-effects and mutool often created
damaged PDF files. So I stick with qpdf.
Original comment by Sebastia...@googlemail.com
on 28 Jan 2014 at 1:12
Thanks for the feedback. The newest version of pdfsizeopt recommends using qpdf
--decrypt if needed. Does it show this message for your encrypted PDF?
It wouldn't be too hard to exectend pdfsizeopt to call qpdf --decrypt
automatically by default (could be disabled by --use-qpdf-decrypt=no). Would
you like to have this feature?
Original comment by pts...@gmail.com
on 28 Jan 2014 at 2:53
Original issue reported on code.google.com by
garbage-collection@gmx.net
on 25 Aug 2011 at 2:29