On 23 February 2018 at 19:27, Francesco Pretto <cez...@gmail.com> wrote:
> I tested it with following code:
>

Oops...a missing fragment in the test code. Here it again complete:

    PdfMemDocument document;
    PdfRect rect;

    auto pageA = document.InsertPage(rect, 0);
    auto pageB = document.InsertPage(rect, 0);
    auto pageC = document.InsertPage(rect, 2);

    // PageNumber is 1-based index
    assert(pageA->GetPageNumber() == 2);
    assert(pageB->GetPageNumber() == 1);
    assert(pageC->GetPageNumber() == 3);

    // Insert ouf of bounds
    auto page = document.InsertPage(rect, -1);
    assert(page->GetPageNumber() == 1);
    int pageCount = document.GetPageCount();
    page = document.InsertPage(rect, pageCount + 1);
    assert(page->GetPageNumber() == pageCount + 1);

    // Insert in the middle
    page = document.InsertPage(rect, 2);
    assert(page->GetPageNumber() == 3);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to