Access client printers on the local network from the local server


Naruto Uzumaki

I'm testing a website with two computers connected via router and ethernet cable, one of the PCs has a WAMP website on it and acts as a server.

Everything is fine and working, but there is one problem. I have written PHP to print the final receipt via a thermal printer and it works flawlessly when printed on a server computer connected to that thermal printer via USB.
Now the question is, when the second computer that is the client accesses the website, how will it print the receipt via the thermal printer connected to it via USB? The server cannot find a printer connected to the client.

Of course, if I want to access the client's printer, I think JavaScript is the best way to do it, but this has one big flaw.
When I load the printable into a new window using window.open()and then write data to it. Then I called window. print();and it did print the content, but it didn't stop. After printing the data on the receipt, it keeps pushing the empty receipt out of the printer and never stops.

The PHP works fine, it just prints the data and then stops so I can tear off the receipt. When using JavaScript, why doesn't the printer stop after printing the data.

please help. It's the only thing left.

Naruto Uzumaki

OK, I found a solution. Thermal printers have four basic functions

1 - read data

2- print on paper

3- Decide the length of the paper to be output

4- Cut the paper after printing.

I tried using window.print() to do this because I couldn't find anything about "printing from local server to client printer using php".

Using Google Chrome, this is what happened

After clicking the print preview button, it showed me the data zoomed out to the point where it was barely visible. More specifically, the data looks like a thick black line, and the rest is a long white page that scrolls almost infinitely. The printer starts printing when the "Print" button is pressed and does not stop until the competing roll is complete. The header contains the actual data, while the rest of the entire larger length is blank.

Using internet explorer is even worse than google chrome because it keeps asking for a new roll to print more white blank pages even after the roll is done...

Then I met the champion. Firefox browser. When I click the "Print Preview" button, it shows me the exact size of the paper I'm going to put the data on...and the last thing I want is that Firefox calls the cut() thermal when it finishes printing the receipt The function of the printer is to cut the receipt so that it can be easily pulled out of it.

Then enter about:config in Firefox's search bar and search for "print". I was really surprised to see so many options for printing, it's more than I expected from a receipt printed from a browser page. I can literally template the receipt and save it. After that, whenever I print the receipt, it will be printed in that template.

Thanks for looking at my question. Hope this helps someone...

Related


Access client printers on the local network from the local server

Naruto Uzumaki I'm testing a website with two computers connected via router and ethernet cable, one of the PCs has a WAMP website on it and acts as a server. Everything is fine and working, but there is one problem. I have written PHP to print the final recei

Access client printers on the local network from the local server

Naruto Uzumaki I'm testing a website with two computers connected via router and ethernet cable, one of the PCs has a WAMP website on it and acts as a server. Everything is fine and working, but there is one problem. I have written PHP to print the final recei

Access client printers on the local network from the local server

Naruto Uzumaki I'm testing a website with two computers connected via router and ethernet cable, one of the PCs has a WAMP website on it and acts as a server. Everything is fine and working, but there is one problem. I have written PHP to print the final recei

Alfresco, access server from local network

Ascend I am trying to perform in the open air. It is installed on the local server. Tomcat is the web server used by Alfresco to provide access to the web panel. The default ip is: 127.0.0.1:8080; Now, I want to gain access from another local computer. The IP

Access the local server from other computers on the network

learner I have a server on my computer and it is set --address=0.0.0.0up so that it can be accessed from other computers in the network. Now my question is, what address do other computers type as they can access the server? On the managed computer, I can do i

Alfresco, access server from local network

Ascend I am trying to perform in the open air. It is installed on the local server. Tomcat is the web server used by Alfresco to provide access to the web panel. The default ip is: 127.0.0.1:8080; Now, I want to gain access from another local computer. The IP

Apache server allows access from local network

Matthew Meehan optional I've installed fedora server but can't seem to get web requests through it. I can ping it, and as far as I can tell, apache is functioning fine on the computer. I listen on httpd.conf as Listen *:80 and the server name is ServerName 19

Alfresco, access server from local network

Ascend I am trying to perform in the open air. It is installed on the local server. Tomcat is the web server used by Alfresco to provide access to the web panel. The default ip is: 127.0.0.1:8080; Now, I want to gain access from another local computer. The ser

Access the local server from other computers on the network

learner I have a server on my computer and it is set --address=0.0.0.0up so that it can be accessed from other computers in the network. Now my question is, what address do other computers type as they can access the server? On the managed computer, I can do i

Apache server allows access from local network

Matthew Meehan optional I've installed fedora server but can't seem to get web requests through it. I can ping it, and as far as I can tell, apache is functioning fine on the computer. I listen on httpd.conf as Listen *:80 and the server name is ServerName 19

Alfresco, access server from local network

Ascend I am trying to perform in the open air. It is installed on the local server. Tomcat is the web server used by Alfresco to provide access to the web panel. The default ip is: 127.0.0.1:8080; Now, I want to gain access from another local computer. The ser

Unable to send data from server to client on local network in C++

Tabish Sefula I need to communicate between two systems on a local server. So I decided to use "socket" programming in C++. For this I follow this tutorial. I made some changes as needed, like changing the port number, IP, etc. and it all worked fine. Now the

Unable to send data from server to client on local network in C++

Tabish Sefula I need to communicate between two systems on a local server. So I decided to use "socket" programming in C++. For this I follow this tutorial. I made some changes as needed, like changing the port number, IP, etc. and it all worked fine. Now the

Access VirtualHost from local network

Atomicization I installed Ubuntu Server 18.04 on a VirtualBox VM and installed Apache and Nginx in it for testing. VirtualServer example.com is running on the local machine. This VM is configured with 2 network adapters, the first is configured as internal net

Access VirtualHost from local network

Atomicization I installed Ubuntu Server 18.04 on a VirtualBox VM and installed Apache and Nginx in it for testing. VirtualServer example.com is running on the local machine. This VM is configured with 2 network adapters, the first is configured as internal net

Access VirtualHost from local network

Atomicization I installed Ubuntu Server 18.04 on a VirtualBox VM and installed Apache and Nginx in it for testing. VirtualServer example.com is running on the local machine. This VM is configured with 2 network adapters, the first is configured as internal net

Unable to access web server from local virtual network

Akalenuk I have installed several virtual machines. Some uder Windows, some under Fedora Linux. On one of the Fedora machines, I have the Apache web server installed. 172.16.27.129:80I set the server name in httpd.conf to , make sure access to the html directo

Unable to access web server from local virtual network

Akalenuk I have installed several virtual machines. Some uder Windows, some under Fedora Linux. On one of the Fedora machines, I have the Apache web server installed. 172.16.27.129:80I set the server name in httpd.conf to , make sure access to the html directo

websocket cannot access local network client service

Sinix I'm having some trouble with websocket connections in my local network. Imagine: For my laptop (Win7), I wrote a service that opens a websocket server to port 2014. Since Windows 7 doesn't have Websocket enabled by default, I'm using the Supersocket libr

The client and server are not connected over the local network

surreptitiously I am trying to connect my server application and client application, one on my computer (host) and the other on my guest computer (client). My guest machine's JAR file won't connect, just closes the stream... Am I missing some critical informat

The client and server are not connected over the local network

surreptitiously I am trying to connect my server application and client application, one on my computer (host) and the other on my guest computer (client). My guest machine's JAR file won't connect, just closes the stream... Am I missing some critical informat