Search code examples
pdflib

PDFlib - editing a page that's been ended/closed


How can I revisit a page in PDFlib that's been closed using $p->end_page_ext(""); at a later stage to continue adding elements to it?

I other words, once a page is terminated by $p->end_page_ext("");, is it possible to recall it to add more elements?


Solution

  • you can do this with $p->suspend_page()/$p->resume_page().

    You find a sample in the PDFlib cookbook.

    $p->show_xy("Page 2", $x, $y);
    
    /* Suspend page 2 to resume it later */
    $p->suspend_page("");
    ...
    /* Revisit page 2 */
    $p->resume_page("pagenumber 2");
    

    (see PDFlib 9.2 API reference, chapter 3.3 "Page Functions" for details.)