qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.
https://qz.io
Other
855 stars 277 forks source link

Printer status #42

Closed tresf closed 5 years ago

tresf commented 8 years ago

Request to report back the printer status to the user

This'll be tricky one to implement. CUPS has some command line utilities for fetching this info and some printers (LPT, COM) may not support bi-directional communication to the spooler, so we'll need a way to soft-fail when the information is not available.

If Java and the OS support it, we may be able to leverage PrinterStateReason via http://stackoverflow.com/a/5329869/3196753 This does not work.

tresf commented 8 years ago

@bberenz Can we do some testing with PrinterIsAcceptingJobs?

Edit: Talked to @bberenz 7/13/2016 and we'll be doing a proof of concept with this feature as a stop-gap.

akberenz commented 8 years ago

It would appear as though the only state in which PrinterIsAcceptingJobs returns a negative value is when the printer is pending deletion, source.

In short: the Printer is assumed ready to accept print jobs … even if the physical printer is in an error state such as off-line.

While the arguments for it make sense, I'm not sure how useful that would be to any clients. Thoughts?

And it turns out, through looking into the source for the windows print service implementation, that PrinterState always returns null if the service is not considered invalid. So it's not even a configuration problem on that front..

tresf commented 8 years ago

That's a bummer. What about printJobRequiresAttention ?

akberenz commented 8 years ago

Two issues. First, that is under the PrntJobListener, which only starts after the document has been called to print. Second, this only applies to DocPrintJobs, we use PrinterJobs for pixel printing.

tresf commented 8 years ago

So if these are a bust, shall we start looking at the win32 API's and JNI?

dsanders11 commented 7 years ago

Bump. This would be a really useful feature. Looking to move our printing to automated, and need a way to not spam a printer with print jobs if it's out of paper or jammed.

Per @bberenz's two issues with PrintJobListener, here's a StackOverflow answer that has code for an adapter class. Looks like it's mainly about converting the Printable that is used for PrinterJob to a Pageable which can be used to create a SimpleDoc for use with DocPrintJob.

So while you might not be able to proactively query the status of the printer, status could be set after one print job, which is still useful to prevent long running problems.

Vzor- commented 7 years ago

Ok, I'm on this one now. I'll see if I can get a test up using that docPrinterJob tomorrow. I will also do some reading on how we could do this with JNA if we decide to do so.

Vzor- commented 7 years ago

Using DocPrintJob I only received printDataTransferCompleted and printJobNoMoreEvents events. According to the docs this is a limitation of the printing system, though windows is aware there was a problem. I am shelving these changes for now and will investigate them on ubuntu and macOS later.

With that I am going to be shifting to jna, Windspool looks promising.

dsanders11 commented 7 years ago

@Vzor-, bummer. Shocking how incomplete the printer support for Java is.

Vzor- commented 7 years ago

The good news is I have a working test with jna that successfully outputs a printer's status when asked (on windows), now I am making a status monitor so that you can listen for events.

Vzor- commented 7 years ago

These are the logs I got while I was fixing a paper jam that occurred during testing.

Change Result PAPER_JAM: Level FATAL, StatusCode 8
Change Result DOOR_OPEN: Level WARN, StatusCode 4194304
Change Result OFFLINE: Level FATAL, StatusCode 128
Change Result PAPER_OUT: Level FATAL, StatusCode 16
Change Result OK: Level INFO, StatusCode 0

Now I need to attach this code to the event stream.

dsanders11 commented 7 years ago

@Vzor-, is there any update here with the implementation progress?

tresf commented 7 years ago

@dsanders11 Windows is working fairly well on his branch. CUPS hacking is happening as we speak.

dsanders11 commented 7 years ago

Is that branch (could you point me to it?) stable enough to test out? I'm going to have a use case where I need this functionality in the next few days here, so it'd be great if it was stable enough to play with.

tresf commented 7 years ago

@dsanders11 I just remembered, I cloned over a snapshot.

https://github.com/qzind/tray/compare/2.1...printer-status

It doesn't seem to crash the JVM, so I'd say yes, it's stable enough for testing out, especially if you're already on 2.1. I believe 78e9581 and 71bd52b are the only relevant commits. Some of the statuses aren't working yet due to a bitwise calculation problem. It also won't tell you about a status when the software first starts. Those may be show stoppers.

@Vzor- reminder, I squashed and refactored. Make sure CUPS work is rebased on top of printer-status. 👍

