Class: PDFDirectPrint::RawPrint
- Inherits:
-
Object
- Object
- PDFDirectPrint::RawPrint
- Defined in:
- lib/pdfdprint/raw_print.rb
Overview
Raw network printing using TCP port 9100 of network-enabled printer
Instance Attribute Summary collapse
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
Instance Method Summary collapse
-
#initialize(options) ⇒ RawPrint
constructor
A new instance of RawPrint.
- #print(file) ⇒ Object
Constructor Details
#initialize(options) ⇒ RawPrint
Returns a new instance of RawPrint.
9 10 11 12 |
# File 'lib/pdfdprint/raw_print.rb', line 9 def initialize() = @pjl = setup_pjl end |
Instance Attribute Details
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
7 8 9 |
# File 'lib/pdfdprint/raw_print.rb', line 7 def end |
Instance Method Details
#print(file) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pdfdprint/raw_print.rb', line 14 def print(file) s = TCPSocket.open([:printer], [:port]) @pjl.each do |_key, command| s.syswrite(command) end File.open(file, 'rb') do |f| f.binmode s.syswrite(f.read) end s.syswrite("#{27.chr}%-12345X") s.flush s.close true rescue StandardError => e = e. false end |