diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index bca9badd4..31810644e 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -1569,11 +1569,14 @@ impl Remote { // Spawn a new thread to handle the print job. // Or print job will block the ui thread. std::thread::spawn(move || { - crate::platform::send_raw_data_to_printer( - printer_name, - data, - ) - .ok(); + if let Err(e) = + crate::platform::send_raw_data_to_printer( + printer_name, + data, + ) + { + log::error!("Print job error: {}", e); + } }); } } diff --git a/src/platform/windows.rs b/src/platform/windows.rs index ed2b71c5d..2c89b49fb 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -2862,19 +2862,15 @@ pub fn send_raw_data_to_printer(printer_name: Option, data: Vec) -> if !names.contains(&printer_name) { // Don't set the first printer as current printer. // It may not be the desired printer. - log::error!( - "Printer name \"{}\" not found, ignore the print job", - printer_name - ); bail!("Printer name \"{}\" not found", &printer_name); } } } if printer_name.is_empty() { - log::error!("Failed to get printer name"); return Err(anyhow!("Failed to get printer name")); } + log::info!("Sending data to printer: {}", &printer_name); let printer_name = wide_string(&printer_name); unsafe { let res = PrintXPSRawData( @@ -2883,7 +2879,9 @@ pub fn send_raw_data_to_printer(printer_name: Option, data: Vec) -> data.len() as c_ulong, ); if res != 0 { - bail!("Failed to send file to printer, see logs in C:\\Windows\\temp\\test_rustdesk.log for more details."); + bail!("Failed to send data to the printer, see logs in C:\\Windows\\temp\\test_rustdesk.log for more details."); + } else { + log::info!("Successfully sent data to the printer"); } }