PDF Encryption and printing

I happened to note that if you pass a PDF through imagemagick's 'convert', convert it strips out the PDF Encrypted flag.

I needed to merge several PDF files into a single document, and using PDF::API2 this is really easy. This was until I found that someone had accidentally set the PDF Encrypted on some of the files when they were generated.

pdfinfo is the natty little tool which told me they were encrypted. Then convert sorted the problem out for me.

PDF can be very picky and quite a few generators actually get it wrong, I've seen one file which when printed through windows corrupted some of the very small text, but when sent via CUPs actually crashed the printer (so windoz was somehow correcting, reminded me of bad HTML and browsers 'correcting').

It was eventually tracked down to the pdf2ps part, which did give warnings, once they were fixed (upgrading Cario and switching to pnm images) printing from either windoz or CUPs was fine.

Having said that I no longer fear having to generate something as a PDF and actually would go so far as to enjoy using them.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

Please Log In to Continue

PDF::API2 is an awesome tool. It has a nicer API than my implementation, CAM::PDF [cpan.org], although we are focused on slightly different problem spaces (mine has almost no support for content creation). I'm believe that PDF::API2's support for PDF encryption was inspired by my implementation -- Alfred and I swapped email on the topic a while back. The last time I checked (like 2 years ago), my implementation was faster at parsing documents and doing simple operations like merging two PDFs. However, since switch

Hi Guys,
Maybe you got the answer to my question:
Selling an e-book in pdf-format, I want to secure the pdf with a password encryption. In Adobe you can do that by hand through "Secure-
Password Encrypt", but I want to do this automatically by writing a perl-script. I discovered the PDF::API2 module, but I can't discover if that module also offers a password encrypt-functionality.
Reading your discussion, this does seem possible. But how to do that? Which methods of this library to use?
Thanks a lot!