From 744da70149c450d2f387a1fa325a3074ac2edb0c Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 15 Mar 2016 12:43:09 -0700 Subject: FPDF_PageDelete must delete XFA pages as well. Currently, it is only deleting the CPDF_ resources, which are wrapped by XFA objects in an XFA build. Hence, if a page is deleted and then re-inserted, we get the old contents. In print preview, chromium first inserts blank pages and then replaces them later on, causing the associated bug. BUG=594111 R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1804163002 . --- fpdfsdk/fpdfeditpage.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'fpdfsdk/fpdfeditpage.cpp') diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index e10f3825af..493329c360 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -57,11 +57,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() { } DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { - CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); - if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount()) - return; - - pDoc->DeletePage(page_index); + if (UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document)) + pDoc->DeletePage(page_index); } DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, -- cgit v1.2.3