summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/Document.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 733384a154..c49524d02f 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1383,8 +1383,8 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
int nWords = 0;
CFX_WideString swRet;
for (auto& pPageObj : *page.GetPageObjectList()) {
- if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
- CPDF_TextObject* pTextObj = static_cast<CPDF_TextObject*>(pPageObj.get());
+ if (pPageObj->IsText()) {
+ CPDF_TextObject* pTextObj = pPageObj->AsText();
int nObjWords = CountWords(pTextObj);
if (nWords + nObjWords >= nWordNo) {
swRet = GetObjWordStr(pTextObj, nWordNo - nWords);
@@ -1438,8 +1438,8 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
int nWords = 0;
for (auto& pPageObj : *page.GetPageObjectList()) {
- if (pPageObj->m_Type == CPDF_PageObject::TEXT)
- nWords += CountWords(static_cast<CPDF_TextObject*>(pPageObj.get()));
+ if (pPageObj->IsText())
+ nWords += CountWords(pPageObj->AsText());
}
vRet = nWords;