-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to pass options to printer #12
base: feature/printer-options
Are you sure you want to change the base?
Conversation
Fix parsing wmic command bug and fix wrong clone property bug
What's the state of this? |
@talesluna @JuliDi anything we could do to help with this? I'd very much like to leverage this library but I need this capability. Happy to help however. |
Not sure, there isn't really anything blocking this PR. It works as is and pends integration into a new release afaik, see #11 (comment) |
Hey, great job. I currently have an electron app where i am using print api with options like this
how do i pass these options when using printers::print? |
Haven't used it in a while, but this is what I have in the app I made that branch for: let mut printer: Vec<Printer> = printers::get_printers();
let printer = printer
.iter_mut()
.find(|p| p.system_name == *selected)
.unwrap();
// See https://www.cups.org/doc/options.html
printer.add_option(PrinterOption::new(r#"PageSize="Custom.54x101mm""#));
printer.add_option(PrinterOption::new(r#"orientation-requested=4"#)); // landscape
//printer.add_option(PrinterOption::new(r#"orientation-requested=3"#)); // portrait
printer.add_option(PrinterOption::new(r#"fit-to-page"#));
printer.print_file(&file); |
This could serve as a starting point for allowing users to pass options to the printers. I only tested this on macOS, and it seems to work there.
There is of course a lot that can be improved, but it might be a good start.
fixes #11