1
votes

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.

2
Do you have a manual for this printer? You might be able to get technical data for this model here: star-m.jp/eng/products/s_print/index.html. Aha, try: star-m.jp/eng/service/catalog/star_tsp100eco_en.pdf (took a few minutes of searching).halfer
@Tom T did you end up solving this? I am currently doing the same thing with the same printer. I am experiencing print quality issues but it seems to work fine otherwise and works out the end of the document to cut the paper itself.scrowler

2 Answers

1
votes

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);
  1. 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.

0
votes

Your question is not too clear. You did not mention which operating system are you using.

I think, you have two problems

  1. Printing a PDF from PHP. I found this Adobe Reader Command Line Reference

  2. 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.