I am working on a project that will end up printing receipts, my client uses a dot-matrix printer (some old version). He will need a system where receipt printing will be fast i.e. time efficient, and not opening a dialog box and choosing a printer...moreover the printer will be shared through a network.
The main problem is that all this should be done using PHP. the following are some thoughts of solutions.
Design a php script to write data to a text file then print the text file using a remote printer
-the problem is that I am having a hard time getting server side printing from PHP. Logically it seems to work.
Platform =====> WIN XP
Printer Location =====> Main server on a LAN N/W
What's the intended workflow before the user hit's enter?
What's the make and model of printer? This is important so that we can see if it needs any fancy escape codes sent to it?
Usually if you're printing then it would be sent from the client machine.
If printing from the server the data needs to be either sent to the server or needs to already be there and accessible. Is it already there in a database? Or are you sending a webform?
You say RCPT, is this a receipt?
Okay, so if you have the text file created on the server you should be able to copy the text file to lpt1: or 2: or whatever device it's defined as.
You need to know what the file's named as, or you could pass it on, but how about:
exec('c:\WINDOWS\system32\cmd.exe /c START C:\some_dir\print_me.bat');
Related
First of all, sorry for my English, I have been with this problem for quite a few days. I will comment on my situation: I am doing an online ordering system, where once an order is created the ticket printing is triggered. I have tried using Google Cloud Print, it prints but it takes a long time and it does not work as it should, I tried a library called mike42, it prints perfect but not from a website.
The system is in a hosting and I am using PHP together with slim 3, if any of you know how to solve this I would really appreciate it.
The result I want (to be more specific) is the following: The employed user logs on the web (system hosted in the hosting), goes to the orders menu, when he clicks on create the order, this function is executed and prints the ticket directly on the thermal printer connected to the local machine. The same works only if the web is on the local server, which is not what I want.
The title is clear and complete. Printing must take place in client side browser. Client may be connected to a cloud based accounting or purchase system and POS termal printer is connected through a USB port. Computer mat be a zero client with just a browser.
Well, PHP is a server side language, that means it has no communication with the hardware of the local machine.
I've already had to do similar work, and there are two possible solutions:
1- Install PHP on a machine connected to the printer directly, and then print, which is a little impracticable since the server would have to be physically on site.
2 - Generate an output in text formatted for the width of the print and use the window.print () javascript function to call up the print screen, and the user would just click on print.
When I needed it I ended up opting for the second alternative, and it worked well, it is a bit boring to get the print size right, but it worked well.
I am trying to learn how to use php via ajax and interact with wamp and databases. I do not understand how this works & it's slowing my progress significantly.
When I hear/read "upload php files to your server", what does that mean? I was under the impression that you included all files (php/js/html/etc) in the same folder locally when putting a website/app/etc online - am I mistaken? Are files stored on server and then initiated when called?
Where should php files (specifically scripts to pull and send information) be located? Not understanding this is bottle-necking my progress greatly, so thanks for the help.
A server is a Computer with High Specification which keeps running all time so that anyone can have access anytime.
let us see an Analogy.If you had hands on language's Such as C,C++,Python. You must have heard They are High level Language and need to be converted to machine code before they are Executed.
Similarly when we are on web our web browser only understands HTML (That is How to display data on screen)
PHP is a Scripting language (which means how program will work is decided by PHP)
A Database is location Where You can store Data For latter (PHP my need to access this data for computing eg: check if user is a valid user).
When You create a Website You Want a computer That is available all time (server).But they are expensive so You rent some space from Company such as GoDady ..Now This is like having Your own Computer. Uploding Files to Server Means Putting website Files to Your New Computer.
Now suppose You Want to Access your file on your local computer What you do?
C:/myfolder/myfile.php
Similarly on Server 'C' is Your websites Name so if your php file is in myfolder directory on your server.
www.mywebsite.com/myfolder/myfile.php
When you request webpage www.myfle.com it go to the server there it processes Php scripts and sends back only Html components that Browser Understands.
I have an app to make and the basic idea is that a client sits on the master computer whilst a server on the other. You drag and drop a file from one of the child computers, enter the number of copies and send it. (VIA TCP) it is received on the other end and printed.
The problem I am facing is that HOW TO send the FILE (.docx, .pdf, .png, .pptx, etc. ANY FORMAT) for printing.
I can use .NET (ANY), JSP and PHP :)
See this question for an answer on how to automate printing documents using acrobat reader. Basically, you would upload the file to the server and then call the respective acrobat reader command to print the document on a specified printer. To do the same in word, it's a bit more complex, because you'll have to use DDE (dynamic data exchange). Consult the MSDN for further information, I haven't been using it before.
I need a way to capture everything that is printed in my notebook.
Why?
I have a system, in PHP, and sometimes I need to print (php_printer) some invoices, but this costs a lot paper.
Printing is sent in the background without any popup windows for user confirmation.
So every time I send something to the printer, the windows (or any application) show me what was sent; or generate a PDF.
The problem is: How can I use this 'alternativa' without changing the printer (driver, etc). Because, if I do that, I need to test in 2 printers, and you know what I mean.
EscPos
This is the file that I used to print in windows or linux. I develop in windows (requirement of the company) but publish it in a linux server.
gist: https://gist.github.com/patrickmaciel/7673875
What I want
To capture every printed file and save it in a PDF or some driver/application in order to not print the file but rather show it to me on the screen (windows).
Setup
Dev OS (my): Windows 7 (Yes I know, but my employee only works with windows)
Prod OS: CentOS
Printer: TM-T88IV AFU (Epson)
To my question apparently no solution.
So I just edited it with the class and EscPos.php added a method to be executed after printing, writing a simplified way to print invoice in a txt file, which I monitor after filename.txt command tail-f.
Solution code: https://gist.github.com/patrickmaciel/7677891
Thanks guys.
I have a program in a remote server. The users of this program generate a lot of receipt PDF files.
The users of this service need to print these generated PDF's automatically with their local printers. Doing this this manually is too expensive and takes too much time. Is there a way to automatically print the downloaded PDFs?
Automatic print email, works fine.
http://www.automatic-print-email.com/
With this program you can setup your mail account and print message attachments in PDF.
You can configure the frequency mail refresh on seconds, and choose the printer.
Depends on the network architecture you use, but you could think of calling a shell command from php to have the server OS print the files. Additionally, if the user printers are available to the server, you could specify the printer the document has to go to with something like lpr [-Pprinter]...
Of course this requires you to have full control of the server...