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 create_group<F>(
&'a self,
predicate: F,
) -> Result<PdfPageGroupObject<'a>, PdfiumError>
pub fn create_group<F>( &'a self, predicate: F, ) -> Result<PdfPageGroupObject<'a>, PdfiumError>
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 collection. The newly created group will be empty; you will need to manually add to it the objects you want to manipulate.
Sourcepub fn copy_into_x_object_form_object(
&self,
destination: &mut PdfDocument<'a>,
) -> Result<PdfPageObject<'a>, PdfiumError>
pub fn copy_into_x_object_form_object( &self, destination: &mut PdfDocument<'a>, ) -> Result<PdfPageObject<'a>, PdfiumError>
Creates a new PdfPageXObjectFormObject object from the page objects on this PdfPage, ready to use in the given destination PdfDocument.
Sourcepub fn insert_object_at_index(
&mut self,
index: PdfPageObjectIndex,
object: PdfPageObject<'a>,
) -> Result<PdfPageObject<'a>, PdfiumError>
pub fn insert_object_at_index( &mut self, index: PdfPageObjectIndex, object: PdfPageObject<'a>, ) -> Result<PdfPageObject<'a>, PdfiumError>
Adds the given PdfPageObject to this page objects collection, inserting it into the collection at the given index. The object’s memory ownership will be transferred to the PdfPage containing this page objects collection, and the updated page object will be returned.
If the containing PdfPage has a content regeneration strategy of [PdfPageContentRegenerationStrategy::AutomaticOnEveryChange] then content regeneration will be triggered on the page.
Auto Trait Implementations§
impl<'a> Freeze for PdfPageObjects<'a>
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<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
Source§fn create_text_object(
&mut self,
x: PdfPoints,
y: PdfPoints,
text: impl ToString,
font: impl ToPdfFontToken,
font_size: PdfPoints,
) -> Result<PdfPageObject<'a>, PdfiumError>
fn create_text_object( &mut self, x: PdfPoints, y: PdfPoints, text: impl ToString, font: impl ToPdfFontToken, 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>
Source§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>
Source§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.