So, long story short, I have a site running in my home off a Raspberry Pi (Raspbian) (secured and not shared with anyone other than me, local within the network) running a down-and-dirty file upload system. I want to configure the server to automatically send any file I send to it to the printer, and print out automatically. I have CUPS installed on the pi, but I have no idea what else to do.
the printer is a wifi printer (Xerox colorcube) if that matters
I was thinking possibly a python script?
Ok so I completed the task, and I am sharing this so any voyagers who stumble across this page don't find it unanswered.
Get the solution at the github repo
Related
im making a backend but i need to print out tickets in POS Printers, so i will explain why im asking
1.- long time ago a friend had a server (10.0.0.1) and client computers (10.0.0.2 , 10.0.0.3, etc)
so i was watching that their php POS was hosted in the LAN server so how they was printing?
2.- In the client machines (in the same lan) each machine was running wamp wit a *.txt file with the margins of the tickets and one php script called print.php so when they was asking the server (10.0.0.1) to print they was printing locally
any ideas how to achieve this? i was playing with Mike 42 ESC-Pos and runs fine but for print on a network im watching that needs the printers running on LAN or by Netbios
warm regards and thanks in advance!
So here is what I wanted to do. I have an Apache2 server up and running on my raspberry pi 3, which is currently serving as a webradio using php commands and mpd/mpc. The raspberry is also connected via HDMI to a display.
I now like to have another page on the webserver which let's me start different roms in an emulator and display the output signal on the display connected to the remote server and and also lets me use a controller connected also to the remote server.
This is what I have done so far.
I have successfully installed Retroarch which is up and running.
I used exec("export DISPLAY=:0.0; retroarch -c /home/pi/path/to/config -L /home/pi/path/to/libretro/core /home/pi/path/to/rom") to start the emulator on the remote sever.
The problem is as follows. Even though I started the emulation successfully on the screen I cannot use the input devices connected to the remote server. How can I make the input devices of the server accessible with a php-command or something else? Can somebody point me to a solution to achieve this? Also the exec-command does not seem to accept my arguments besides the config file argument. I guess it has to do with user rights. But I am really stuck at this point.
Thanks for any replies.
Disclaimer: This is my first post. So I am sorry for bad terminology.
I have a web-based point of sale application on PHP apache. User access the POS from another computer (within the network) to perform the transaction, then print on their local machine. Currently the print format is in html, displayed and printed on the user machine.
I am planning to add support for receipt printer like epson thermal or dot matrix, star. I have searched code escpos php code that might be good for printing to these printers. (https://github.com/mike42/escpos-php)
I read that this script prints locally on server machine or networked printer. But problem is, the printer I am using on the client side only support USB or serial/parallel. How do I send escpos character directly from server to client printer?
To be able access local USB deviced via the Webserver would be a huge security risk. Just think of a "evil" server that prints the whole wikipedia on any printer connected to a client, for example.
I don't think that there is a way to access any client-connected USB device with a simple web-based server software.
I would suggest either to
get a receipt printer that shows up as a regular printer and just
styling your receipts accordingly
write a Thick Client instead or
write a "print-agent" that regularly checks the server if there is any job for the locally connected receipt printer.
Either way, I do not think that, at this point, there is much use for PHP.
You could, of course, try tunneling USB via IP, but that would be quite a hassle to setup and maintain.
I know this reply may be too late but I will still leave my answer for anyone that will be needing this in the future.
You can setup a PHP script in your local machine which you can trigger in your remote app once a print button is pressed (maybe via a javascript window open which opens the URL of your local script). That PHP script contains code for printing your receipt using your local thermal printer. You can get the data via API from your remote app. This is somehow somehow a dirty solution but I think this is much safer instead of opening a port just for printing.
I've got a Epson Thermal printer, model TM-T20 which I'm setting up for clients.
Our webserver is a linux server, and the client machines will be Windows machines.
Is it possible with php, to directly control the thermal printer attached to the clients computer?
I have looked at javascripts window.print(), but that is not what I want, if possible I want to bypass the print dialog.
Thanks,
Tony
No. PHP has absolutely nothing to do at all with the client's printer. If the printer was attached to the machine the PHP script is running on (i.e. the server), there may be something you could do. As it is, PHP only sends text to the client. From there, the client's browser and printer software has to handle it.
Alternatively, if the Windows box ran a print server exposing the printer that PHP could talk to over the network, you could talk to the printer directly. But that wouldn't be a normal PHP server/client relationship anymore.
printing from php isn't that easy, most web apps i have seen generate a pdf and and the clients print that.
have a look at http://www.vendhq.com/ they do a point of sale app for shops, and have something you need to download and install to print till dockets via a receipt printer. it might give you some inspiration
I have done exactly this before. It was quite tricky, using a ubuntu server on the workplace's LAN and a thermal printer on another ubuntu computer in the shipping area. That computer was running a php service listening to a port and was headless, hiding inside the cabinetry.
The business's internal web php "application" on the LAN server would coordinate with their e-commerce and UPS.com to print a shipping label. I forgot how UPS sent it but we used imagemagik to tweak the final image to the perfect pixel width. Then the LAN server would connect to the target's php socket server and it would send the proper commands to the serial port that the printer was connected to, along with the image data.
To call that solution madhatterey is an understatement... but was quite amazing to have labels appear magically upon "shipping" an order. No print dialog or anything. Cheapest solution is get an Atom box that can run Ubuntu and get a printer with a ppd file that works. Then just queue it up properly. Same concept as remote printing in linux.
You could possibly do the print request from a webpage's AJAX request and not need the extra infrastructure (or target computer's php socket server).
I developed a chat application with an attendant chat server. Everything is working fine. The issue now is the fact that whenever the chat server goes down (for instance, the server system shuts down as a result of power failure or some other problem), by the time the server system come back on, the chat server would have to be restarted manually.
I believe (and I know) it is more appropriate for the chat server application to restart itself when the computer comes back on (and of course regardless of who is logged in and of course, even before anyone logs in). I have a batch file that executes the chat server. My attempt was to create a windows service that start automatically and runs this batch file using a Network Service account on the server system. Although, I'm having a hard time with this (temporarily), I would love to ask if there are any alternatives to using a windows service. Suggestions are highly appreciated.
Creating a windows service will be the better solution, but you can add your batch file into the startup folder.
I think you are already having the better solution (Wibndows Service). Along with adding an email alert or some sort of alert when the server restarts will be handy (?).
I would probably just start the server using the Windows Task Scheduler. You can set a task to start on system startup: