简体   繁体   中英

Printing To a Receipt Printer (pdf)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM