pub struct HeaderFooter {
pub left: Option<String>,
pub center: Option<String>,
pub right: Option<String>,
pub font_size: f32,
pub color: Color,
}Expand description
Header or footer text rendered on every page of a FlowDocument.
Set via FlowOptions::header and FlowOptions::footer. The placeholder
strings {{page}} and {{total}} are substituted with the current page number
and total page count at render time.
§Example
use harumi::{FlowDocument, FlowOptions, HeaderFooter};
let font = include_bytes!("../../tests/fixtures/NotoSansJP-Regular.ttf");
let mut doc = FlowDocument::new(font.as_ref(), FlowOptions {
footer: Some(HeaderFooter {
center: Some("{{page}} / {{total}}".into()),
..Default::default()
}),
..Default::default()
})?;
doc.push_paragraph("Hello!")?;
let pdf = doc.render()?;Fields§
§left: Option<String>Text aligned to the left of the area. None = no left text.
center: Option<String>Text centered horizontally. None = no center text.
right: Option<String>Text aligned to the right. None = no right text.
font_size: f32Font size in PDF points. Default: 9.0.
color: ColorColor (RGB or CMYK) in 0.0..=1.0. Default: dark gray.
Implementations§
Sourcepub fn page_number() -> Self
pub fn page_number() -> Self
A centered footer showing "page / total" in dark gray at 9 pt.
Trait Implementations§
Source§fn clone(&self) -> HeaderFooter
fn clone(&self) -> HeaderFooter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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