Skip to content
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

Status "printing" but not printing after using the library #24

Open
Feggah opened this issue Apr 14, 2022 · 8 comments
Open

Status "printing" but not printing after using the library #24

Feggah opened this issue Apr 14, 2022 · 8 comments

Comments

@Feggah
Copy link

Feggah commented Apr 14, 2022

The problem

I'm facing a problem where I'm trying to send a job to print a RAW file to the printer. The job is actually created in the printer jobs list, but the status keeps "Printing" but don't actually start printing.

I thought it could be a misconfiguration on the printer itself, but when I try to print any other document using other program, it prints normally.

What could be done

I don't know if anyone has experienced that and how have you overcome this, any tips would be appreciated.
You can check my code at Feggah/calculator/printer/printer.go

@alexbrainman
Copy link
Owner

@Feggah

Your code looks reasonable. I don't know what your problem is.

I use this command line program

https://github.com/alexbrainman/printer/tree/master/cmd/print

to print raw file data to my printer. You could try my program to see if it makes any difference.

Alex

@Feggah
Copy link
Author

Feggah commented Apr 19, 2022

I tried with your program and it didn`t work as well... see the print below
image

It works if I use "Microsoft XPS Document Writer" as target printer, but if I try to use a real one, it only enqueues the job (status: Printing) but doesn't actually print it. Does it works normally for you?

@alexbrainman
Copy link
Owner

I tried with your program and it didn`t work as well... see the print below

I do not know what the problem is.

Does it works normally for you?

It used to work with variety of OS and printers. I just tried it with current version of Windows 10 and my specific printer, and it does not work.

Sorry.

Alex

@Feggah
Copy link
Author

Feggah commented Apr 20, 2022

No problem, Alex!

The problem that you faced with your printer is the same as mine? The job is enqueued, the status changes to "Printing", but it never prints?

Feggah added a commit to Feggah/calculator that referenced this issue Apr 21, 2022
The printer library is currently not working (alexbrainman/printer#24)

Signed-off-by: Feggah <[email protected]>
@alexbrainman
Copy link
Owner

The problem that you faced with your printer is the same as mine?

I tried using github.com/alexbrainman/printer/cmd/print program to print small text file to my default printer.

The program runs successfully without any errors. But then I get this error message in the corner of my desktop

image

And nothing is printed on the printer.

And my printer queue looks like that

image

And I had to manually delete my print job to clear the queue.

I also run this test in github.com/alexbrainman/printer directory:

go test -run=TestPrinter 

The test passes.

And nothing prints again.

I see no Windows error messages this time.

My print job is still stuck in the queue

image

And I still have to manually delete the job to clear the queue.

I spent some time trying to google for some examples of code similar to mine (in any programming language). And they look exactly the same - they use the same API in a same way. Including Microsoft own examples:

https://docs.microsoft.com/en-us/windows/win32/printdocs/sending-data-directly-to-a-printer

https://docs.microsoft.com/en-us/windows/win32/printdocs/startdocprinter

So I don't know what I am doing wrong.

If you can point me to a source code of any program that works for you, I am happy to spent more time on this.

Alex

@Feggah
Copy link
Author

Feggah commented Apr 22, 2022

Thanks for spending the time debugging it, Alex. I would love to help you more with this but I have no experience with this API and your library looks fine to me, I don't know what is missing 🤔

I did a temporary workaround for this error for now, it isn't the best solution but it works. I used notepad as an intermediary to send a file to my printer, you can check the code in this gist.

What do you think about this temporary solution?

@alexbrainman
Copy link
Owner

What do you think about this temporary solution?

Looks good to me. Assuming your program is allowed to use notepad program.

Alex

@davilatk
Copy link

I have the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants