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
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
Returns the coordinates of the printable margins. (left, top, right, bottom)
Set the origin coordinates of the printable rect
Untranslate the printable rect
Check whether the printer is the current printer
Set the printer to be the current printer
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”