Struct PdfiumPageObject

Source
pub struct PdfiumPageObject { /* private fields */ }
Expand description

§Rust interface to FPDF_PAGEOBJECT

Implementations§

Source§

impl PdfiumPageObject

Source

pub fn remove_param( &self, mark: &PdfiumPageObjectMark, key: &CString, ) -> PdfiumResult<()>

Removes a property from a content mark by key.

page_object - handle to the page object with the mark. mark - handle to a content mark. key - string key of the property.

Returns TRUE if the operation succeeded, FALSE otherwise.

Source

pub fn add_mark(&self, name: &CString) -> PdfiumResult<PdfiumPageObjectMark>

Add a new content mark to a this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. name - the name (tag) of the mark.

Returns the handle to the content mark, or NULL on failure. The handle is still owned by the library, and it should not be freed directly. It becomes invalid if the page object is destroyed, either directly or indirectly by unloading the page.

Source

pub fn count_marks(&self) -> i32

Get number of content marks in this PdfiumPageObject.

page_object - handle to this PdfiumPageObject.

Returns the number of content marks in this PdfiumPageObject, or -1 in case of failure.

Source

pub fn get_bounds( &self, left: &mut f32, bottom: &mut f32, right: &mut f32, top: &mut f32, ) -> PdfiumResult<()>

Get the bounding box of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. left - pointer where the left coordinate will be stored bottom - pointer where the bottom coordinate will be stored right - pointer where the right coordinate will be stored top - pointer where the top coordinate will be stored

On success, returns TRUE and fills in the 4 coordinates.

Source

pub fn get_clip_path(&self) -> PdfiumResult<PdfiumClipPath>

Get the clip path of the page object.

page object - Handle to this PdfiumPageObject. Returned by e.g. FPDFPage_GetObject().

Returns the handle to the clip path, or NULL on failure. The caller does not take ownership of the returned FPDF_CLIPPATH. Instead, it remains valid until FPDF_ClosePage() is called for the page containing this PdfiumPageObject.

Source

pub fn get_dash_array( &self, dash_array: &mut f32, dash_count: usize, ) -> PdfiumResult<()>

Get the line dash array of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. dash_array - pointer where the dashing array will be stored. dash_count - number of elements in dash_array.

Returns TRUE on success.

Source

pub fn get_dash_count(&self) -> i32

Get the line dash array of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject.

Returns the line dash array size or -1 on failure.

Source

pub fn get_dash_phase(&self, phase: &mut f32) -> PdfiumResult<()>

Get the line dash phase of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. phase - pointer where the dashing phase will be stored.

Returns TRUE on success.

Source

pub fn get_fill_color( &self, r: &mut u32, g: &mut u32, b: &mut u32, a: &mut u32, ) -> PdfiumResult<()>

Get the fill RGBA of this PdfiumPageObject. Range of values: 0 - 255.

page_object - the handle to the page object. R - the red component of the object’s fill color. G - the green component of the object’s fill color. B - the blue component of the object’s fill color. A - the fill alpha of the object.

Returns TRUE on success.

Source

pub fn get_is_active(&self, active: &mut FPDF_BOOL) -> PdfiumResult<()>

Gets active state for this PdfiumPageObject within page.

page_object - handle to this PdfiumPageObject. active - pointer to variable that will receive if the page object is active. This is a required parameter. Not filled if FALSE is returned.

For page objects where active is filled with FALSE, the this PdfiumPageObject is treated as if it wasn’t in the document even though it is still held internally.

Returns TRUE if the operation succeeded, FALSE if it failed.

Source

pub fn get_line_cap(&self) -> i32

Get the line cap of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject.

Returns the line cap, or -1 on failure. Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, FPDF_LINECAP_PROJECTING_SQUARE

Source

pub fn get_line_join(&self) -> i32

Get the line join of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject.

Returns the line join, or -1 on failure. Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, FPDF_LINEJOIN_BEVEL