@dsanders11 if you hack away at this, let us know and I can grant commit access so you can do it directly against the branch. If you use hangouts, feel free to ping me at tres.finocchiaro@gmail.com so we can coordinate properly.

dsanders11 commented 7 years ago

@tresf, I've tried out the printer-status branch and haven't had any success getting events. The setup is a Windows 7 machine and the printer is a Zebra printer connected via USB.

After listening for events I've tried removing the paper entirely from the printer, and the printer switched from a green light to a red light indicating a problem, but no events were reported via the QZ Tray sample page, or in the logs. I do see something about PrintEvent with Win32 somewhere in there for each print, though. Unplugging the printer entirely also didn't create any events.

Any advice?

tresf commented 7 years ago

@dsanders11 are you using a raw driver or the ZDesigner driver? I would expect the most information to come across with the ZDesigner, which fortunately is compatible with both raw and pixel features.

@klabarge has a Zebra he can test this out on as well. I'll ask him if he's able to trigger any events using Zebra hardware.

In the meantime, I'll ping @Vzor- to fix the bitwise operators for proper status.

Vzor- commented 7 years ago

On it.

Vzor- commented 7 years ago

Ok we are very close to having this working for both windows and linux (and maybe mac too though it needs testing)

@klabarge I have a jar at https://github.com/Vzor-/cupstool/blob/master/cupstool.jar I need some real world examples of what printer statuses look like. Could you run that on linux/mac for me and hit option 4 on some real hardware?

  1. Run the jar with java -jar cupstool.jar
  2. Select option 4
  3. Pick a printer
  4. Report results

I'm interested in how the printer reports errors, and if you can, how it handles multiple errors. ie. paused and out of paper. I would also like some soft warnings like low ink/toner but that is probably too hard test. All data is helpful, during my testing I had an issue where the printer wouldn't report issues unless I queued another job on top of it, this may just be a driver issue on my end. Tell me if you have the same issue.

Thanks in advance

klabarge commented 7 years ago

I'll be able to test against physical hardware early next week.

Vzor- commented 7 years ago

Sounds great

klabarge commented 7 years ago

So far, the status returned by the cupstool.jar correctly matches the printer status in CUPS. I have only tested to a Zebra LP 28244 printer, and I have been unable to get CUPS to report that this printer is out of paper.

The CUPS status is slightly different between macOS and Ubuntu 16.04 (could be different CUPS versions), but so far the utility correctly reports the status

I will test against a different printer for better test results.

Mac to Zebra LP 2844

Printer ready/idle

Status Enum: idle
Status Message: printer-state-message: 1 textWithoutLanguage {}
Status Reason: printer-state-reasons: 1 keyword {none}

Printer off

Status Enum: processing
Status Message: printer-state-message: 1 textWithoutLanguage {The printer is offline.}
Status Reason: printer-state-reasons: 2 keyword {offline-report, connecting-to-device}

Printer out of paper

Status Enum: idle
Status Message: printer-state-message: 1 textWithoutLanguage {Sending data to printer.}
Status Reason: printer-state-reasons: 1 keyword {offline-report}

Printer paused

Status Enum: stopped
Status Message: printer-state-message: 1 textWithoutLanguage {Paused}
Status Reason: printer-state-reasons: 2 keyword {offline-report, paused}

Printer rejecting jobs

Status Enum: stopped
Status Message: printer-state-message: 1 textWithoutLanguage {Rejecting Jobs}
Status Reason: printer-state-reasons: 2 keyword {offline-report, paused}

Ubuntu 16.04 to Zebra LP 2844

Printer ready/idle

Status Enum: idle
Status Message: printer-state-message: 1 textWithoutLanguage {}
Status Reason: printer-state-reasons: 1 keyword {none}

Printer off

Status Enum: processing
Status Message: printer-state-message: 1 textWithoutLanguage {Waiting for printer to become available.}
Status Reason: printer-state-reasons: 1 keyword {none}

Printer out of paper

Status Enum: processing
Status Message: printer-state-message: 1 textWithoutLanguage {Waiting for printer to become available.}
Status Reason: printer-state-reasons: 1 keyword {none}

Printer paused

Status Enum: stopped
Status Message: printer-state-message: 1 textWithoutLanguage {Paused}
Status Reason: printer-state-reasons: 1 keyword {paused}

Printer rejecting jobs

Status Enum: idle
Status Message: printer-state-message: 1 textWithoutLanguage {Rejecting Jobs}
Status Reason: printer-state-reasons: 1 keyword {none}
Vzor- commented 7 years ago

