I tried both. Here is a way to reproduce the bug:
void HelloWorld( const char* pszFilename )
{
PdfStreamedDocument document( pszFilename );
PdfPainter painter;
PdfPage* pPage;
PdfPage* pPage_2;
PdfFont* pFont;
try {
pPage = document.CreatePage( PdfPage::CreateStandardPageSize(
ePdfPageSize_A4 ) );
if( !pPage )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
}
painter.SetPage( pPage );
pFont = document.CreateFont( "Arial" );
if( !pFont )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
}
pFont->SetFontSize( 18.0 );
painter.SetFont( pFont );
/* next line works ok */
painter.DrawText( 56.69, pPage->GetPageSize().GetHeight() -
56.69, "Hello World!" );
pPage_2 = document.CreatePage( PdfPage::CreateStandardPageSize(
ePdfPageSize_A4 ) );
/* next line causes the error (pPage is broken)*/
painter.DrawText( 56.69, pPage->GetPageSize().GetHeight() -
156.69, "Hello Again!" );
painter.FinishPage();
document.Close();
} catch ( const PdfError & e ) {
try {
painter.FinishPage();
} catch( ... ) {
}
throw e;
}
}
Hope this helps,
Bogdan P.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, November 05, 2009 8:40 PM
To: [email protected]
Cc: Bogdan PANUS
Subject: Re: [Podofo-users] PagesTree Bug
Hi,
Which version of PoDoFo do you use? Current trunk or 0.7.0?
Best regards,
Dom
Am Donnerstag, 5. November 2009 schrieb Bogdan PANUS:
> Hi there,
>
>
>
> While trying to create a multipage pdf document, with the possibility
> to write on any page at any moment, I got some problems. When creating
> a new page, I got errors accessing some of the previously created
> ones. By studying a little the library I resolved my problem in this way:
>
>
>
> PdfPagesTree.cpp
>
>
>
> 170 //InsertPage( this->GetTotalNumberOfPages() - 1, pPage );
>
> 170 InsertPage( this->GetTotalNumberOfPages() , pPage );
>
>
>
> The first version was causing PdfPagesTreeCache.cpp to set NULL over
> existing data in line:
>
>
>
> 79 m_deqPageObjs.insert( m_deqPageObjs.begin() + nIndex, NULL );
>
>
>
> Can anybody confirm if this is the best fix for the bug?
>
>
>
> Thanks
>
> Bogdan P.
--
**********************************************************************
Dominik Seichter - [email protected]
KRename - http://www.krename.net - Powerful batch renamer for KDE KBarcode -
http://www.kbarcode.net - Barcode and label printing PoDoFo -
http://podofo.sf.net - PDF generation and parsing library SchafKopf -
http://schafkopf.berlios.de - Schafkopf, a card game, for KDE Alan -
http://alan.sf.net - A Turing Machine in Java
**********************************************************************
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.425 / Virus Database: 270.14.52/2483 - Release Date: 11/05/09
19:52:00
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users