Struct pdfium_render::page_objects::PdfPageObjects
source · pub struct PdfPageObjects<'a> { /* private fields */ }Expand description
The page objects contained within a single PdfPage.
Content on a page is structured as a stream of PdfPageObject objects of different types: text objects, image objects, path objects, and so on.
Note that Pdfium does not support or recognize all PDF page object types. For instance,
Pdfium does not currently support or recognize the External Object (“XObject”) page object type
supported by Adobe Acrobat and Foxit’s commercial PDF SDK. In these cases, Pdfium will return
PdfPageObjectType::Unsupported.
Implementations§
source§impl<'a> PdfPageObjects<'a>
impl<'a> PdfPageObjects<'a>
sourcepub fn take_object_from_page(
&mut self,
source: &mut PdfPage<'_>,
source_page_object_index: PdfPageObjectIndex
) -> Result<(), PdfiumError>
pub fn take_object_from_page(
&mut self,
source: &mut PdfPage<'_>,
source_page_object_index: PdfPageObjectIndex
) -> Result<(), PdfiumError>
Removes a single page object with the given source page object index from the given source PdfPage, adding the object to the end of this PdfPageObjects collection.
If the containing PdfPage has a content regeneration strategy of
PdfPageContentRegenerationStrategy::AutomaticOnEveryChange then content regeneration
will be triggered on the page.
Likewise, if the given source PdfPage has a content regeneration strategy of
PdfPageContentRegenerationStrategy::AutomaticOnEveryChange then content regeneration
will be triggered on the source page.
sourcepub fn take_object_range_from_page(
&mut self,
source: &mut PdfPage<'_>,
source_page_object_range: RangeInclusive<PdfPageObjectIndex>
) -> Result<(), PdfiumError>
pub fn take_object_range_from_page(
&mut self,
source: &mut PdfPage<'_>,
source_page_object_range: RangeInclusive<PdfPageObjectIndex>
) -> Result<(), PdfiumError>
Removes one or more page objects with the given range of indices from the given source PdfPage, adding the objects sequentially to the end of this PdfPageObjects collection.
If the containing PdfPage has a content regeneration strategy of
PdfPageContentRegenerationStrategy::AutomaticOnEveryChange then content regeneration
will be triggered on the page.
Likewise, if the given source PdfPage has a content regeneration strategy of
PdfPageContentRegenerationStrategy::AutomaticOnEveryChange then content regeneration
will be triggered on the source page.
sourcepub fn take_all(&mut self, source: &mut PdfPage<'_>) -> Result<(), PdfiumError>
pub fn take_all(&mut self, source: &mut PdfPage<'_>) -> Result<(), PdfiumError>
Moves all page objects in the given PdfPage into this PdfPageObjects collection, appending them to the end of this PdfPageObjects collection. The given PdfPage will be drained of all page objects once this operation is completed.
If the containing PdfPage has a content regeneration strategy of
PdfPageContentRegenerationStrategy::AutomaticOnEveryChange then content regeneration
will be triggered on the page.
Likewise, if the given source PdfPage has a content regeneration strategy of
PdfPageContentRegenerationStrategy::AutomaticOnEveryChange then content regeneration
will be triggered on the source page.
sourcepub fn create_group<F>(
&'a self,
predicate: F
) -> Result<PdfPageGroupObject<'a>, PdfiumError>where
F: Fn(&PdfPageObject<'_>) -> bool,
pub fn create_group<F>(
&'a self,
predicate: F
) -> Result<PdfPageGroupObject<'a>, PdfiumError>where
F: Fn(&PdfPageObject<'_>) -> bool,
Creates a new PdfPageGroupObject object group that includes any page objects in this PdfPageObjects collection matching the given predicate function.
sourcepub fn create_empty_group(&self) -> PdfPageGroupObject<'a>
pub fn create_empty_group(&self) -> PdfPageGroupObject<'a>
Creates a new PdfPageGroupObject object group that can accept any PdfPageObject in this PdfPageObjects. The newly created group will be empty; you will need to manually add to it the objects you want to manipulate.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for PdfPageObjects<'a>
impl<'a> !Send for PdfPageObjects<'a>
impl<'a> !Sync for PdfPageObjects<'a>
impl<'a> Unpin for PdfPageObjects<'a>
impl<'a> !UnwindSafe for PdfPageObjects<'a>
Blanket Implementations§
source§impl<'a, T> PdfPageObjectsCommon<'a> for Twhere
T: PdfPageObjectsPrivate<'a>,
impl<'a, T> PdfPageObjectsCommon<'a> for Twhere
T: PdfPageObjectsPrivate<'a>,
source§fn get(&self, index: usize) -> Result<PdfPageObject<'a>, PdfiumError>
fn get(&self, index: usize) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn iter(&'a self) -> PdfPageObjectsIterator<'a> ⓘ
fn iter(&'a self) -> PdfPageObjectsIterator<'a> ⓘ
source§fn add_object(
&mut self,
object: PdfPageObject<'a>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn add_object(
&mut self,
object: PdfPageObject<'a>
) -> Result<PdfPageObject<'a>, PdfiumError>
PdfPage containing this page objects
collection, and the updated page object will be returned. Read moresource§fn create_text_object(
&mut self,
x: PdfPoints,
y: PdfPoints,
text: impl ToString,
font: &PdfFont<'_>,
font_size: PdfPoints
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_text_object(
&mut self,
x: PdfPoints,
y: PdfPoints,
text: impl ToString,
font: &PdfFont<'_>,
font_size: PdfPoints
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_line(
&mut self,
x1: PdfPoints,
y1: PdfPoints,
x2: PdfPoints,
y2: PdfPoints,
stroke_color: PdfColor,
stroke_width: PdfPoints
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_line(
&mut self,
x1: PdfPoints,
y1: PdfPoints,
x2: PdfPoints,
y2: PdfPoints,
stroke_color: PdfColor,
stroke_width: PdfPoints
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_bezier(
&mut self,
x1: PdfPoints,
y1: PdfPoints,
x2: PdfPoints,
y2: PdfPoints,
control1_x: PdfPoints,
control1_y: PdfPoints,
control2_x: PdfPoints,
control2_y: PdfPoints,
stroke_color: PdfColor,
stroke_width: PdfPoints
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_bezier(
&mut self,
x1: PdfPoints,
y1: PdfPoints,
x2: PdfPoints,
y2: PdfPoints,
control1_x: PdfPoints,
control1_y: PdfPoints,
control2_x: PdfPoints,
control2_y: PdfPoints,
stroke_color: PdfColor,
stroke_width: PdfPoints
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_rect(
&mut self,
rect: PdfRect,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_rect(
&mut self,
rect: PdfRect,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_circle(
&mut self,
rect: PdfRect,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_circle(
&mut self,
rect: PdfRect,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_circle_at(
&mut self,
center_x: PdfPoints,
center_y: PdfPoints,
radius: PdfPoints,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_circle_at(
&mut self,
center_x: PdfPoints,
center_y: PdfPoints,
radius: PdfPoints,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_ellipse(
&mut self,
rect: PdfRect,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_ellipse(
&mut self,
rect: PdfRect,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_path_object_ellipse_at(
&mut self,
center_x: PdfPoints,
center_y: PdfPoints,
x_radius: PdfPoints,
y_radius: PdfPoints,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_path_object_ellipse_at(
&mut self,
center_x: PdfPoints,
center_y: PdfPoints,
x_radius: PdfPoints,
y_radius: PdfPoints,
stroke_color: Option<PdfColor>,
stroke_width: Option<PdfPoints>,
fill_color: Option<PdfColor>
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn create_image_object(
&mut self,
x: PdfPoints,
y: PdfPoints,
image: &DynamicImage,
width: Option<PdfPoints>,
height: Option<PdfPoints>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_image_object(
&mut self,
x: PdfPoints,
y: PdfPoints,
image: &DynamicImage,
width: Option<PdfPoints>,
height: Option<PdfPoints>
) -> Result<PdfPageObject<'a>, PdfiumError>
source§fn remove_object(
&mut self,
object: PdfPageObject<'a>
) -> Result<PdfPageObject<'a>, PdfiumError>
fn remove_object(
&mut self,
object: PdfPageObject<'a>
) -> Result<PdfPageObject<'a>, PdfiumError>
PdfPage containing this page objects
collection, and the updated page object will be returned. It can be added back to a
page objects collection or dropped, at which point the memory owned by the object will
be freed. Read moresource§fn remove_object_at_index(
&mut self,
index: usize
) -> Result<PdfPageObject<'a>, PdfiumError>
fn remove_object_at_index(
&mut self,
index: usize
) -> Result<PdfPageObject<'a>, PdfiumError>
PdfPage containing this page objects
collection, and the updated page object will be returned. It can be added back into a
page objects collection or discarded, at which point the memory owned by the object will
be freed. Read moresource§fn as_range(&self) -> Range<PdfPageObjectIndex>
fn as_range(&self) -> Range<PdfPageObjectIndex>
0..(number of objects) for this page objects collection.source§fn as_range_inclusive(&self) -> RangeInclusive<PdfPageObjectIndex>
fn as_range_inclusive(&self) -> RangeInclusive<PdfPageObjectIndex>
0..=(number of objects - 1) for this page objects collection.