pub struct Document {
pub title: String,
pub culture: String,
pub pages: Vec<Page>,
pub errors: Vec<String>,
}Expand description
A paginated document.
Fields§
§title: StringThe title (the report’s name).
culture: StringThe culture the document was formatted with (pt-BR, en-US).
pages: Vec<Page>The pages, in order.
errors: Vec<String>Problems found while rendering (expression errors, missing data), with where they happened. The document is still produced.
Implementations§
Source§impl Document
impl Document
Sourcepub fn page_text(&self, page: usize) -> Vec<String>
pub fn page_text(&self, page: usize) -> Vec<String>
All the text of a page in reading order, one line per text line (for tests, search and accessibility).
Sourcepub fn page_contains(&self, page: usize, needle: &str) -> bool
pub fn page_contains(&self, page: usize, needle: &str) -> bool
Whether needle appears on the page (case-insensitive).
Sourcepub fn page_svg(&self, page: usize) -> String
pub fn page_svg(&self, page: usize) -> String
A page as SVG, for previews, tests and debugging. Text uses the Inter font the document was measured with.
Sourcepub fn print_html(&self) -> String
pub fn print_html(&self) -> String
The whole document as a standalone HTML page sized for printing: one sheet per page, with the Inter font embedded so it prints as measured. Open it in a browser and print, or save it as PDF from the print dialog.
Trait Implementations§
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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