Source

pub fn get_mark(&self, index: c_ulong) -> PdfiumResult<PdfiumPageObjectMark>

Get content mark in this PdfiumPageObject at index.

page_object - handle to this PdfiumPageObject. index - the index of this PdfiumPageObject.

Returns the handle to the content mark, or NULL on failure. The handle is still owned by the library, and it should not be freed directly. It becomes invalid if the page object is destroyed, either directly or indirectly by unloading the page.

Source

pub fn get_marked_content_id(&self) -> i32

Get the marked content ID for the object.

page_object - handle to this PdfiumPageObject.

Returns the page object’s marked content ID, or -1 on error.

Source

pub fn get_matrix(&self, matrix: &mut FS_MATRIX) -> PdfiumResult<()>

Get the transform matrix of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. matrix - pointer to struct to receive the matrix value.

The matrix is composed as: a c e b d f and used to scale, rotate, shear and translate the page object.

For page objects outside form objects, the matrix values are relative to the page that contains it. For page objects inside form objects, the matrix values are relative to the form that contains it.

Returns TRUE on success.

Source

pub fn get_rotated_bounds( &self, quad_points: &mut FS_QUADPOINTSF, ) -> PdfiumResult<()>

Get the quad points that bounds this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. quad_points - pointer where the quadrilateral points will be stored.

On success, returns TRUE and fills in quad_points.

Similar to FPDFPageObj_GetBounds(), this returns the bounds of a page object. When the object is rotated by a non-multiple of 90 degrees, this API returns a tighter bound that cannot be represented with just the 4 sides of a rectangle.

Currently only works the following this PdfiumPageObject types: FPDF_PAGEOBJ_TEXT and FPDF_PAGEOBJ_IMAGE.

Source

pub fn get_stroke_color( &self, r: &mut u32, g: &mut u32, b: &mut u32, a: &mut u32, ) -> PdfiumResult<()>

Get the stroke RGBA of this PdfiumPageObject. Range of values: 0 - 255.

page_object - the handle to the page object. R - the red component of the path stroke color. G - the green component of the object’s stroke color. B - the blue component of the object’s stroke color. A - the stroke alpha of the object.

Returns TRUE on success.

Source

pub fn get_stroke_width(&self, width: &mut f32) -> PdfiumResult<()>

Get the stroke width of this PdfiumPageObject.

path - the handle to the page object. width - the width of the stroke.

Returns TRUE on success

Source

pub fn get_type(&self) -> ObjectType

Get type of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject.

Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on error.

Source

pub fn has_transparency(&self) -> i32

Checks if this PdfiumPageObject contains transparency.

page_object - handle to this PdfiumPageObject.

Returns TRUE if this PdfiumPageObject contains transparency.

Source

pub fn remove_mark(&self, mark: &PdfiumPageObjectMark) -> PdfiumResult<()>

Removes a content mark from a this PdfiumPageObject. The mark handle will be invalid after the removal.

page_object - handle to this PdfiumPageObject. mark - handle to a content mark in that object to remove.

Returns TRUE if the operation succeeded, FALSE if it failed.

Source

pub fn set_blend_mode(&self, blend_mode: &CString)

Set the blend mode of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. blend_mode - string containing the blend mode.

Blend mode can be one of following: Color, ColorBurn, ColorDodge, Darken, Difference, Exclusion, HardLight, Hue, Lighten, Luminosity, Multiply, Normal, Overlay, Saturation, Screen, SoftLight

Source

pub fn set_dash_array( &self, dash_array: &[f32], dash_count: usize, phase: f32, ) -> PdfiumResult<()>

Set the line dash array of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. dash_array - the dash array. dash_count - number of elements in dash_array. phase - the line dash phase.

Returns TRUE on success.

Source

pub fn set_dash_phase(&self, phase: f32) -> PdfiumResult<()>

Set the line dash phase of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. phase - line dash phase.

