Actually the cache seems to be working.

PdfPagesTree::InsertPage( int nAfterPageNumber, PdfObject* pPage ) inserts a 
null value into the cache:

    m_cache.InsertPage( nAfterPageNumber );

which seems suspicious since the functions obvious intention is to insert pPage.
The null entry remains in the cache after appending another document which 
seems to mess up the structure.


-------- Original-Nachricht --------
> Datum: Mon, 24 Oct 2011 20:35:23 +0200
> Von: Dominik Seichter <[email protected]>
> An: Joerg Walter <[email protected]>
> CC: [email protected]
> Betreff: Re: [Podofo-users] GetPage() return same page for different indizes

> Hi Jörg,
> 
> Seems like another bug in the PageTree cache.....
> Maybe you can provide a patch, so that the user can enable/disable the
> cache
> in PdfPagesTree. So, you could just disable the cache instead of
> commenting
> out the lines.
> 
> Even better would be a fix of course :)
> 
> Regards,
>   Dominik
> 
> On Mon, Oct 24, 2011 at 4:10 PM, Joerg Walter <[email protected]> wrote:
> 
> >
> > When I comment out the cache query in PdfPagesTree::GetPage()
> >
> > if( pPage )
> >  return pPage;
> >
> > it seems to work just fine.
> >
> > Jörg
> >
> > -------- Original-Nachricht --------
> > > Datum: Mon, 24 Oct 2011 10:24:57 +0200
> > > Von: "Joerg Walter" <[email protected]>
> > > An: [email protected]
> > > Betreff: [Podofo-users] GetPage() return same page for different
> indizes
> >
> > > Hi
> > >
> > > I tried the code at the end. My intention was to append a loaded PDF
> > twice
> > > and draw text on both pages. I works fine except the text is drawn on
> the
> > > first page in both cases. It's because "PoDoFo::PdfPage* page2 =
> > > outDoc.GetPage(1);" returns the pointer to the first page - again.
> > > PdfPagesTree::GetPage() finds it with index 1 in the cache. Page count
> is
> > correctly 2. What
> > > am I doing wrong?
> > >
> > > Jörg
> > >
> > >     PoDoFo::PdfMemDocument templ("e:\\test.pdf");
> > >
> > >     PoDoFo::PdfMemDocument outDoc;
> > >     PoDoFo::PdfPage* page;
> > >
> > >     PoDoFo::PdfFont* font = outDoc.CreateFont("Arial");
> > >     font->SetFontSize( 18.0 );
> > >
> > >     PoDoFo::PdfPainter painter;
> > >
> > >     outDoc.Append(templ);
> > >     page = outDoc.GetPage(0);
> > >     painter.SetPage(page);
> > >     painter.SetFont( font );
> > >     painter.DrawText( 56.69, page->GetPageSize().GetHeight() - 256.69,
> > > "Hello World 1!" );
> > >     painter.FinishPage();
> > >
> > >
> > >     outDoc.Append(templ);
> > >
> > >     int pc = outDoc.GetPageCount();
> > >     PoDoFo::PdfPage* page2 = outDoc.GetPage(1);
> > >     painter.SetPage(page2);
> > >     painter.DrawText( 56.69, page->GetPageSize().GetHeight() - 256.69,
> > > "Hello World 2!" );
> > >     painter.FinishPage();
> > >
> > >     outDoc.Write("e:\\test2.pdf");
> > >
> > > --
> > > Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> > > belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > The demand for IT networking professionals continues to grow, and the
> > > demand for specialized networking skills is growing even more rapidly.
> > > Take a complimentary Learning@Cisco Self-Assessment and learn
> > > about Cisco certifications, training, and career opportunities.
> > > http://p.sf.net/sfu/cisco-dev2dev
> > > _______________________________________________
> > > Podofo-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/podofo-users
> >
> > --
> > Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> > belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> >
> >
> >
> ------------------------------------------------------------------------------
> > The demand for IT networking professionals continues to grow, and the
> > demand for specialized networking skills is growing even more rapidly.
> > Take a complimentary Learning@Cisco Self-Assessment and learn
> > about Cisco certifications, training, and career opportunities.
> > http://p.sf.net/sfu/cisco-dev2dev
> > _______________________________________________
> > Podofo-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/podofo-users
> >

-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!               
Jetzt informieren: http://www.gmx.net/de/go/freephone

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to