summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_editpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_editpage.cpp')
-rw-r--r--fpdfsdk/fpdf_editpage.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 8a1200885a..4151de5dfd 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -751,3 +751,24 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
pPageObj->SetDirty(true);
return true;
}
+
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFFormObj_CountObjects(FPDF_PAGEOBJECT page_object) {
+ auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
+ if (!pPageObj)
+ return -1;
+
+ CPDF_FormObject* pFormObject = pPageObj->AsForm();
+ if (!pFormObject)
+ return -1;
+
+ const CPDF_Form* pForm = pFormObject->form();
+ if (!pForm)
+ return -1;
+
+ const CPDF_PageObjectList* pObjectList = pForm->GetPageObjectList();
+ if (!pObjectList)
+ return -1;
+
+ return pObjectList->size();
+}