Index: fpdfsdk/fpdfview.cpp |
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp |
index c5b13f850d42e343342c1de9ae495de1af523122..fa8f271fc486d6be12b4a6c5cef9dacced645aa4 100644 |
--- a/fpdfsdk/fpdfview.cpp |
+++ b/fpdfsdk/fpdfview.cpp |
@@ -524,7 +524,14 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) { |
DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) { |
UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); |
- return pDoc ? pDoc->GetPageCount() : 0; |
+ if (!pDoc) |
+ return 0; |
+ |
+#ifdef PDF_ENABLE_XFA |
+ return pDoc->GetXFAPageCount(); |
+#else // PDF_ENABLE_XFA |
+ return pDoc->GetPageCount(); |
+#endif // PDF_ENABLE_XFA |
} |
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, |
@@ -533,12 +540,14 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, |
if (!pDoc) |
return nullptr; |
- if (page_index < 0 || page_index >= pDoc->GetPageCount()) |
- return nullptr; |
- |
#ifdef PDF_ENABLE_XFA |
+ if (page_index < 0 || page_index >= pDoc->GetXFAPageCount()) |
+ return nullptr; |
return pDoc->GetXFAPage(page_index); |
#else // PDF_ENABLE_XFA |
+ if (page_index < 0 || page_index >= pDoc->GetPageCount()) |
+ return nullptr; |
+ |
CPDF_Dictionary* pDict = pDoc->GetPage(page_index); |
if (!pDict) |
return nullptr; |
@@ -917,7 +926,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, |
return FALSE; |
#ifdef PDF_ENABLE_XFA |
- int count = pDoc->GetPageCount(); |
+ int count = pDoc->GetXFAPageCount(); |
if (page_index < 0 || page_index >= count) |
return FALSE; |
CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index); |