I'm trying to create a pdf document with multiple pages, and render text to each page with PoDoFo::PdfPainter::DrawText(). The text is only rendered once, text on subsequent pages isn't rendered. I can write to first page, then text isn't rendered on second. If however I would write to second page, not to first page, the text is rendered on second ok. Images rendered to a page with DrawImage() are rendered to each page ok. Am I doing something wrong?
PdfMemDocument document;
PdfPainter painter;
PdfFont* font = document.GetFonts().SearchFont("Arial");
auto& page1 = document.GetPages().CreatePage(PdfPageSize::A4);
painter.SetCanvas(page1);
painter.TextState.SetFont(*font, 12);
painter.DrawText("hello", 20, page1.GetRect().Height - 80); //if i comment this
//line, text is written
//to second page ok
painter.FinishDrawing();
auto& page2 = document.GetPages().CreatePage(PdfPageSize::A4);
painter.SetCanvas(page2);
painter.TextState.SetFont(*font, 12);
painter.DrawText("hello again", 20, page2.GetRect().Height - 80);
painter.FinishDrawing();
document.Save("test.pdf");