pub struct PdfiumPageObject { /* private fields */ }Expand description
§Rust interface to FPDF_PAGEOBJECT
Implementations§
Source§impl PdfiumPageObject
impl PdfiumPageObject
Sourcepub fn remove_param(
&self,
mark: &PdfiumPageObjectMark,
key: &CString,
) -> PdfiumResult<()>
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.
Sourcepub fn add_mark(&self, name: &CString) -> PdfiumResult<PdfiumPageObjectMark>
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.
Sourcepub fn count_marks(&self) -> i32
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.
Sourcepub fn get_bounds(
&self,
left: &mut f32,
bottom: &mut f32,
right: &mut f32,
top: &mut f32,
) -> PdfiumResult<()>
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.
Sourcepub fn get_clip_path(&self) -> PdfiumResult<PdfiumClipPath>
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.
Sourcepub fn get_dash_array(
&self,
dash_array: &mut f32,
dash_count: usize,
) -> PdfiumResult<()>
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.
Sourcepub fn get_dash_count(&self) -> i32
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.
Sourcepub fn get_dash_phase(&self, phase: &mut f32) -> PdfiumResult<()>
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.
Sourcepub fn get_fill_color(
&self,
r: &mut u32,
g: &mut u32,
b: &mut u32,
a: &mut u32,
) -> PdfiumResult<()>
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.
Sourcepub fn get_is_active(&self, active: &mut FPDF_BOOL) -> PdfiumResult<()>
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.
Sourcepub fn get_line_cap(&self) -> i32
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
Sourcepub fn get_line_join(&self) -> i32
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
Sourcepub fn get_mark(&self, index: c_ulong) -> PdfiumResult<PdfiumPageObjectMark>
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.
Sourcepub fn get_marked_content_id(&self) -> i32
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.
Sourcepub fn get_matrix(&self, matrix: &mut FS_MATRIX) -> PdfiumResult<()>
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.
Sourcepub fn get_rotated_bounds(
&self,
quad_points: &mut FS_QUADPOINTSF,
) -> PdfiumResult<()>
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.
Sourcepub fn get_stroke_color(
&self,
r: &mut u32,
g: &mut u32,
b: &mut u32,
a: &mut u32,
) -> PdfiumResult<()>
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.
Sourcepub fn get_stroke_width(&self, width: &mut f32) -> PdfiumResult<()>
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
Sourcepub fn get_type(&self) -> ObjectType
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.
Sourcepub fn has_transparency(&self) -> i32
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.
Sourcepub fn remove_mark(&self, mark: &PdfiumPageObjectMark) -> PdfiumResult<()>
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.
Sourcepub fn set_blend_mode(&self, blend_mode: &CString)
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
Sourcepub fn set_dash_array(
&self,
dash_array: &[f32],
dash_count: usize,
phase: f32,
) -> PdfiumResult<()>
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.
Sourcepub fn set_dash_phase(&self, phase: f32) -> PdfiumResult<()>
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.
Sourcepub fn set_fill_color(&self, r: u32, g: u32, b: u32, a: u32) -> PdfiumResult<()>
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.
Sourcepub fn set_is_active(&self, active: i32) -> PdfiumResult<()>
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.
Sourcepub fn set_line_cap(&self, line_cap: i32) -> PdfiumResult<()>
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
Sourcepub fn set_line_join(&self, line_join: i32) -> PdfiumResult<()>
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
Sourcepub fn set_matrix(&self, matrix: &FS_MATRIX) -> PdfiumResult<()>
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.
Sourcepub fn set_stroke_color(
&self,
r: u32,
g: u32,
b: u32,
a: u32,
) -> PdfiumResult<()>
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.
Sourcepub fn set_stroke_width(&self, width: f32) -> PdfiumResult<()>
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
Sourcepub fn transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)
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.
Sourcepub fn transform_clip_path(
&self,
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64,
)
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.
Sourcepub fn transform_f(&self, matrix: &FS_MATRIX) -> PdfiumResult<()>
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
impl Clone for PdfiumPageObject
Source§fn clone(&self) -> PdfiumPageObject
fn clone(&self) -> PdfiumPageObject
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more