Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@zflat
Created July 11, 2017 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zflat/4d2729fb0bcf3091f30fa7cbf9fc4008 to your computer and use it in GitHub Desktop.
Save zflat/4d2729fb0bcf3091f30fa7cbf9fc4008 to your computer and use it in GitHub Desktop.
Printer Job Language sending commands
#! /usr/bin/ruby
require 'socket'
# use printer IP address here
sock = TCPSocket.new('000.000.000.000', '9100')
# Start
sock.write "\u{001B}%-12345X@PJL\n"
# commands
sock.write "@PJL RDYMSG DISPLAY=\"Hello\"\n"
sock.write "@PJL Echo Acme # 123\n"
sock.write "@PJL USTATUS DEVICE = ON \n"
# End
sock.write "\u{001B}%-12345X\r\n"
# sock.each_line do |line|
# puts line
# end
sock.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment