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

Reply via email to