@klabarge This is great, thanks a lot. Though could I get one of the printer idle and in a working state?

klabarge commented 7 years ago

@Vzor- I updated my original comment to add printer ready/idle information

Vzor- commented 7 years ago

Awesome, thanks a lot.

lite1979 commented 7 years ago

I tested a Brother HL-L2380DW printer without paper in Ubuntu 16.04. The cupstool was able to report a media-needed-error

Status Enum: processing
Status Message: printer-state-message: 1 textWithoutLanguage {Waiting for job to complete.}
Status Reason: printer-state-reasons: 2 keyword {cups-waiting-for-job-completed, media-needed-error}

Note that I could not find the media-needed-error message in CUPS (localhost:631), however, it appeared under Printers > Properties > Ink/Toner Levels

Vzor- commented 7 years ago

@lite1979 @klabarge Could you give me the name of the ubuntu driver you are using? To find out, in your browser go to http://localhost:631/printers and click the printer you were using. It will say the driver name right on the header of that page.

klabarge commented 7 years ago

@Vzor- I tried two different drivers/ configurations for the HP LaserJet, and one driver for the Zebra

HP Laserjet P4515

screen shot 2017-06-12 at 10 28 56 pm

screen shot 2017-06-12 at 10 28 42 pm

Zebra LP 2844

screen shot 2017-06-12 at 10 29 13 pm

klabarge commented 7 years ago

Sorry, meant to tag @Vzor-

Vzor- commented 7 years ago

I now have all of the basic features for both Windows WMI and CUPS implemented. Some label printers don't report issues to CUPS well, and on windows, WMI often isn't aware of issues until another job is loaded behind the one that failed. I still have some cleanup to do, as well adding a bit of error handling.

The code is ready for testing. To run it, compile and run the printer-status branch, then open the included sample.html. Everything needed for testing will be under the 'status' tab.

klabarge commented 7 years ago

I uploaded the compiled printer-status branch here: https://github.com/klabarge/tray/releases/tag/v2.1-printer-status

I will report back with testing.

klabarge commented 7 years ago

For the following test results, I used a physical Zebra LP 2844 and Virtual PDF printers.

I need to do more thorough testing to a physical LaserJet printer.

macOS

  1. How often should the status be reported?

This is the result of one successful printRawImage(); job. Perhaps this is because of CUPS, as the status is still displaying "Idle - "Sending data to printer."" in the CUPS interface.

Thu Jul 20 2017 19:34:35 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string offline
Thu Jul 20 2017 19:34:30 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string cups-waiting-for-job-completed
Thu Jul 20 2017 19:34:30 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string offline
Thu Jul 20 2017 19:34:30 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string cups-waiting-for-job-completed
Thu Jul 20 2017 19:34:30 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string offline
Thu Jul 20 2017 19:34:28 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string cups-waiting-for-job-completed
Thu Jul 20 2017 19:34:28 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string offline
Thu Jul 20 2017 19:34:28 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string cups-waiting-for-job-completed
Thu Jul 20 2017 19:34:28 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string offline
Thu Jul 20 2017 19:34:27 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string cups-waiting-for-job-completed
Thu Jul 20 2017 19:34:27 GMT-0400 (EDT): UNKNOWN_STATUS: Level FATAL, StatusCode 33554432, From zebra, CUPS string offline

This is the result of one successful printImage(); job to PDFWriter virtual printer:

Note: This same behavior is seen in Ubuntu 16.04

Thu Jul 20 2017 19:47:04 GMT-0400 (EDT): OK: Level INFO, StatusCode 0, From PDFwriter, CUPS string none
Thu Jul 20 2017 19:47:02 GMT-0400 (EDT): OK: Level INFO, StatusCode 0, From PDFwriter, CUPS string none

Ubuntu

  1. On Ubuntu 16.04, I get the below error when I "Listen to Current Printer" or "Listen to All Printers".

Note that I still receive status alerts, and it appears to be working fine, even with these errors.

[INFO] 2017-07-20 20:46:34,383 @ qz.common.TrayManager:?
    Allowed localhost to listen for printer status
[WARN] 2017-07-20 20:46:34,398 @ qz.printer.status.CupsUtils:?
    Error getting subscription data: java.net.URISyntaxException: Expected authority at index 7: dbus://
[WARN] 2017-07-20 20:46:34,405 @ qz.printer.status.CupsUtils:?
    Error getting subscription data: java.net.URISyntaxException: Expected authority at index 7: dbus://
