ltk

Module print

Source
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.
  • PrintOptions as the print portal carries them: GTK’s print settings and page setup.

Structs§

Enums§

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; None when the text is not such a list.
  • Print pdf at destination with options; done once the printer’s queue, or the desktop, took it.
  • Make printer the user’s default.