Expand description
A print dialog with a preview of the pages, and the system’s printers through CUPS. The app renders the document to PDF itself: the dialog asks it for a preview whenever the layout changes, and says where to print and how once the user accepts.
fn open( &mut self )
{
self.print = Some( PrintDialog::new( &self.sender, Msg::Print, "Report" ).preview( true ) );
}
fn update( &mut self, msg: Msg )
{
let Msg::Print( msg ) = msg;
let Some( dialog ) = &mut self.print else { return };
match dialog.update( msg )
{
Some( PrintEvent::Preview( options ) ) => { /* render, then send PrintDialogMsg::previewed( .. ) */ }
Some( PrintEvent::Print( job ) ) => { self.print = None; /* render job.options, then ltk::print::send or save */ }
Some( PrintEvent::Cancelled ) => self.print = None,
None => {}
}
}Modules§
- CUPS’s calls themselves, for a program without ltk’s loop; each blocks.
PrintOptionsas the print portal carries them: GTK’s print settings and page setup.
Structs§
- A sheet size, in PDF points, with its PWG media name for the printer.
- What the print portal’s dialog chose, which it prints with.
- The pages chosen, rendered with the options the dialog asked for.
- What to print, where and how, once the user accepted.
- What the user chose in a print dialog.
Enums§
- What the app has to do for the dialog.
- A setting whose choices the dialog shows under it.
Constants§
- The field with the pages to print.
- How wide, in pixels, the pages of a preview are best rendered.
Functions§
- The user’s jobs not yet finished, on every printer or on one of them.
- The system’s printers, the default first; empty without CUPS’s server, an error without CUPS.
- Pages such as
1-3, 5, 8-, inclusive and from 1;Nonewhen the text is not such a list. - Print
pdfatdestinationwithoptions; done once the printer’s queue, or the desktop, took it. - Make
printerthe user’s default.