Printing wit curl from Terminal

52 views
Skip to first unread message

Tjeerd Ytsma

unread,
Feb 19, 2013, 11:02:16 AM2/19/13
to gfr-p...@googlegroups.com
I was reading the API documentation on https://github.com/freerange/printer/wiki/API and trying out some printing from the terminal using curl. 

Generating a preview (curl http://printer.gofreerange.com/preview --data-urlencode content@/tmp/printer-test.html) works fine,

but when I sent the same content to my printer (curl http://printer.gofreerange.com/print/<id-here> --data-urlencode content@/tmp/printer-test.html with my id filled in) it only prints a thick black line. Under 'print archive' on printer.gofreerange.com/my-printer the last print shows

The 'test page', mail&paint app and other html pages from the browser are printing fine. 

I have an other problem when printing without my Arduino connected to the computer through USB, but that is not the case here (see https://groups.google.com/d/msg/gfr-printer/lNawyUoI1Qs/jm5LejcgCKEJ).

So:
1. Why is there a difference between the image generated for the preview and the actual print-job?
2. Why does my print only show a thick black line instead of the unexpected black image from the archive?

Anybody got an idea on how to get this simple example working?

James Adam

unread,
Feb 19, 2013, 11:24:50 AM2/19/13
to gfr-p...@googlegroups.com
On 19 Feb 2013, at 16:02, Tjeerd Ytsma <tyt...@gmail.com> wrote:
when I sent the same content to my printer (curl http://printer.gofreerange.com/print/<id-here> --data-urlencode content@/tmp/printer-test.html with my id filled in) it only prints a thick black line. Under 'print archive' on printer.gofreerange.com/my-printer the last print shows

That's interesting. The "black content" issue typically crops up when the content isn't a fully-formed HTML page, but given that preview works I would definitely expect the printout to also work; it's basically the same pipeline being used behind the scenes. Can you email me the content of "/tmp/printer-test.html"?


The 'test page', mail&paint app and other html pages from the browser are printing fine. 

I have an other problem when printing without my Arduino connected to the computer through USB, but that is not the case here (see https://groups.google.com/d/msg/gfr-printer/lNawyUoI1Qs/jm5LejcgCKEJ).

So:
1. Why is there a difference between the image generated for the preview and the actual print-job?

Great question. With the content from your test page, I can debug this.

2. Why does my print only show a thick black line instead of the unexpected black image from the archive?

This is more likely because the image is so dark that it's causing the paper/print-head to stick, so the printer genuinely is trying to output the black (malformed) image, but what comes out on the paper is a compressed, paper-jam style version of it, which would very likely appear like a thick black line.

- James

Tjeerd Ytsma

unread,
Feb 19, 2013, 11:54:22 AM2/19/13
to gfr-p...@googlegroups.com
Can you email me the content of "/tmp/printer-test.html"?
I literally followed the instructions on https://github.com/freerange/printer/wiki/API, well almost: added </html> to the end as I suppose it is a typo, so it is just:
<html><head></head><body><h1>Printer test page</h1></body></html>
printer-test.html

Tjeerd Ytsma

unread,
Feb 20, 2013, 5:59:09 AM2/20/13
to gfr-p...@googlegroups.com
This is more likely because the image is so dark that it's causing the paper/print-head to stick, so the printer genuinely is trying to output the black (malformed) image, but what comes out on the paper is a compressed, paper-jam style version of it, which would very likely appear like a thick black line.
I confirmed this one with your tips in https://groups.google.com/d/msg/gfr-printer/lNawyUoI1Qs/flq5H3qs-ZcJ. When using different paper I'm able to print the wrong (black) image. 

James Adam

unread,
Mar 6, 2013, 3:35:57 PM3/6/13
to gfr-p...@googlegroups.com
On 20 Feb 2013, at 10:59, Tjeerd Ytsma <tyt...@gmail.com> wrote:

This is more likely because the image is so dark that it's causing the paper/print-head to stick, so the printer genuinely is trying to output the black (malformed) image, but what comes out on the paper is a compressed, paper-jam style version of it, which would very likely appear like a thick black line.
I confirmed this one with your tips in https://groups.google.com/d/msg/gfr-printer/lNawyUoI1Qs/flq5H3qs-ZcJ. When using different paper I'm able to print the wrong (black) image. 

I have updated the server so that the black image bug shouldn't occur anymore, and all pages will have a white background unless otherwise specified.

- James

Reply all
Reply to author
Forward
0 new messages