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"). Its lifetime is
bound to the form handle: the nested objects are refused, like
form itself, once form's page or document is closed, once the
annotation whose appearance stream holds form
(pdf_annot_objects()) is deleted, and once form is deleted with
pdf_obj_delete(), removed from its own form with
pdf_form_obj_remove_object() or moved into an annotation with
pdf_annot_append_object(). After such a move, read the objects
again through pdf_annot_objects() and then pdf_form_objects().
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)
}