Skip Menu |

This queue is for tickets about the CAM-PDF CPAN distribution.

Report information
The Basics
Id: 15116
Status: resolved
Worked: 20 min
Priority: 0/
Queue: CAM-PDF

People
Owner: cpan [...] clotho.com
Requestors: hkraenz [...] mdl.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.01
Fixed in: 1.02_02



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
[guest - Tue Oct 18 05:13:43 2005]: Show quoted text
> ... > 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
Interesting idea. It never occurred to me that the instance would be useful despite being undecryptable. Moments ago, I released v1.02_01 to CPAN which hopefully should address this. I added an options hash to the constructor which can take a fault_tolerant => BOOLEAN key-value pair. If true, then the constructor does not fail when the PDF is not decryptable. Please try out this release and let me know if it works for you. This release also includes some simple code refactoring that I did over the last week that hopefully shouldn't affect any functionality. [Note: this version is a developer release (because of the "_01" in the version number, so CPAN or CPANPLUS will not install it automatically.] -- Chris
From: hkraenz [...] mdl.com
[CLOTHO - Tue Oct 18 10:07:14 2005]: Show quoted text
> [guest - Tue Oct 18 05:13:43 2005]: >
> > ... > > 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
> > Interesting idea. It never occurred to me that the instance would be > useful despite being undecryptable. Moments ago, I released v1.02_01 > to > CPAN which hopefully should address this. I added an options hash to > the constructor which can take a > fault_tolerant => BOOLEAN > key-value pair. If true, then the constructor does not fail when the > PDF is not decryptable. > > Please try out this release and let me know if it works for you. This > release also includes some simple code refactoring that I did over the > last week that hopefully shouldn't affect any functionality. > > [Note: this version is a developer release (because of the "_01" in > the > version number, so CPAN or CPANPLUS will not install it > automatically.] > > -- Chris
Hi Chris, I just tried to download v1.02_01 but got a tar ball of only 20 bytes :-( Can you please reload it to CPAN again? Thanks in advance - and thanks for the fast response! Helge
[guest - Wed Oct 19 01:45:12 2005]: Show quoted text
> Hi Chris, > > I just tried to download v1.02_01 but got a tar ball of only 20 bytes > :-( Can you please reload it to CPAN again? > > Thanks in advance - and thanks for the fast response! > > Helge
Huh, utterly bizarre... I think my upload script got confused by the underscore in the version number and uploaded an empty file. I just tried again with 1.02_02 and it appeared to work this time. -- Chris