Ways to physically print in Rust using native dialogs
⚓ Rust 📅 2025-11-23 👤 surdeus 👁️ 11I've spent a while figuring out how to print a document in Rust using native dialogs. In case anyone else has been trying, the best method I found was using fltk and something like this:
let app = app::App::default();
let mut wind = Window::default();
wind.end();
wind.show();
wind.hide();
let mut printer = printer::Printer::default();
if printer.begin_job(1).is_ok() {
printer.begin_page().ok();
let (width, height) = printer.printable_rect();
// Thing to print goes here
printer.set_origin(width / 2, height / 2);
printer.end_page().ok();
printer.end_job();
}
app.run().unwrap();
Hope this helps someone out, and if there's a better way to do this, I'd love to hear about it in the comments of this post.
1 post - 1 participant
🏷️ Rust_feed