Subject: | Handling of encrypted PDFs |
Hi everybody,
I'm using CAM-PDF-1.01 with a pretty old perl version (5.6.1) on a solaris machine (SunOS solaris-ff1 5.8 Generic_108528-22 sun4u sparc SUNW,Ultra-60).
I've a little problems using crypted PDFs. If I feed a crypted PDF into CAM-PDF using "CAM::PDF->new( 'file.pdf' )" the constructor returns undef. Other libraries like PDF-111 or a VB-Lib can handle this kind of PDF.
The problem lies in the last few lines of the constructor. In those lines you want to decrypt the document:
$doc->{crypt} = CAM::PDF::Decrypt->new( ... );
After that you abort the constructor if the decryption fails:
return undef if ( ! defined $doc->{crypt} );
While this may be useful for many purposes, some other information of the PDF file are available even it could not be decrypted (e.g. the number of pages).
It would be very nice if a failure while decrypting the document would not result in a failure of the constructor at all so that other information could be retrieved.
Thanks
Helge