pub struct PageObjectCtx<'doc> { /* private fields */ }Expand description
Immutable context for accessing page objects on a single page.
Obtained via EditDocument::page_objects().
This type exists solely to provide correctly-namespaced ADR-019 T2 aliases
for FPDFPage_* object functions, which otherwise collide with the
FPDFAnnot_* aliases of the same snake_case name on EditDocument.
§Example
let ctx = doc.page_objects(0);
let count = ctx.count_objects().unwrap();
let bytes = ctx.get_object(0).unwrap();Implementations§
Source§impl<'doc> PageObjectCtx<'doc>
impl<'doc> PageObjectCtx<'doc>
Sourcepub fn get_object(&self, index: usize) -> Result<Vec<u8>, EditError>
pub fn get_object(&self, index: usize) -> Result<Vec<u8>, EditError>
Returns a copy of the raw content bytes for the page object at index.
Each object inserted via EditDocument::insert_page_object() is
serialised as a q … Q (graphic-state save/restore) block. This
method returns the bytes of the block at position index.
Returns EditError::InvalidObjectIndex if index is out of bounds.
ADR-019 T2 alias for FPDFPage_GetObject. Namespaced here to avoid
collision with the FPDFAnnot_GetObject alias on EditDocument.
See also AnnotObjectCtx::get_object() for the annotation side.
Sourcepub fn count_objects(&self) -> Result<usize, EditError>
pub fn count_objects(&self) -> Result<usize, EditError>
Returns the number of page objects on this page.
ADR-019 T2 alias for FPDFPage_CountObjects.