Hello,

when playing around with Podofo I stumbled upon an issue that I'm not able
to load password protected PDFs. I already saw some earlier issues from
other people (e.g.
https://www.mail-archive.com/podofo-users@lists.sourceforge.net/msg01145.html),
but that doesn't help me.

My procedure:
I create the PDfMemDocument Object, call Load on it, catch the
InvalidPassword error and provide the correct one by calling SetPassword.
But that results in the InvalidPassword error as well. I'm absolutely sure
my password is correct, since I can view the file with it in a PDF Viewer.
Has someone a hint what I'm doing wrong?

Code:
void TestPDFLoad( const std::string& pdfFile, const std::string& pdfPwd )
{
    std::shared_ptr< PdfMemDocument > pDocument ( new PdfMemDocument() );

    try
    {
        pDocument->Load( pdfFile.c_str() ); return;
    }
    catch ( PdfError error )
    {
        EPdfError errorCode = error.GetError();
        if ( ePdfError_InvalidPassword != error.GetError() )
        {
            error.PrintErrorMsg(); return;
        }
    }

    // Error was "InvalidPassword", so provide one
    try
    {
        pDocument->SetPassword( pdfPwd ); return;
    }
    catch ( PdfError error )
    {
        error.PrintErrorMsg();
    }
}

Output:
PoDoFo encounter an error. Error: 31 ePdfError_InvalidPassword
        Error Description: The password used to open the PDF file was
invalid.
        Callstack:
        #0 Error Source:
E:\SVN\research\PDFCrypt\Libraries\_podofo-0.9.3\src\ba
se\PdfParser.cpp:1148
                Information: Authentication with user specified password
failed.

I can provide the file and password, but I guess I shouldn't append it to
the mail, should I?

Best regards,
F.E.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to