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 Link to comment https://forums.phpfreaks.com/topic/126906-printing-to-network-printer-using-fsockopen/ 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)... Link to comment https://forums.phpfreaks.com/topic/126906-printing-to-network-printer-using-fsockopen/#findComment-656392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.