pub struct Stamper { /* private fields */ }Expand description
Context-oriented Stamper builder for applying watermarks, rubber stamps, headers/footers, and images.
Implementations§
Source§impl Stamper
impl Stamper
pub fn new() -> Self
Sourcepub fn layer(self, layer: StampLayer) -> Self
pub fn layer(self, layer: StampLayer) -> Self
Sets whether stamp is placed under or over page content.
Sourcepub fn position(self, pos: StampPosition) -> Self
pub fn position(self, pos: StampPosition) -> Self
Sets the position on the page.
Sourcepub fn watermark(
self,
text: impl Into<String>,
font_size: f64,
color: Color,
rotation: f64,
opacity: f64,
) -> Self
pub fn watermark( self, text: impl Into<String>, font_size: f64, color: Color, rotation: f64, opacity: f64, ) -> Self
Configures a semi-transparent text watermark.
Sourcepub fn simple_watermark(self, text: impl Into<String>) -> Self
pub fn simple_watermark(self, text: impl Into<String>) -> Self
Configures a simple centered diagonal watermark with default styling.
Sourcepub fn rubber_stamp(
self,
title: impl Into<String>,
subtitle: Option<String>,
color: Color,
rotation: f64,
) -> Self
pub fn rubber_stamp( self, title: impl Into<String>, subtitle: Option<String>, color: Color, rotation: f64, ) -> Self
Configures a boxed rubber stamp (e.g. “APPROVED”, “DRAFT”, “CONFIDENTIAL”).
Sourcepub fn header(
self,
text: impl Into<String>,
position: StampPosition,
font_size: f64,
color: Color,
) -> Self
pub fn header( self, text: impl Into<String>, position: StampPosition, font_size: f64, color: Color, ) -> Self
Configures a header stamp with placeholder support: {page}, {total}.
Configures a footer stamp with placeholder support: {page}, {total}.
Sourcepub fn image(
self,
img: PDImageXObject,
width: f64,
height: f64,
opacity: f64,
) -> Self
pub fn image( self, img: PDImageXObject, width: f64, height: f64, opacity: f64, ) -> Self
Configures an image stamp.
Sourcepub fn apply(&self, doc: &mut PDDocument) -> PdfResult<()>
pub fn apply(&self, doc: &mut PDDocument) -> PdfResult<()>
Applies the configured stamp across all matching pages in the document.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stamper
impl RefUnwindSafe for Stamper
impl Send for Stamper
impl Sync for Stamper
impl Unpin for Stamper
impl UnsafeUnpin for Stamper
impl UnwindSafe for Stamper
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
Mutably borrows from an owned value. Read more