donald7771 / pdfium

Automatically exported from code.google.com/p/pdfium
0 stars 0 forks source link

Document page count incorrect after deleting a page. #68

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have code that opens a document, deletes some pages, and then closes the 
document. Sometimes (cannot reproduce reliably) after deleting a page (not the 
last one) I am getting that the document has no pages while it should have some.

I am attaching the PDF file for which this happened. As you can see it has 
eight pages and after removing a page we get that the page count is zero.

page count: 8 removing page index: 7
page count: 0 removing page index: 4 <- page count should be 7 not 0

The code I use to delete a page is:

static jint nativeRemovePage(JNIEnv* env, jclass thiz, jlong documentPtr, jint 
pageIndex) {
    FPDF_DOCUMENT document = reinterpret_cast<FPDF_DOCUMENT>(documentPtr);
    FPDFPage_Delete(document, pageIndex);
    return FPDF_GetPageCount(document);
}

This is on Android.

Original issue reported on code.google.com by svetosla...@google.com on 29 Oct 2014 at 9:37

Attachments: