Hmm, this seems to be an issue with PoDoFo. Your PDF is RC4V2 encrypted with a 128bit keylength.
The uvalue from the file can be found below as well as the user key calculated
by PoDoFo. Somehow our calculation of the user key seems to be wrong. I did
not find why after a quick look though.
UValue: e7ca4ec22eb2a2a0dece7f229145850500000000000000000000000000000000
UserKey: ef49d711caa0c1fd3d306db8f85dd0f400000000000000000000000000000000
best regards,
Dom
Am Dienstag, 20. Mai 2008 schrieb Zhen (Tim) Wang:
> Hi Craig,
> Thank you!
> For the first problem , the code as follow can work well if PDF file
>
> haven't set password:
> > PdfVecObjects objects;
> > PdfParser parser( &objects );
> > objects.SetAutoDelete( true );
> > try{
> > parser.ParseFile(pszFilename);
> > }catch( PdfError & e ) {
> > cout<<e.GetError()<<endl;
> > parser.SetPassword("123");
> > }
> > PdfWriter writer(&parser);
> > writer.Write("test_en.pdf");
>
> My test file with password 123 set is attached !
>
> Thank you for your help!
> BR/Tim
>
> -----Original Message-----
> From: Craig Ringer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 20, 2008 2:24 AM
> To: Zhen (Tim) Wang
> Cc: [email protected]
> Subject: Re: I have problem in open a PDF file which have set a password
> for opening
>
> Zhen (Tim) Wang wrote:
> > 1) I have problem in open a PDF file which have set a password for
> > opening with PoDoFo lib. Follows is my code:
> >
> > PdfVecObjects objects;
> > PdfParser parser( &objects );
> > objects.SetAutoDelete( true );
> > try{
> > parser.ParseFile(pszFilename);
> > }catch( PdfError & e ) {
> > cout<<e.GetError()<<endl;
> > }
> > parser.SetPassword("123");
> > PdfWriter writer(&parser);
> > writer.Write("test_en.pdf");
> >
> > I'am sure the password is "123"
>
> Does it work when you unlock the PDF with Acrobat Professional?
>
> Does Acrobat report that the file is also encrypted?
>
> Can you post the PDF, or a suitable test file, somewhere?
>
> > 2) I get the mean from manual that the PoDoFo and change the content
>
> of
>
> > exist file, but when I code like follows, the file will be destroy.
> >
> > PdfMemDocument *document = new PdfMemDocument(pszFilename);
> > document->GetInfo()->SetAuthor("nextlabs");
> > document->Write(pszFilename);
>
> PdfMemDocument uses delayed loading of objects to save memory. Thus, the
>
> call to Write needs to read from the original file. The first thing you
> do when writing to the file is truncate it, making it unreadable.
>
> You need to write to a temporary file then rename the temporary to
> replace the original once writing succeeds.
>
> PoDoFo can open and edit an existing PDF file, but when you save your
> changes you must still do so to a new file.
>
> Later on PoDoFo might support appending changes to an existing PDF file
> but it does not currently.
>
> --
> Craig Ringer
> ###########################################
>
> This message has been scanned by F-Secure Anti-Virus for Microsoft
> Exchange. For more information, connect to http://www.f-secure.com/
--
**********************************************************************
Dominik Seichter - [EMAIL PROTECTED]
KRename - http://www.krename.net - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game, for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
