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
>
------------------------------------------------------------------------------
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