Wraps FPDFFormObj_CountObjects + FPDFFormObj_GetObject to
enumerate the page objects contained in a Form XObject. The
returned objects participate in the regular pdfium_obj API -
you can call pdf_obj_type(), pdf_obj_bounds(),
pdf_obj_matrix(), and (per object type)
pdf_path_segments() / pdf_image_info() / pdf_text_content()
on each one. Nesting is recursive: a Form XObject may itself
contain other Form XObjects, and the returned pdfium_objs of
type "form" can be passed back into pdf_form_objects().
Arguments
- form
A
pdfium_objof type"form", typically obtained by filteringpdf_page_objects()(or anotherpdf_form_objects()call) ontype == "form".
Details
Each returned object carries a parent_form slot pointing back
at form, used by the print/format methods to show the
containment path ("obj 2 of form 1 on page 1"). Lifetime is
bound to the parent page, not to the form: as long as the page
is open, the form and its nested objects remain valid.
See also
pdf_page_objects() for the top-level enumeration,
pdf_obj_matrix() for the form's own transformation matrix.
Examples
fixture <- system.file("extdata", "fixtures", "form_xobject.pdf",
package = "pdfium"
)
if (nzchar(fixture)) {
doc <- pdf_doc_open(fixture)
page <- pdf_page_load(doc, 1L)
forms <- Filter(function(o) o$type == "form", pdf_page_objects(page))
if (length(forms) > 0L) {
nested <- pdf_form_objects(forms[[1L]])
length(nested)
}
pdf_page_close(page)
pdf_doc_close(doc)
}