Revert "Revert "Add type cast definitions for CPDF_Dictionary.""
[pdfium.git] / fpdfsdk / src / fpdf_ext.cpp
index 2d84ff2..c0391df 100644 (file)
@@ -183,10 +183,11 @@ void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code) {
 }
 
 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
-  if (!document)
+  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+  if (!pDoc)
     return PAGEMODE_UNKNOWN;
 
-  CPDF_Dictionary* pRoot = ((CPDF_Document*)document)->GetRoot();
+  CPDF_Dictionary* pRoot = pDoc->GetRoot();
   if (!pRoot)
     return PAGEMODE_UNKNOWN;