Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

void PoDoFo::PdfMemDocument::SetPassword ( const std::string &  sPassword )

If you try to open an encrypted PDF file, which requires a password to open, PoDoFo will throw a PdfError( ePdfError_InvalidPassword ) exception.

If you got such an exception, you have to set a password which should be used for opening the PDF.

The usual way will be to ask the user for the password and set the password using this method.

PdfParser will immediately continue to read the PDF file.

Parameters:
sPassworda user or owner password which can be used to open an encrypted PDF file If the password is invalid, a PdfError( ePdfError_InvalidPassword ) exception is thrown!

Definition at line 227 of file PdfMemDocument.cpp.

References InitFromParser(), PoDoFo::PdfDocument::InitPagesTree(), m_pParser, PODOFO_RAISE_LOGIC_IF, and PoDoFo::PdfParser::SetPassword().

{
    PODOFO_RAISE_LOGIC_IF( !m_pParser, "SetPassword called without reading a PDF file." );

    m_pParser->SetPassword( sPassword );
    InitFromParser( m_pParser );
    InitPagesTree();
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index