Returns TRUE on success.

Source

pub fn set_fill_color(&self, r: u32, g: u32, b: u32, a: u32) -> PdfiumResult<()>

Set the fill RGBA of this PdfiumPageObject. Range of values: 0 - 255.

page_object - the handle to the page object. R - the red component for the object’s fill color. G - the green component for the object’s fill color. B - the blue component for the object’s fill color. A - the fill alpha for the object.

Returns TRUE on success.

Source

pub fn set_is_active(&self, active: i32) -> PdfiumResult<()>

Sets if this PdfiumPageObject is active within page.

page_object - handle to this PdfiumPageObject. active - a boolean specifying if the object is active.

Returns TRUE on success.

Page objects all start in the active state by default, and remain in that state unless this function is called.

When active is false, this makes the this PdfiumPageObject be treated as if it wasn’t in the document even though it is still held internally.

Source

pub fn set_line_cap(&self, line_cap: i32) -> PdfiumResult<()>

Set the line cap of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. line_cap - line cap

Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, FPDF_LINECAP_PROJECTING_SQUARE

Source

pub fn set_line_join(&self, line_join: i32) -> PdfiumResult<()>

Set the line join of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. line_join - line join

Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, FPDF_LINEJOIN_BEVEL

Source

pub fn set_matrix(&self, matrix: &FS_MATRIX) -> PdfiumResult<()>

Set the transform matrix of this PdfiumPageObject.

page_object - handle to this PdfiumPageObject. matrix - pointer to struct with the matrix value.

The matrix is composed as: a c e b d f and can be used to scale, rotate, shear and translate the page object.

Returns TRUE on success.

Source

pub fn set_stroke_color( &self, r: u32, g: u32, b: u32, a: u32, ) -> PdfiumResult<()>

Set the stroke RGBA of this PdfiumPageObject. Range of values: 0 - 255.

page_object - the handle to the page object. R - the red component for the object’s stroke color. G - the green component for the object’s stroke color. B - the blue component for the object’s stroke color. A - the stroke alpha for the object.

Returns TRUE on success.

Source

pub fn set_stroke_width(&self, width: f32) -> PdfiumResult<()>

Set the stroke width of this PdfiumPageObject.

path - the handle to the page object. width - the width of the stroke.

Returns TRUE on success

Source

pub fn transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)

Transform this PdfiumPageObject by the given matrix.

page_object - handle to this PdfiumPageObject. a - matrix value. b - matrix value. c - matrix value. d - matrix value. e - matrix value. f - matrix value.

The matrix is composed as: a c e b d f and can be used to scale, rotate, shear and translate the this PdfiumPageObject.

Source

pub fn transform_clip_path( &self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64, )

Transform (scale, rotate, shear, move) the clip path of page object. page_object - Handle to this PdfiumPageObject. Returned by FPDFPageObj_NewImageObj().

a - The coefficient “a” of the matrix. b - The coefficient “b” of the matrix. c - The coefficient “c” of the matrix. d - The coefficient “d” of the matrix. e - The coefficient “e” of the matrix. f - The coefficient “f” of the matrix.

Source

pub fn transform_f(&self, matrix: &FS_MATRIX) -> PdfiumResult<()>

Transform this PdfiumPageObject by the given matrix.

page_object - handle to this PdfiumPageObject. matrix - the transform matrix.

Returns TRUE on success.

This can be used to scale, rotate, shear and translate the this PdfiumPageObject. It is an improved version of FPDFPageObj_Transform() that does not do unnecessary double to float conversions, and only uses 1 parameter for the matrix. It also returns whether the operation succeeded or not.

Trait Implementations§

Source§

impl Clone for PdfiumPageObject

Source§

fn clone(&self) -> PdfiumPageObject

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PdfiumPageObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&PdfiumPageObject> for FPDF_PAGEOBJECT

Source§

fn from(page_object: &PdfiumPageObject) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.