pub struct SimplePageDecorator {
pub(crate) page: usize,
pub(crate) margins: Option<Margins>,
pub(crate) header_cb: Option<Box<dyn Fn(usize) -> Box<dyn Element>>>,
}Expand description
Prepares a page of a document with margins and a header.
Per default, this decorator does not modify the page. If margins have been set with the
set_margins method, they are applied to every page. If a header callback is configured
with the set_header method, it will be called for every page and its return value will be
rendered at the beginning of the page (after the margins have been applied).
Fields§
§page: usize§margins: Option<Margins>§header_cb: Option<Box<dyn Fn(usize) -> Box<dyn Element>>>Implementations§
Source§impl SimplePageDecorator
impl SimplePageDecorator
Sourcepub fn new() -> SimplePageDecorator
pub fn new() -> SimplePageDecorator
Creates a new page decorator that does not modify the page.
Sourcepub fn set_margins(&mut self, margins: impl Into<Margins>)
pub fn set_margins(&mut self, margins: impl Into<Margins>)
Sets the margins for all pages of this document.
If this method is not called, the full page is used.
Sourcepub fn set_header<F, E>(&mut self, cb: F)
pub fn set_header<F, E>(&mut self, cb: F)
Sets the header generator for this document.
The given closure will be called once per page. Its argument is the page number (starting with 1), and its return value will be rendered at the top of the page. The document content will start directly after the element.
Trait Implementations§
Source§impl Default for SimplePageDecorator
impl Default for SimplePageDecorator
Source§fn default() -> SimplePageDecorator
fn default() -> SimplePageDecorator
Source§impl PageDecorator for SimplePageDecorator
impl PageDecorator for SimplePageDecorator
Auto Trait Implementations§
impl Freeze for SimplePageDecorator
impl !RefUnwindSafe for SimplePageDecorator
impl !Send for SimplePageDecorator
impl !Sync for SimplePageDecorator
impl Unpin for SimplePageDecorator
impl !UnwindSafe for SimplePageDecorator
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§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.