[WARN] 2017-07-20 20:46:34,421 @ qz.printer.status.CupsUtils:?
    ending 69

All OS

I appear to be getting these messages sporadically on all OS's. I have not found a way to reliably reproduce this yet, however, I have gotten these messages when I was not "Listening" to a printer.

[ERROR] 2017-07-20 21:00:33,084 @ qz.ws.PrintSocketClient:?
    Could not send message
org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, outgoing connection not open
    at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:251)
    at qz.ws.PrintSocketClient.send(Unknown Source)
    at qz.ws.PrintSocketClient.sendStream(Unknown Source)
    at qz.printer.status.PrinterListener.statusChanged(Unknown Source)
    at qz.printer.status.PrinterStatusMonitor.statusChanged(Unknown Source)
    at qz.printer.status.CupsStatusHandler.parseXML(Unknown Source)
    at qz.printer.status.CupsStatusHandler.handle(Unknown Source)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
[ERROR] 2017-07-20 21:00:42,488 @ qz.ws.PrintSocketClient:?
    Could not send message
org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, outgoing connection not open
    at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:251)
    at qz.ws.PrintSocketClient.send(Unknown Source)
    at qz.ws.PrintSocketClient.sendStream(Unknown Source)
    at qz.printer.status.PrinterListener.statusChanged(Unknown Source)
    at qz.printer.status.PrinterStatusMonitor.statusChanged(Unknown Source)
    at qz.printer.status.CupsStatusHandler.parseXML(Unknown Source)
    at qz.printer.status.CupsStatusHandler.handle(Unknown Source)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Vzor- commented 7 years ago

I will add the unknown statuses to our list and those "cups-waiting-for-job-completed" should go away. The uri exception is fine, though I should handle it before it throws an exception. As for mac os, I'm glad it's a jetty error and not a cups error, should be fairly easy to track down.

lite1979 commented 7 years ago

Testing on Ubuntu 16.04

From the bottom up in the status reports, here are my tests in chronological order:

Epson TM-T88V (raw) Epson TM-T88V (pixel - I have two separate queues for printers that can do both raw and pixel-based jobs in Linux) Zebra LP-2844-Z (raw) Zebra LP-2844-Z (pixel) Brother HL-L2380DW with paper in the tray Brother HL-L2380DW with no paper in the tray

https://gist.github.com/lite1979/d6a347c56095b8ddb3082669d5a31ca2

Vzor- commented 7 years ago

Now on to cleaning and refactoring, after that we should be good to go.

tresf commented 7 years ago

@klabarge please prepare a fresh build of the printer-status branch for testing.

klabarge commented 7 years ago

A fresh build of the printer-status branch has been uploaded here

klabarge commented 7 years ago

Testing with this installer on Windows 10.

@Vzor- Let me know if you want me to break these comments into separate bug reports.

    Message: {"call":"printers.find","promise":{},"params":{"query":"printer 1"},"timestamp":1503530141459,"uid":"95trhg"}
[WARN] 2017-08-23 19:15:41,465 @ qz.ws.PrintSocketClient:?
    Bad signature on request
[INFO] 2017-08-23 19:15:42,720 @ qz.common.TrayManager:?
    Allowed localhost to access connected printers
[DEBUG] 2017-08-23 19:15:42,720 @ qz.printer.PrintServiceMatcher:?
    Searching for PrintService matching printer 1
[DEBUG] 2017-08-23 19:15:42,720 @ qz.printer.PrintServiceMatcher:?
    Found 15 printers
[DEBUG] 2017-08-23 19:15:42,720 @ qz.printer.PrintServiceMatcher:?
    Found match: \\UFIFPS\IT Printer 1
[DEBUG] 2017-08-23 19:15:48,126 @ qz.ws.PrintSocketClient:?
    Message: {"call":"printers.startListening","promise":{},"params":{"printerNames":["\\\\UFIFPS\\IT Printer 1"]},"timestamp":1503530148125,"uid":"0hnxmu"}
[WARN] 2017-08-23 19:15:48,127 @ qz.ws.PrintSocketClient:?
    Bad signature on request
