Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send low-level escape sequences to a printer on OS X?

I have a string of printer escape sequences (ESC/P) that I need to send to a printer (either USB or network) on Mac OS X. How can I do that? Is using CUPS directly the best way? Is there a "higher level" way?

And before you ask: I really do need to send escape sequences and can't simply use the high-level printing system.

Edit: These are some projects and resources that provide similar functionality in other languages like Java:

  • http://code.google.com/p/escprinter/
  • http://code.google.com/p/escprinter/source/browse/trunk/net/drayah/matrixprinter/ESCPrinter.java
  • http://code.google.com/p/jzebra/
like image 912
Johannes Fahrenkrug Avatar asked Jul 18 '12 12:07

Johannes Fahrenkrug


1 Answers

I would imagine that the best way to do this would be to just use CUPS/lp:

echo "ctrl_char" | cat file_to_print - | lp [...flags...]
like image 58
mamackenzie Avatar answered Sep 20 '22 08:09

mamackenzie