pub struct PageTemplate {
pub header_height: f32,
pub footer_height: f32,
pub slots: Vec<PageSlot>,
pub header_on_first_page: bool,
pub footer_on_first_page: bool,
pub left_page_slots: Option<Vec<PageSlot>>,
pub right_page_slots: Option<Vec<PageSlot>>,
}Expand description
Template for page headers, footers, and margins
Fields§
§header_height: f32Header height in points (0 = no header)
Footer height in points (0 = no footer)
slots: Vec<PageSlot>Slots for dynamic content
header_on_first_page: boolWhether to show header on first page
Whether to show footer on first page
left_page_slots: Option<Vec<PageSlot>>Different template for left (even) pages
right_page_slots: Option<Vec<PageSlot>>Different template for right (odd) pages
Implementations§
Source§impl PageTemplate
impl PageTemplate
pub fn new() -> Self
Add a simple page number footer (centered)
Add “Page X of Y” footer
Sourcepub fn with_book_header(self, title: String, height: f32) -> Self
pub fn with_book_header(self, title: String, height: f32) -> Self
Add a header with title on left and page number on right
Sourcepub fn slots_for_page(&self, page_number: usize) -> &[PageSlot]
pub fn slots_for_page(&self, page_number: usize) -> &[PageSlot]
Get slots for a specific page (handles left/right page differences)
Sourcepub fn show_header(&self, page_number: usize) -> bool
pub fn show_header(&self, page_number: usize) -> bool
Check if header should be shown on this page
Check if footer should be shown on this page
Sourcepub fn content_area_height(&self, page_height: f32, page_number: usize) -> f32
pub fn content_area_height(&self, page_height: f32, page_number: usize) -> f32
Get the content area height (page height minus header and footer)
Trait Implementations§
Source§impl Clone for PageTemplate
impl Clone for PageTemplate
Source§fn clone(&self) -> PageTemplate
fn clone(&self) -> PageTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PageTemplate
impl Debug for PageTemplate
Auto Trait Implementations§
impl Freeze for PageTemplate
impl !RefUnwindSafe for PageTemplate
impl Send for PageTemplate
impl Sync for PageTemplate
impl Unpin for PageTemplate
impl !UnwindSafe for PageTemplate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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