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>

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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>

source§

fn drop(&mut self)

Closes this PdfPageObject, releasing held memory.

source§

impl<'a> From<PdfPageFormFragmentObject<'a>> for PdfPageObject<'a>

source§

fn from(object: PdfPageFormFragmentObject<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<PdfPageImageObject<'a>> for PdfPageObject<'a>

source§

fn from(object: PdfPageImageObject<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<PdfPagePathObject<'a>> for PdfPageObject<'a>

source§

fn from(object: PdfPagePathObject<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<PdfPageShadingObject<'a>> for PdfPageObject<'a>

source§

fn from(object: PdfPageShadingObject<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<PdfPageTextObject<'a>> for PdfPageObject<'a>

source§

fn from(object: PdfPageTextObject<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<PdfPageUnsupportedObject<'a>> for PdfPageObject<'a>

source§

fn from(object: PdfPageUnsupportedObject<'a>) -> Self

Converts to this type from the input type.

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<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<'a, T> PdfPageObjectCommon<'a> for Twhere
    T: PdfPageObjectPrivate<'a>,

source§

fn has_transparency(&self) -> bool

Returns true if this PdfPageObject contains transparency.
source§

fn bounds(&self) -> Result<PdfRect, PdfiumError>

Returns the bounding box of this PdfPageObject. Read more
source§

fn transform(
    &mut self,
    a: f64,
    b: f64,
    c: f64,
    d: f64,
    e: f64,
    f: f64
) -> Result<(), PdfiumError>

Applies the given transformation, expressed as six values representing the six configurable elements of a nine-element 3x3 PDF transformation matrix, to this PdfPageObject. Read more
source§

fn transform_from(
    &mut self,
    other: &PdfPageObject<'_>
) -> Result<(), PdfiumError>

Transforms this PdfPageObject by applying the transformation matrix read from the given PdfPageObject. Read more
source§

fn get_horizontal_translation(&self) -> PdfPoints

Returns the current horizontal translation of the origin of this PdfPageObject.
source§

fn get_vertical_translation(&self) -> PdfPoints

Returns the current vertical translation of the origin of this PdfPageObject.
source§

fn get_horizontal_scale(&self) -> f64

Returns the current horizontal scale factor applied to this PdfPageObject.
source§

fn get_vertical_scale(&self) -> f64

Returns the current vertical scale factor applied to this PdfPageObject.
source§

fn get_rotation_counter_clockwise_radians(&self) -> f32

Returns the counter-clockwise rotation applied to this PdfPageObject, in radians. Read more
source§

fn get_x_axis_skew_radians(&self) -> f32

Returns the current x axis skew applied to this PdfPageObject, in radians. Read more
source§

fn get_y_axis_skew_radians(&self) -> f32

Returns the current y axis skew applied to this PdfPageObject, in radians. Read more
source§

fn set_blend_mode(
    &mut self,
    blend_mode: PdfPageObjectBlendMode
) -> Result<(), PdfiumError>

Sets the blend mode that will be applied when painting this PdfPageObject. Read more
source§

fn fill_color(&self) -> Result<PdfColor, PdfiumError>

Returns the color of any filled paths in this PdfPageObject.
source§

fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>

Sets the color of any filled paths in this PdfPageObject.
source§

fn stroke_color(&self) -> Result<PdfColor, PdfiumError>

Returns the color of any stroked lines in this PdfPageObject.
source§

fn set_stroke_color(&mut self, stroke_color: PdfColor) -> Result<(), PdfiumError>

Sets the color of any stroked lines in this PdfPageObject. Read more
source§

fn stroke_width(&self) -> Result<PdfPoints, PdfiumError>

Returns the width of any stroked lines in this PdfPageObject.
source§

fn set_stroke_width(
    &mut self,
    stroke_width: PdfPoints
) -> Result<(), PdfiumError>

Sets the width of any stroked lines in this PdfPageObject. Read more
source§

fn line_join(&self) -> Result<PdfPageObjectLineJoin, PdfiumError>

Returns the line join style that will be used when painting stroked path segments in this PdfPageObject.
source§

fn set_line_join(
    &mut self,
    line_join: PdfPageObjectLineJoin
) -> Result<(), PdfiumError>

Sets the line join style that will be used when painting stroked path segments in this PdfPageObject.
source§

fn line_cap(&self) -> Result<PdfPageObjectLineCap, PdfiumError>

Returns the line cap style that will be used when painting stroked path segments in this PdfPageObject.
source§

fn set_line_cap(
    &mut self,
    line_cap: PdfPageObjectLineCap
) -> Result<(), PdfiumError>

Sets the line cap style that will be used when painting stroked path segments in this PdfPageObject.
source§

fn is_copyable(&self) -> bool

Returns true if this PdfPageObject can be successfully copied by calling its try_copy() function. Read more
source§

fn try_copy<'b>(
    &self,
    document: &PdfDocument<'b>
) -> Result<PdfPageObject<'b>, PdfiumError>

Attempts to copy this PdfPageObject by creating a new page object and copying across all the properties of this PdfPageObject to the new page object. Read more
source§

fn width(&self) -> Result<PdfPoints, PdfiumError>

Returns the width of this PdfPageObject.
source§

fn height(&self) -> Result<PdfPoints, PdfiumError>

Returns the height of this PdfPageObject.
source§

fn is_inside_rect(&self, rect: &PdfRect) -> bool

Returns true if the bounds of this PdfPageObject lie entirely within the given rectangle.
source§

fn does_overlap_rect(&self, rect: &PdfRect) -> bool

Returns true if the bounds of this PdfPageObject lie at least partially within the given rectangle.
source§

fn translate(
    &mut self,
    delta_x: PdfPoints,
    delta_y: PdfPoints
) -> Result<(), PdfiumError>

Moves the origin of this PdfPageObject by the given horizontal and vertical delta distances.
source§

fn get_translation(&self) -> (PdfPoints, PdfPoints)

Returns the current horizontal and vertical translation of the origin of this PdfPageObject.
source§

fn scale(
    &mut self,
    horizontal_scale_factor: f64,
    vertical_scale_factor: f64
) -> Result<(), PdfiumError>

Changes the size of this PdfPageObject, scaling it by the given horizontal and vertical scale factors.
source§

fn flip_horizontally(&mut self) -> Result<(), PdfiumError>

Flips this PdfPageObject horizontally around its origin by applying a horizontal scale factor of -1.
source§

fn flip_vertically(&mut self) -> Result<(), PdfiumError>

Flips this PdfPageObject vertically around its origin by applying a vertical scale factor of -1.
source§

fn reflect(&mut self) -> Result<(), PdfiumError>

Reflects this PdfPageObject by flipping it both horizontally and vertically around its origin.
source§

fn get_scale(&self) -> (f64, f64)

Returns the current horizontal and vertical scale factors applied to this PdfPageObject.
source§

fn rotate_counter_clockwise_degrees(
    &mut self,
    degrees: f32
) -> Result<(), PdfiumError>

Rotates this PdfPageObject counter-clockwise by the given number of degrees.
source§

fn get_rotation_counter_clockwise_degrees(&self) -> f32

Returns the counter-clockwise rotation applied to this PdfPageObject, in degrees. Read more
source§

fn rotate_clockwise_degrees(&mut self, degrees: f32) -> Result<(), PdfiumError>

Rotates this PdfPageObject clockwise by the given number of degrees.
source§

fn get_rotation_clockwise_degrees(&self) -> f32

Returns the clockwise rotation applied to this PdfPageObject, in degrees. Read more
source§

fn rotate_counter_clockwise_radians(
    &mut self,
    radians: f32
) -> Result<(), PdfiumError>

Rotates this PdfPageObject counter-clockwise by the given number of radians.
source§

fn rotate_clockwise_radians(&mut self, radians: f32) -> Result<(), PdfiumError>

Rotates this PdfPageObject clockwise by the given number of radians.
source§

fn get_rotation_clockwise_radians(&self) -> f32

Returns the clockwise rotation applied to this PdfPageObject, in radians. Read more
source§

fn skew_degrees(
    &mut self,
    x_axis_skew: f32,
    y_axis_skew: f32
) -> Result<(), PdfiumError>

Skews the axes of this PdfPageObject by the given angles in degrees.
source§

fn get_skew_degrees(&self) -> (f32, f32)

Returns the current x axis and y axis skew angles applied to this PdfPageObject, in degrees. Read more
source§

fn get_x_axis_skew_degrees(&self) -> f32

Returns the current x axis skew angle applied to this PdfPageObject, in degrees. Read more
source§

fn get_y_axis_skew_degrees(&self) -> f32

Returns the current y axis skew applied to this PdfPageObject, in degrees. Read more
source§

fn skew_radians(
    &mut self,
    x_axis_skew: f32,
    y_axis_skew: f32
) -> Result<(), PdfiumError>

Skews the axes of this PdfPageObject by the given angles in radians.
source§

fn get_skew_radians(&self) -> (f32, f32)

Returns the current x axis and y axis skew angles applied to this PdfPageObject, in radians. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.