Skip to main content

PrintDoc

Struct PrintDoc 

Source
pub struct PrintDoc { /* private fields */ }
Expand description

a print job of several pages (see the file header; E9)

Implementations§

Source§

impl PrintDoc

Source

pub fn begin(job: &PrintJob<'_>, pages: u32) -> Result<PrintDoc, i32>

start a job: the system’s print dialog where the platform has one (printer, paper, orientation, copies; with pages > 0 a page range of 1..=pages), never one in the test variant (jfgui_PRINT_TO). job: the title (spooler, PDF /Title; “” = “Dokument”), paper, PJF_LANDSCAPE / PJF_CENTER / PJF_SMASK, margin, scale, percent, dpi – its src is not used. Err: ERR_CANCEL (the dialog was cancelled), ERR_UNSUPPORTED (no printing here, no window, the manifest forbids it), ERR_IO

Source

pub fn page(&self) -> PPage

the page the job prints on (pt; the printer’s unprintable edges; the orientation the dialog chose in flags): lay the pages out for it

Source

pub fn copies(&self) -> u32

the copies the dialog chose (informative: the printer makes them; 1 in the test variant)

Source

pub fn wants(&self, n: u32) -> bool

page n (from 1) is in the range the dialog chose (always without a range)

Source

pub fn added(&self) -> u32

the pages added so far

Source

pub fn pdf_native(&self) -> bool

the platform prints a PDF document as it is (add_pdf): Linux’s portal and the test variant there; Windows and the others: images only

Source

pub fn add_image(&mut self, src: &PrintSrc<'_>) -> i32

one page: the image laid out on the page as layout() places it (the job’s scale, dpi, margin, PJF_CENTER; clipped to the printable area) -> 0 / ERR_DIMS / ERR_UNSUPPORTED (a format or after add_pdf) / ERR_IO / ERR_NOMEM

Source

pub fn add_pdf(&mut self, pdf: &[u8]) -> i32

the whole job as a PDF of the app’s own, printed as it is (only where pdf_native(), before any add_image) -> 0 / ERR_UNSUPPORTED

Source

pub fn end(self) -> i32

finish: the job goes to the printer -> 0 printed / ERR_CANCEL (the portal’s job was cancelled) / ERR_DIMS (no page) / ERR_IO

Source

pub fn abort(self)

drop the job (nothing is printed)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.