Comments (5)
I've run into this as well- I made further progress by ensuring that both "LPD Print Service" and "LPR Port Monitor" features are enabled.
However, it appears to still have issues:
> lpr -S 127.0.0.1 -P "HP" "C:\\Users\\jonah\\AppData\\Local\\Temp\\8ea19b4b-22df-4063-ab20-1c56ec8abb81"
Error: print server did not accept request. Job aborted.
Initially, it seems that "HP"
is too short of a system name. Was able to determine that the DriverName parsing from wmic
has a bug when names have whitespace:
Running `target\debug\examples\list_printers.exe`
Printer { id: "793c6ff0-8bb6-542a-baba-e82974ceac12", name: "Name", system_name: "DriverName" }
Printer { id: "ed0e594f-e80c-59ca-9a76-d973e6d7a586", name: "Software", system_name: "Microsoft" }
Printer { id: "9928f21e-8775-5504-a46b-4066026b9b4c", name: "LaserJet", system_name: "HP" }
Printer { id: "ed0e594f-e80c-59ca-9a76-d973e6d7a586", name: "XPS", system_name: "Microsoft" }
Printer { id: "ed0e594f-e80c-59ca-9a76-d973e6d7a586", name: "Print", system_name: "Microsoft" }
Printer { id: "ed0e594f-e80c-59ca-9a76-d973e6d7a586", name: "Shared", system_name: "Microsoft" }
Printer { id: "8aec0343-6abb-537b-b8cd-e05e22e9d0b4", name: "CL-S400DTZ", system_name: "Citizen" }
> wmic printer get DriverName,Name
DriverName Name
Microsoft Software Printer Driver OneNote for Windows 10
HP LaserJet M109-M112 PCLm-S NPI642118 (HP LaserJet M110w)
Microsoft XPS Document Writer v4 Microsoft XPS Document Writer
Microsoft Print To PDF Microsoft Print to PDF
Microsoft Shared Fax Driver Fax
Citizen CL-S400DTZ Citizen CL-S400DTZ
Note: HP LaserJet M109-M112 PCLm-S
vs HP
Interestingly, neither of these work:
> lpr -S 127.0.0.1 -P "NPI642118 (HP LaserJet M110w)" "C:\\Users\\jonah\\AppData\\Local\\Temp\\8ea19b4b-22df-4063-ab20-1c56ec8abb81"
Error: print server did not accept request. Job aborted.
> lpr -S 127.0.0.1 -P "HP LaserJet M109-M112 PCLm-S" "C:\\Users\\jonah\\AppData\\Local\\Temp\\8ea19b4b-22df-4063-ab20-1c56ec8abb81"
Error: print server did not accept request. Job aborted.
Taking a step back, tried to determine whether this is an issue with this library or my hardware configuration. Looked into alternative ways of printing via CLI on Windows and encountered Get-Printer
and Out-Printer
.
PS C:\Users\jonah> Get-Printer | Format-Table
Name ComputerName Type DriverName PortName Shared Published DeviceType
---- ------------ ---- ---------- -------- ------ --------- ----------
OneNote for Windows 10 Local Microsoft Software Pri... Microsoft.Of... False False Print
NPI642118 (HP LaserJet M110w) Local HP LaserJet M109-M112 ... WSD-9a219156... False False Print
Microsoft XPS Document Writer Local Microsoft XPS Document... PORTPROMPT: False False Print
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False Print
Fax Local Microsoft Shared Fax D... SHRFAX: False False Print
Citizen CL-S400DTZ Local Citizen CL-S400DTZ USB001 False False Print
PS C:\Users\jonah> Get-Content -Path "C:\\Users\\jonah\\AppData\\Local\\Temp\\8ea19b4b-22df-4063-ab20-1c56ec8abb81" | Out-Printer -Name "NPI642118 (HP LaserJet M110w)"
The following working on both of my test devices.
@talesluna Would you accept patch which switches the Windows portion to these PowerShell commands or are there intricacies of LPR that I'm not aware of that this solution would omit?
from rust-printers.
@cheng-io This branch has the changes above applied and I'm now able to print on Windows (it does change system_name in the returned list of printers due to what Out-Printer
requires):
https://github.com/jonahgeorge/rust-printers/tree/jonahgeorge-patch-1
Let me know if you have success with it
from rust-printers.
Upon further review, I believe the correct way to accomplish this is with the winspool functions within winapi:
https://github.com/retep998/winapi-rs/blob/0.3/src/um/winspool.rs
from rust-printers.
Thanks for contributing @cheng-io
This issue are fixed by PR #13 (tag v1.2.0)
from rust-printers.
@jonahgeorge Thanks for your proposal with powershell. The latest version has been adjusted based on your fork 👍
Feel welcome to open the PR. I opened this project as a simple utility and I can't always handle it quickly.
from rust-printers.
Related Issues (14)
- Empty Array
- index out of bounds: the len is 0 but the index is 1 HOT 1
- Bug in Clone implementation for Printer
- [bug] one error,Thanks bro. HOT 2
- `wmic` deprecation warning HOT 1
- Specify page size HOT 2
- incorrect result of PDF print_file HOT 3
- Add additional option
- Does this crate have the ability to print pdf in windows? HOT 1
- How to print image HOT 1
- The tspl instruction cannot be parsed
- Windows printer Offline status
- Error: "double free or corruption (out) " while running on linux.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-printers.