Difference between revisions of "Print from pi"
From Publication Station
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Printing from a RaspberryPi to a line printer (dot matrix, receipt printer) can be done quite simply, by simply writing the text to printer using: | Printing from a RaspberryPi to a line printer (dot matrix, receipt printer) can be done quite simply, by simply writing the text to printer using: | ||
echo "hello printer" > /dev/usb/lp0 | echo "hello printer" > /dev/usb/lp0 | ||
Where: | Where: | ||
* <code>/dev/usb/lp0</code> is the location of the printer | * <code>/dev/usb/lp0</code> is the location of the printer | ||
Line 6: | Line 8: | ||
---- | ---- | ||
Sara wants to expand this mechanism, to have ePub's hyperlinks to make the printer print the words under the hyperlink. | Sara wants to expand this mechanism, to have ePub's hyperlinks to make the printer print the words under the hyperlink. | ||
Line 13: | Line 16: | ||
* the server side receives the words and '''writes''' it to the Pi | * the server side receives the words and '''writes''' it to the Pi | ||
==How does server writes to the Pi ?== | |||
* a reverse ssh tunnel that allows the server to | * set a '''reverse ssh tunnel''' that allows the logging in to Pi from remote server. http://www.thegeekstuff.com/2013/11/reverse-ssh-tunnel | ||
* server runs print command over ssh. eg. <code>ssh user1@server1 'df -H'</code> <code>ssh user1@server1 'echo "hello printer" > /dev/usb/lp0'</code> | ** use ssh keys to avoid password requests. | ||
** ensure that '''when Pi boots the ssh tunnel is started''', by making it into a service http://blog.scphillips.com/posts/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/ | |||
* server runs print command over ssh. eg. <code>ssh user1@server1 'df -H'</code> <code>ssh user1@server1 'echo "hello printer" > /dev/usb/lp0'</code> ssh pi.sara 'echo "my sentence" > /root/foo' | |||
==How to to run commands on server from ebook?== | |||
* ebook links to cgi script | |||
** ideally the word wrapped in book would be sent to cgi | |||
** cgi scripts runs command on server, addressed to Pi | |||
[[Category:Research]] | [[Category:Research]] |
Latest revision as of 09:35, 2 June 2016
Printing from a RaspberryPi to a line printer (dot matrix, receipt printer) can be done quite simply, by simply writing the text to printer using:
echo "hello printer" > /dev/usb/lp0
Where:
/dev/usb/lp0
is the location of the printer>
is a write to command
Sara wants to expand this mechanism, to have ePub's hyperlinks to make the printer print the words under the hyperlink.
In order to do so, a possible plan:
- have words in epub under hyperlink pointing towards a server-side script
- ? how can the hyperlinked word be added to href from the hyperlink. Eg.
<a href="http://address.to.server/WORD">WORD</a>
- ? how can the hyperlinked word be added to href from the hyperlink. Eg.
- the server side receives the words and writes it to the Pi
How does server writes to the Pi ?
- set a reverse ssh tunnel that allows the logging in to Pi from remote server. http://www.thegeekstuff.com/2013/11/reverse-ssh-tunnel
- use ssh keys to avoid password requests.
- ensure that when Pi boots the ssh tunnel is started, by making it into a service http://blog.scphillips.com/posts/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/
- server runs print command over ssh. eg.
ssh user1@server1 'df -H'
ssh user1@server1 'echo "hello printer" > /dev/usb/lp0'
ssh pi.sara 'echo "my sentence" > /root/foo'
How to to run commands on server from ebook?
- ebook links to cgi script
- ideally the word wrapped in book would be sent to cgi
- cgi scripts runs command on server, addressed to Pi