Hello there,

I wrote a small code based on the image extractor, it doesn't make much
sense but it reproduces the bug.
(my code is too long and specific).

I'd be happy to supply a small input file (how? moderator didn't like my
attachment (19K pdf file))

#ifdef USE_PODOFO
#include <podofo/podofo.h>
using namespace PoDoFo;

void DrawToPdf ()
{
        const char* inname = "input.pdf"; //change to full path

    PdfDocument indoc( inname ); // <-----   crash

    TCIVecObjects it = indoc.GetObjects().begin();
    PdfObject*  pObj  = NULL;

    while( it != indoc.GetObjects().end() )
    {
        if( (*it)->IsDictionary() )
        {            
            pObj = (*it)->GetDictionary().GetKey( PdfName::KeyType );
            if( pObj && pObj->IsName() && ( pObj->GetName().GetName() ==
"XObject" ) )
            {
                pObj = (*it)->GetDictionary().GetKey(
PdfName::KeySubtype );
                if( pObj && pObj->IsName() && (
pObj->GetName().GetName() == "Image" ) )
                {
                     PdfMemStream* stream =
dynamic_cast<PdfMemStream*>((*it)->GetStream());
                                        stream->Uncompress();
                                                
                                        //.......write the file

                                        const char* fname  =
"output.pdf"; //change to full path

                
                                        PdfStreamedDocument document(
fname );
                                        
                                        //image Is 1x1 Inch and of 72
dpi                                             
                                        PdfRect rSize(0, 0, 72, 72);
                                        PdfPage* pPage =
document.CreatePage(rSize);
                                        if( !pPage ) 
                                        {
                                                PODOFO_RAISE_ERROR(
ePdfError_InvalidHandle );
                                        }
                                        
                                        PdfPainter painter;
                                        painter.SetPage( pPage );

                                        PdfMemoryInputStream pStream
(stream->Get(), stream->GetLength());
                                        PdfImage pImage(&document);

                                        pImage.SetImageData (72, 72, 8,
&pStream);
                                                
                                        painter.DrawImage (0, 0,
&pImage, 1.0, 1.0);
                                                
                                        painter.FinishPage();
                                        document.Close();
                                        //.......
                                        break;

                }
            }
        }
                ++it;
    }
}
#endif






Jonathan Sibony wrote:
> Hello All,
> 
> In "encountering problems with Pdf 1.6" i meant that each time I am 
> trying to instantiate a PDFDocument using the constructor that gets a 
> file name (to be loaded into document) I crash.
> This only happens with files of pdf version 1.6.
> 
> Apparently an error is thrown from HasLinearizationDict when trying to

> find out if dictionary contains a key named "Linearized" (second line 
> within try):

Some sample code to trigger the issue and a backtrace would be useful.

--
Craig Ringer
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to