0
votes

we are developing a system for restaurant chain so we have to print the receipt on the printer using IPaddress of the printer

They are Already having a printer of Star Micronics TSP700II. so we have to use those printer

In Epson we having EPOS SDK to print from WEB Environment

But for Star We are unable to use WEBPrint SDK. so what i have did is i have used a socket to print from direct PHP code itself on ipaddres of printer as given Below as .NET Using

$fp=pfsockopen("192.168.0.145", 9100);
if($fp)
{
  fputs($fp, "This is Start\nBreak Now");
  fclose($fp);
  echo 'Successfully Printed';
}

And i got success also . but now issue is Star and EPSON have their Pre defined codes to Cut , Feed a Line , Bold , Color the fonts. so from .NET they doing their codes to Convert bytes

public static        string Cut = Convert.ToChar(29) + "V" + Convert.ToChar(65) + Convert.ToChar(0);

This is direct command to cut the paper from printer after complete print receipt

So how i can use this command in php or is their any other way to print

1

1 Answers

1
votes
$cut = chr(29) . 'V' . chr(65) . chr(0);

fputs($fp, $cut);

That is how to specify ascii in PHP.

Weird that they would write it that way - ASCII 65 is 'A'.

This is different than what I see as the cut command in the TSP manual http://www.starmicronics.com/absolutefm/absolutefm/afmviewfaq.aspx?faqid=111 . There it lists ESC d n where n is 0-3, which would be:

$chr = chr(27) . 'd' . chr(0); // or chr(1) or chr(2), or chr(3)

Is the cut command you listed for Epson?