#[non_exhaustive]pub struct StampOptions {
pub position: StampPosition,
pub margin: f64,
pub angle: f64,
pub opacity: f32,
pub font: StandardFont,
pub font_size: f32,
pub color: Color,
}Expand description
How a stamp is drawn.
A config struct with Default. #[non_exhaustive] so a field added
later is not a major break; fill one in with StampOptions::builder.
The three font fields are read by EditDoc::stamp_text only; the
rest apply to an image stamp too.
use pdfrum::{Color, StampOptions, StampPosition};
let draft = StampOptions::builder()
.position(StampPosition::Center)
.angle(45.0)
.opacity(0.3)
.font_size(96.0)
.color(Color::from_rgb8(200, 0, 0))
.build();
assert_eq!(draft.margin, 36.0);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.position: StampPositionWhere the stamp’s box sits. StampPosition::Center by default.
margin: f64Points between a corner-placed stamp and the crop box’s edges. 36 — half an inch — by default.
angle: f64Degrees counter-clockwise, turned about the stamp’s own centre after it is placed. 0 by default.
opacity: f32Constant alpha, 0.0 (invisible) to 1.0 (opaque, the default),
written as an /ExtGState. Multiplied into StampOptions::color’s
own alpha for text.
font: StandardFontThe face for a text stamp, one of the standard 14 — Helvetica by default. Text is encoded as WinAnsi, so a character outside Latin-1 draws as nothing.
font_size: f32The text size in points. 36 by default.
color: ColorThe text colour. Black by default.
Implementations§
Source§impl StampOptions
impl StampOptions
Sourcepub fn builder() -> StampOptionsBuilder
pub fn builder() -> StampOptionsBuilder
A builder starting from the defaults.
let options = pdfrum::StampOptions::builder().angle(45.0).build();Trait Implementations§
Source§impl Clone for StampOptions
impl Clone for StampOptions
Source§impl Debug for StampOptions
impl Debug for StampOptions
Source§impl Default for StampOptions
impl Default for StampOptions
Source§impl PartialEq for StampOptions
impl PartialEq for StampOptions
impl StructuralPartialEq for StampOptions
Auto Trait Implementations§
impl Freeze for StampOptions
impl RefUnwindSafe for StampOptions
impl Send for StampOptions
impl Sync for StampOptions
impl Unpin for StampOptions
impl UnsafeUnpin for StampOptions
impl UnwindSafe for StampOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.