Hi Bjoern, Thanks for your very good bug report. I tested with SVN trunk and found the very same issues (and even some more, including a memory leak).
I fixed all issues I found in SVN and also added a test PDF. If you upgrade to SVN trunk, your issues should be resolved. Best regards, Dom Am Freitag 08 Januar 2010 schrieb i...@gustavs.de: > Hi folks, > > I got a problem using PdfMemDocument and wonder if this is because I miss > something or there is something missing in PdfMemDocument. > > > I made a password protected test-PDF. > > Concerning the documentation i found, I need to call Load(...), get an > exception then call SetPassword. > But here is my problem: > > When loading it with PdfMemDocument->Load(...), I get an exception with > the error "PoDoFo::ePdfError_InvalidPassword" - thats fine. > In that case I try SetPassword(...) which results in an exception because > when setting the password, m_pParser of my PDFMemDocument object is still > NULL although I tried loading the file before. > > > It is NULL because in PdfMemDocument::Load(...) the m_pParser is created by > > m_pParser = new PdfParser( PdfDocument::GetObjects(), pszFilename, true ); > > ...which tries to parse the document right ahead, which fails, which lets > m_pParser be NULL which is a problem calling when SetPassword. > > > I tried in PdfMemDocument::Load(...) to do the parsing after the m_pParser > creation. SetPassword(...) now works, reads stuff but the pagesTree of the > PDFDocument is NULL and so I am not able to access pages etc... > > > Is there hope for me? > > Thanks for your time and reading this chaos. =) > Bjoern > > > > A reduced code snipped: > > PdfMemDocument *currentPodofoDocument=new PdfMemDocument(); > try > { > currentPodofoDocument->Load(pdffilename); > } > catch(const PdfError &errorObject) > { > if(errorObject.GetError() == PoDoFo::ePdfError_InvalidPassword) > { > currentPodofoDocument->SetPassword(mypassword); > // currentPodofoDocument->Load(pdffilename); > } > } > > page = currentPodofoDocument->GetPage(0); > > > > --------------------------------------------------------------------------- > --- This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Podofo-users mailing list > Podofo-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/podofo-users > -- ********************************************************************** Dominik Seichter - domseich...@web.de 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.
------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users