Enum pdfium_render::page_object::PdfPageObject
source · pub enum PdfPageObject<'a> {
Text(PdfPageTextObject<'a>),
Path(PdfPagePathObject<'a>),
Image(PdfPageImageObject<'a>),
Shading(PdfPageShadingObject<'a>),
FormFragment(PdfPageFormFragmentObject<'a>),
Unsupported(PdfPageUnsupportedObject<'a>),
}Expand description
A single object on a PdfPage.
Variants§
Text(PdfPageTextObject<'a>)
Path(PdfPagePathObject<'a>)
Image(PdfPageImageObject<'a>)
Shading(PdfPageShadingObject<'a>)
FormFragment(PdfPageFormFragmentObject<'a>)
Unsupported(PdfPageUnsupportedObject<'a>)
Common properties shared by all PdfPageObject types can still be accessed for page objects not recognized by Pdfium, but object-specific functionality will be unavailable.
Implementations§
source§impl<'a> PdfPageObject<'a>
impl<'a> PdfPageObject<'a>
sourcepub fn object_type(&self) -> PdfPageObjectType
pub fn object_type(&self) -> PdfPageObjectType
The object type of this PdfPageObject.
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.
sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Returns true if this PdfPageObject has an object type other than PdfPageObjectType::Unsupported.
The PdfPageObject::as_text_object(), PdfPageObject::as_path_object(), PdfPageObject::as_image_object(), PdfPageObject::as_shading_object(), and PdfPageObject::as_form_fragment_object() functions can be used to access properties and functions pertaining to a specific page object type.
sourcepub fn is_unsupported(&self) -> bool
pub fn is_unsupported(&self) -> bool
Returns true if this PdfPageObject has an object type of PdfPageObjectType::Unsupported.
Common properties shared by all PdfPageObject types can still be accessed for page objects not recognized by Pdfium, but object-specific functionality will be unavailable.
sourcepub fn as_text_object(&self) -> Option<&PdfPageTextObject<'_>>
pub fn as_text_object(&self) -> Option<&PdfPageTextObject<'_>>
Returns an immutable reference to the underlying PdfPageTextObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Text.
sourcepub fn as_text_object_mut(&mut self) -> Option<&mut PdfPageTextObject<'a>>
pub fn as_text_object_mut(&mut self) -> Option<&mut PdfPageTextObject<'a>>
Returns a mutable reference to the underlying PdfPageTextObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Text.
sourcepub fn as_path_object(&self) -> Option<&PdfPagePathObject<'_>>
pub fn as_path_object(&self) -> Option<&PdfPagePathObject<'_>>
Returns an immutable reference to the underlying PdfPagePathObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Path.
sourcepub fn as_path_object_mut(&mut self) -> Option<&mut PdfPagePathObject<'a>>
pub fn as_path_object_mut(&mut self) -> Option<&mut PdfPagePathObject<'a>>
Returns a mutable reference to the underlying PdfPagePathObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Path.
sourcepub fn as_image_object(&self) -> Option<&PdfPageImageObject<'_>>
pub fn as_image_object(&self) -> Option<&PdfPageImageObject<'_>>
Returns an immutable reference to the underlying PdfPageImageObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Image.
sourcepub fn as_image_object_mut(&mut self) -> Option<&mut PdfPageImageObject<'a>>
pub fn as_image_object_mut(&mut self) -> Option<&mut PdfPageImageObject<'a>>
Returns a mutable reference to the underlying PdfPageImageObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Image.
sourcepub fn as_shading_object(&self) -> Option<&PdfPageShadingObject<'_>>
pub fn as_shading_object(&self) -> Option<&PdfPageShadingObject<'_>>
Returns an immutable reference to the underlying PdfPageShadingObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Shading.
sourcepub fn as_shading_object_mut(&mut self) -> Option<&mut PdfPageShadingObject<'a>>
pub fn as_shading_object_mut(&mut self) -> Option<&mut PdfPageShadingObject<'a>>
Returns a mutable reference to the underlying PdfPageShadingObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::Shading.
sourcepub fn as_form_fragment_object(&self) -> Option<&PdfPageFormFragmentObject<'_>>
pub fn as_form_fragment_object(&self) -> Option<&PdfPageFormFragmentObject<'_>>
Returns an immutable reference to the underlying PdfPageFormFragmentObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::FormFragment.
sourcepub fn as_form_fragment_object_mut(
&mut self
) -> Option<&mut PdfPageFormFragmentObject<'a>>
pub fn as_form_fragment_object_mut(
&mut self
) -> Option<&mut PdfPageFormFragmentObject<'a>>
Returns a mutable reference to the underlying PdfPageFormFragmentObject for this PdfPageObject, if this page object has an object type of PdfPageObjectType::FormFragment.
Trait Implementations§
source§impl<'a> Drop for PdfPageObject<'a>
impl<'a> Drop for PdfPageObject<'a>
source§fn drop(&mut self)
fn drop(&mut self)
Closes this PdfPageObject, releasing held memory.
source§impl<'a> From<PdfPageFormFragmentObject<'a>> for PdfPageObject<'a>
impl<'a> From<PdfPageFormFragmentObject<'a>> for PdfPageObject<'a>
source§fn from(object: PdfPageFormFragmentObject<'a>) -> Self
fn from(object: PdfPageFormFragmentObject<'a>) -> Self
source§impl<'a> From<PdfPageImageObject<'a>> for PdfPageObject<'a>
impl<'a> From<PdfPageImageObject<'a>> for PdfPageObject<'a>
source§fn from(object: PdfPageImageObject<'a>) -> Self
fn from(object: PdfPageImageObject<'a>) -> Self
source§impl<'a> From<PdfPagePathObject<'a>> for PdfPageObject<'a>
impl<'a> From<PdfPagePathObject<'a>> for PdfPageObject<'a>
source§fn from(object: PdfPagePathObject<'a>) -> Self
fn from(object: PdfPagePathObject<'a>) -> Self
source§impl<'a> From<PdfPageShadingObject<'a>> for PdfPageObject<'a>
impl<'a> From<PdfPageShadingObject<'a>> for PdfPageObject<'a>
source§fn from(object: PdfPageShadingObject<'a>) -> Self
fn from(object: PdfPageShadingObject<'a>) -> Self
source§impl<'a> From<PdfPageTextObject<'a>> for PdfPageObject<'a>
impl<'a> From<PdfPageTextObject<'a>> for PdfPageObject<'a>
source§fn from(object: PdfPageTextObject<'a>) -> Self
fn from(object: PdfPageTextObject<'a>) -> Self
source§impl<'a> From<PdfPageUnsupportedObject<'a>> for PdfPageObject<'a>
impl<'a> From<PdfPageUnsupportedObject<'a>> for PdfPageObject<'a>
source§fn from(object: PdfPageUnsupportedObject<'a>) -> Self
fn from(object: PdfPageUnsupportedObject<'a>) -> Self
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for PdfPageObject<'a>
impl<'a> !Send for PdfPageObject<'a>
impl<'a> !Sync for PdfPageObject<'a>
impl<'a> Unpin for PdfPageObject<'a>
impl<'a> !UnwindSafe for PdfPageObject<'a>
Blanket Implementations§
source§impl<'a, T> PdfPageObjectCommon<'a> for Twhere
T: PdfPageObjectPrivate<'a>,
impl<'a, T> PdfPageObjectCommon<'a> for Twhere
T: PdfPageObjectPrivate<'a>,
source§fn has_transparency(&self) -> bool
fn has_transparency(&self) -> bool
true if this PdfPageObject contains transparency.source§fn bounds(&self) -> Result<PdfRect, PdfiumError>
fn bounds(&self) -> Result<PdfRect, PdfiumError>
source§fn transform(
&mut self,
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64
) -> Result<(), PdfiumError>
fn transform(
&mut self,
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64
) -> Result<(), PdfiumError>
source§fn transform_from(
&mut self,
other: &PdfPageObject<'_>
) -> Result<(), PdfiumError>
fn transform_from(
&mut self,
other: &PdfPageObject<'_>
) -> Result<(), PdfiumError>
source§fn get_horizontal_translation(&self) -> PdfPoints
fn get_horizontal_translation(&self) -> PdfPoints
source§fn get_vertical_translation(&self) -> PdfPoints
fn get_vertical_translation(&self) -> PdfPoints
source§fn get_horizontal_scale(&self) -> f64
fn get_horizontal_scale(&self) -> f64
source§fn get_vertical_scale(&self) -> f64
fn get_vertical_scale(&self) -> f64
source§fn get_rotation_counter_clockwise_radians(&self) -> f32
fn get_rotation_counter_clockwise_radians(&self) -> f32
source§fn get_x_axis_skew_radians(&self) -> f32
fn get_x_axis_skew_radians(&self) -> f32
source§fn get_y_axis_skew_radians(&self) -> f32
fn get_y_axis_skew_radians(&self) -> f32
source§fn set_blend_mode(
&mut self,
blend_mode: PdfPageObjectBlendMode
) -> Result<(), PdfiumError>
fn set_blend_mode(
&mut self,
blend_mode: PdfPageObjectBlendMode
) -> Result<(), PdfiumError>
source§fn fill_color(&self) -> Result<PdfColor, PdfiumError>
fn fill_color(&self) -> Result<PdfColor, PdfiumError>
source§fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>
fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>
source§fn stroke_color(&self) -> Result<PdfColor, PdfiumError>
fn stroke_color(&self) -> Result<PdfColor, PdfiumError>
source§fn set_stroke_color(&mut self, stroke_color: PdfColor) -> Result<(), PdfiumError>
fn set_stroke_color(&mut self, stroke_color: PdfColor) -> Result<(), PdfiumError>
source§fn stroke_width(&self) -> Result<PdfPoints, PdfiumError>
fn stroke_width(&self) -> Result<PdfPoints, PdfiumError>
source§fn set_stroke_width(
&mut self,
stroke_width: PdfPoints
) -> Result<(), PdfiumError>
fn set_stroke_width(
&mut self,
stroke_width: PdfPoints
) -> Result<(), PdfiumError>
source§fn line_join(&self) -> Result<PdfPageObjectLineJoin, PdfiumError>
fn line_join(&self) -> Result<PdfPageObjectLineJoin, PdfiumError>
source§fn set_line_join(
&mut self,
line_join: PdfPageObjectLineJoin
) -> Result<(), PdfiumError>
fn set_line_join(
&mut self,
line_join: PdfPageObjectLineJoin
) -> Result<(), PdfiumError>
source§fn line_cap(&self) -> Result<PdfPageObjectLineCap, PdfiumError>
fn line_cap(&self) -> Result<PdfPageObjectLineCap, PdfiumError>
source§fn set_line_cap(
&mut self,
line_cap: PdfPageObjectLineCap
) -> Result<(), PdfiumError>
fn set_line_cap(
&mut self,
line_cap: PdfPageObjectLineCap
) -> Result<(), PdfiumError>
source§fn is_copyable(&self) -> bool
fn is_copyable(&self) -> bool
true if this PdfPageObject can be successfully copied by calling its
try_copy() function. Read moresource§fn try_copy<'b>(
&self,
document: &PdfDocument<'b>
) -> Result<PdfPageObject<'b>, PdfiumError>
fn try_copy<'b>(
&self,
document: &PdfDocument<'b>
) -> Result<PdfPageObject<'b>, PdfiumError>
source§fn width(&self) -> Result<PdfPoints, PdfiumError>
fn width(&self) -> Result<PdfPoints, PdfiumError>
source§fn height(&self) -> Result<PdfPoints, PdfiumError>
fn height(&self) -> Result<PdfPoints, PdfiumError>
source§fn is_inside_rect(&self, rect: &PdfRect) -> bool
fn is_inside_rect(&self, rect: &PdfRect) -> bool
true if the bounds of this PdfPageObject lie entirely within the given rectangle.source§fn does_overlap_rect(&self, rect: &PdfRect) -> bool
fn does_overlap_rect(&self, rect: &PdfRect) -> bool
true if the bounds of this PdfPageObject lie at least partially within
the given rectangle.