chronister Posted October 3, 2008 Share Posted October 3, 2008 Hello, I have a unique challenge. I need to print to a receipt printer over port 9100. I can manage this part. Here is what I have to do this. <?php $ipAddress = "192.168.1.150"; $toPut = "I can print this no problem \r\n\r\n This line prints too!"; $f = fsockopen($ipAddress, 9100, $errno, $errstr); if (!$f) { echo "Connection To Server Failed ($errstr)"; } else { $x = 0; while($x < 3) { if(fwrite($f, $toPut)) { echo $x.'<br>'; $x++; } } fclose($f); } ?> My challenge here is formatting the text. I am attempting to figure out how to make some text bigger/smaller or print in red (it is a 2 color epson receipt IP-based printer). I have looked at the PostScript Library and it may do what I want it to do, but I am not sure how to push the raw postscript file to the printer and have it print. Anyone have any experience doing this? Thanks in advance Nate Quote Link to comment Share on other sites More sharing options...
aschk Posted October 3, 2008 Share Posted October 3, 2008 I'm surprised that it lets you just send it a string with it'll print for you. I recommend googling the printer and socket connections and printer headers. Most printers communicate in a similar fashion (probably postscript as you mentioned) and as a result you need to pass postscript over the socket to the printer (this will just be a massive string)... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.