Struct fltk::printer::Printer[][src]

pub struct Printer { /* fields omitted */ }
Expand description

Defines a printer object. Example usage:

use fltk::{prelude::*, *};
let mut but = button::Button::default();
but.set_callback(|widget| {
    let mut printer = printer::Printer::default();
    if printer.begin_job(1).is_ok() {
        printer.begin_page().ok();
        let (width, height) = printer.printable_rect();
        draw::set_draw_color(enums::Color::Black);
        draw::set_line_style(draw::LineStyle::Solid, 2);
        draw::draw_rect(0, 0, width, height);
        draw::set_font(enums::Font::Courier, 12);
        printer.set_origin(width / 2, height / 2);
        printer.print_widget(widget, -widget.width() / 2, -widget.height() / 2);
        printer.end_page().ok();
        printer.end_job();
    }
});

Implementations

Creates a printer object

Begins a print job. pagecount The total number of pages to be created. Use 0 if this number is unknown Returns a tuple (frompage, topage) indicating the chosen pages by the user

Errors

Errors on failure to print

End the print page

Errors

Errors on failure to end the page

Ends the print job

Begins a print page

Errors

Errors on failure to begin the page

Returns the width and height of the printable rect

Returns the coordinates of the printable margins. (left, top, right, bottom)

Get the origin coordinates of the printable rect

Set the origin coordinates of the printable rect

Scale the printable rect

Rotate the printable rect

Translate the printable rect

Untranslate the printable rect

Check whether the printer is the current printer

Set the printer to be the current printer

Print a widget

Print a window

Set the dialog “Title”

Set the dialog “Printer”

Set dialog “Range”

Set dialog “Copies”

Set dialog “All”

Set dialog “Pages”

Set dialog “From”

Set dialog “To”

Set dialog “Properties”

Set dialog “Number of copies”

Set dialog “Print” button

Set dialog “Cancel” button

Set dialog “Print to file” button

Set property “Title”

Set property “Page Size”

Set property “Mode”

Set property “Use”

Set property “Save”

Set property “Cancel”

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.