I've found that I can print raw EPL2 commands to my Zebra 2844 (UPS) from Windows apps like Notepad and WordPad and get a nicely printed label using the Generic / Text driver in XP (couldn't get the actual Zebra drivers to do this much). But for some reason, I can not get it to print from IE8 (which is necessary for my php application). Nor from Firefox for that matter. When I print, the file goes to the printer's queue and quickly disappears. Nothing is printed.
I'm setting the header to Content-type: text/plain in php. But I've also tried loading the text file directly from the Desktop and printing with no luck.
Anyone run into this issue and have a solution? Perhaps there is a nuance in printing from a web browser that I'm not taking into consideration?
What you need is a way to get past the Windows Print layer, try this: http://code.google.com/p/jzebra/
It is a java applet that once you accept the security certificate can access the printer natively
Related
I'm trying to print ZPL Code generated by my web-interface to a Zebra printer(Zebra GK420d)configured as Generic / Text Only printer this works fine in firefox.In Chrome and IE it is not working. I am using latest IE and Chrome versions and my Operating system is windows 8. I cleared my cache and cookies and tried. But i am unable to print. Here is my sample zpl barcode like this.
^XA ^FWR ^FO 425,450^A0,20,30
^FH^FDCHEDDI_20JAGAN_20AIRPORT_20GUYANA_20OWN_20CLEARING^FS
^FO 300,450^AD^BY2 ^BC,100,Y,N,N ^MD1 ^FO 300,450^A0,20,30^FH^FDDATE_3A14-10-2014^FS
^FO 200,450^A0,20,40^FH^FDLTX106970_2D1_281_29_2D_UGAC^FS ^XZ
Please help me how to resolve this problem.Thanks in advance
The answer is, by default, you can't print directly to a Generic/Text-Only printer profile from the Chrome browser. Chrome pre-processes/renders all prints, which takes away the raw text delivery to a printer. It would actually render the characters of the text rather than sending the raw text itself. There used to be an option to enable the Text-only setting in Chrome, but it was removed somewhere around version 22.
There is a project called JZebra/qz (https://code.google.com/p/jzebra/). This will allow you to print to the Zebra printer from the Chrome browser. This requires Javascript added to your site in the printing process code, and requires Java on the client's computer. It will ask to install a little Java program to their computer to intercept and handle the special printing scenarios. If your client doesn't have or want Java or the installed program on their machine, it won't work. You can use the free/unsigned version of the program, but there is a cost if you want a digitally signed version of the consumer-downloaded Java application.
I have been tasked with figuring out how to get our zebra label printers(mostly the 420t models) to print over the network from calls in one of our PHP applications. I've come up with a couple of ideas but wanted to run it past people more knowledgeable than I am before I start down one path or the other.
Setup a machine to be a print server which has the zebra on USB as the default printer. I'd have to write some sort of print queue script or something to run on this machine.
Get a zebra printer with a network port and directly send print requests to it. I have seen a couple of other SO questions about it and it seems to require sending in the RAW over sockets. From the answers on these questions it seemed like there were some issues with doing this.
Send the print request via FTP somehow as mentioned in a few places.
Use either 1 or 2 with the LPR library.
What do you guys suggest?
I use intersively the second solution at work, ie using network enabled printers, and sending them (via cURL to the printers IP) data from a .prn file with my replacements.
The models we use are G4K20d.
I have a website which runs a box office service which issues tickets and reports. I am trying to figure out how to get tickets (currently PDFs) sent directly to a specified printer on a local/client PC.
I have followed many old/dead/useless links and have not found any up-to-date solutions to this although many tantalising glimmers of hope.
The scenario is this: Remote hosted website - 1 or more users connected - web page generates ticket/s (PDF) which is sent to a specified printer on the user pc (not the default printer) silently (no extra clicking through of print prompts).
I know PHP does not connect to a clients pc but is there a way for a web page (via jQuery perhaps) to connect to an installed script/service?
I was thinking the script on a local PC (which establishes a trusted link, sets the printer to use, etc) would receive data/file from the web server and then process it as long as it was in the same place on every machine. This (local) script then can be added to any PC that needs to run the service. The work would need to be trigged by the file being sent and not having a script/service which is sat polling a location every few seconds.
Any pointers would be greatly appreciated.
Edit: I have tried the jZebra java applet but only got it printing once before it broke. Interested if anyone has actually got it to work (and how).
I ran into the EXACT same question recently myself. Google Chrome has what's called a "kiosk" mode. Therefore, it will print without user intervention.
To do this, open Google Chrome with the following command (you need to find the chrome executable, or chrome command for *nix machines):
chrome.exe "http://www.example.com/mypage.php" --kiosk --kiosk-printing
This will open a window without any toolbars, address bars, omniboxes, etc.
Next, you need to make a page print. To do this, automatically open a print dialog (for demonstration, I'll use simple Javascript):
<script>
window.print();
</script>
Before you jump over to your development environment, window.print() does NOT allow any arguments (i.e. a URL).
This code opens a print dialog. However, in kiosk mode, the print dialog will be bypassed, and the page will be automatically printed to the default printer.
Now you mentioned a PDF, and chances are, your generating it via PHP (if you are printing issued/generated files), your probably thinking "oh, well I can't put HTML in the PDF to execute the javascript". You don't need to! To solve the issue of printing the correct page, here's how:
Insert the following into an HTML/PHP page that the user is sent to (for this solution, the user does not need to visit the .pdf), in the <head> of the landing/success page:
<link rel="alternate" media="print" href="LINK TO PDF FILE">
If you have the above code in your page, when you execute window.print();, it will print the page specified above. If you don't save the PDF locally, you can put it in a temporary directory that is somehow (out of the scope of this question) cleared on a time based or action based schedule, to prevent disk space buildup.
Keep the following in mind:
Kiosk mode doesn't have an exit button. To exit, press ALT + F4.
When printing in kiosk mode, you need both --kiosk AND --kiosk-printing. The printing argument requires the --kiosk argument.
When printing in kiosk mode, it is normal for the print dialog to appear and then suddenly disappear. It can't be prevented without advanced window layering and whatnot.
I'm sure that other browsers have similar functionality to bypass the print dialog, however, I have found that Google Chrome works best in this kind of functionality. If your on a Linux machine, Google has a .deb file that you can install Google Chrome on Linux with, by using the command sudo dpkg -i (package / downloaded .deb file path). Chromium --might-- support this kind of functionality. As far as I know, it should.
If you need additional help, leave your question in the comments below, I'll respond ASAP.
I hope I helped. If I did, feel free to give me a green check to your left. ;)
I would like to use a receipt printer with my web based POS.. Before i go any further i know you can not force print a receipt from the browser and the only options are to do it via PHP, and cups, which is not an option or a Java Applet, Prefer no to..
My question is im looking at the Star Micronics TSP-100 and would like to send a PDF to it. I have looked all over and can not find if receipt printers will print standard PDF's..
Also if anyone has any experience with this any tips would be helpful.. Ie what page size do you set?
EDIT: The server platform is Linux, PHP / MYSQL and im using Yii with the epdf plugin. PDF generation is not the issue. It unclear if a receipt printer can print a pdf. Also what page properties should i use when setting up the document. Ie width / height.. Width i know is determined by the printer, but im curious to height.
You cannot force a receipt print from the browser but you can use an Active X control (in IE) and print the receipt locally.
What I did was:
1. generate the pdf on the server
2. call an Active X command to download the PDF using wget (this puts the file on the local machine.
objShell.run('cmd /K wget -P /pos/invoices/ http://url.com/pos/<?php echo $filename;?>',0,false);
call an Active x command to print the local PDF using Adobe command line
objShell.run('"C:\\Program Files (x86)\\Adobe\\Reader 11.0\\Reader\\AcroRd32.exe" /h /s /o /t "C:\\pos\\<?php echo $filename;?>"');
In order to print to your receipt printer, you just need to set it as default printer or change the Active x commands to include the printer name. I am still working on the paper size issue.
I realize you are using Linux so the Windows commands will not work but the process is the same.
Your question is not too clear. You did not mention which operating system are you using.
I think, you have two problems
Printing a PDF from PHP. I found this Adobe Reader Command Line Reference
Generating a PDF from a template. I can recommend wkhtmltopdf, which is exists for MS-Windows and Linux platforms. It uses WebKit to render page, so the source is plain HTML+CSS.
I am currently adding features to a PHP web application for a client. They require to be able to print some raw data to a ticket / thermal printer direct from the php which will be run on an internet browser from a self service kiosk.
The data needs to printed on the local kiosk's in built ticket printer.
From my preliminary research I understand that I must perform this task using javascript for any client side actions and wondered if anybody knew of any method or example function that will allow the printing of a string to a designated printer / com port which would bypass the printer dialog box?
Thanks in advance for any help
Alex
This plugin requires Java installed client-side, but after the first security prompt, this will do what you need (works with Linux, Mac, Windows, Solaris -- anything that can run Java desktop application)
https://github.com/qzind/tray
If it has to be cross browser and platform independent, stop right now and run. There is NOT way, and I mean NO way for Javascript to access information about printers, margins, paper size, and all the variables in printers. Even if your browser has some sort of fast print button, print using default settings and default printers, you have no idea the type of paper, the ink, the margins, etc, and you could be printing on A4 paper, or in the US, our legal size, 8.5" X 11.5".
Browsers, for security, do NOT give javascript any access to this information that is supplied to them by the Windows API and the printer drivers. The closest possible that I know of, is in small networks, where the variables are known, and configured using Internet Explorer's JScript or ActiveX. Short of this, your only other easy option is to write your own web browser/addon/plugin, or to modify one that will run on these platforms, that has this built in capability.
More info available here.
EDIT: Though if you really want to make your life simple, tell them to install Firefox, and check out this article for the simplest solution possible. Also, have you considered VBScript? It has this capability, I've seen it done before.
Not possible, at least not without some extra steps.
Without knowing more about the kiosk environment, you have three main options:
1). Install a Web service on the local kiosk. This Web service would manage printing and ultimately be the most extensible solution.
2). Create a plug-in for the print service. This would be uglier, and really tie you to a single browser solution forever.
3). Wrap the browser in custom code to allow external calls. Again, somewhat ugly, but since you're running a kiosk, you're likely to have some sort of custom/extensible wrapper anyway.