#[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§fn clone(&self) -> StampOptions
fn clone(&self) -> StampOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more