[INFO] 2017-08-23 19:15:49,421 @ qz.common.TrayManager:?
    Allowed localhost to listen for printer status
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer PDFCreator
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer Microsoft XPS Document Writer
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer ImageRight Printer BW
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer #CutePDFWriter
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer Microsoft Print to PDF
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer Fake Raw Printer
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer Send To OneNote 2016
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer ImageRight Printer
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer Fax
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Closing thread listening for events on printer ImageRight Printer Color
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterConnectionsThread:?
    Closing thread Printer Connection Monitor
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer Send To OneNote 2016
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer PDFCreator
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer Microsoft XPS Document Writer
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer Microsoft Print to PDF
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer ImageRight Printer Color
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer ImageRight Printer BW
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer ImageRight Printer
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer Fax
[WARN] 2017-08-23 19:15:49,421 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer Fake Raw Printer
[WARN] 2017-08-23 19:15:49,436 @ qz.printer.status.PrinterStatusMonitor:?
    Listening for events on printer #CutePDFWriter
[DEBUG] 2017-08-23 19:15:52,737 @ qz.ws.PrintSocketClient:?
    Message: {"call":"printers.getStatus","promise":{},"timestamp":1503530152733,"uid":"eh8lry"}
[WARN] 2017-08-23 19:15:52,738 @ qz.ws.PrintSocketClient:?
    Bad signature on request
Vzor- commented 7 years ago

@klabarge On windows, it now listens to all printers, then filters the results. If you change the status of a different printer you will see that it doesn't send any info to your client about it. Also the new code is much less verbose about what it is listening to. As for the network printer, I will take a look into it. Is the os aware of the status? I know certain networked printers on windows just don't report any info to the os.

klabarge commented 7 years ago

Is the os aware of the status?

@Vzor- It is (at least minimally), because I paused the printer queue in attempt to get a message and the results are the same. Nothing is sent to the logs or the Event Log in the sample.html. A Windows dialogue also appeared near the tray alerting me that the printer was paused

Additionally, when I "Listen to All Printers", none of the network printer installed on my system are captured (check logs above). They do get listed when listing system attached printers, though.

Vzor- commented 7 years ago

@klabarge Very interesting, I'm attempting to reproduce. Thanks again for the help testing, my personal network printer works fine so I would have never noticed this.

Vzor- commented 7 years ago

Got it reproducing, I just shared it via a homegroup.

Vzor- commented 7 years ago

I have it fixed the logic, but with my setup it doesn't put the printer back into an 'OK' state very easily. Even on the "Devices and Printers" window, the printer shows up as out of paper for minutes after it has been fixed. Then when the printer finally goes back to 'OK' it does so silently, and doesn't throw a event about it until I queue another job. @klabarge Tell me if you have these same issues. No rush on this one.

These problems are likely with Windows itself, they may require an ugly fix.

klabarge commented 7 years ago

Then when the printer finally goes back to 'OK' it does so silently, and doesn't throw a event about it until I queue another job. @klabarge Tell me if you have these same issues. No rush on this one

I tested this quickly and pausing/resuming the printer queue throw an event log immediately.

- Thu Aug 24 2017 20:05:19 GMT-0400 (Eastern Daylight Time): PAUSED: Level WARN, StatusCode 1, From \\PRINTSERVER\Printer 1
+ Thu Aug 24 2017 20:05:07 GMT-0400 (Eastern Daylight Time): OK: Level INFO, StatusCode 0, From \\PRINTSERVER\Printer 1

These problems are likely with Windows itself, they may require an ugly fix

I haven't had luck getting other status messages (eg. tray open) to be triggered. These messages aren't even appearing on the server either, so I'll see if it's possible to get better statuses from Windows. I tested two printers:

@Vzor- Is there a way to get these statuses to be sent to the tray logs? I only see this in the "Printer Status Event Log"

Vzor- commented 7 years ago

@klabarge

I tested this quickly and pausing/resuming the printer queue throw an event log immediately.

Awesome, my issue may have just been a symptom of my strange setup.

Is there a way to get these statuses to be sent to the tray logs?

That is a good question. I could easily do it from a code point of view. It comes down to if @tresf wants it. Something like 'Enable printer status logging' on the dropdown.

tresf commented 7 years ago

I could easily do it from a code point of view. It comes down to if tres wants it.

I'm not sure what's preventing them from making it to the logs to begin with. We should be logging everything to the logger. I haven't reviewed the code to see why.

dsanders11 commented 6 years ago

@tresf, is this DOA or still on the roadmap?

tresf commented 6 years ago

@dsanders11 still slated for 2.1. We shelved it to work on the credit card readers (FileIO). Sorry for the delay. :)

tresf commented 5 years ago

I had forgotten to update this thread. This was merged #351. It's only still open for documentation purposes.

klabarge commented 5 years ago

We do have have it documented here: https://github.com/qzind/tray/wiki/2.1-Printer-Status

Anything in specific you need added before closing?