lib/escper/printer.rb
def identify(chartest=nil)
      Escper.log "[identify] ============"
      self.open
      @open_printers.each do |id, value|
        init = "\e@"
        cut = "\n\n\n\n\n\n" + "\x1D\x56\x00"
        
        testtext =
        "\e!\x38" +  # double tall, double wide, bold
        "#{ I18n.t :printing_test }\r\n" +
        "\e!\x00" +  # Font A
        "#{ value[:name] }\r\n" +
        "#{ value[:device].inspect }"
        
        if chartest
          Escper.log "[identify] Printing all possible characters"
          print(id, init + Escper::Asciifier.all_chars + cut)
        else
          Escper.log "[identify] Printing infos about this printer"
          ascifiier = Escper::Asciifier.new(value[:codepage])
          print(id, init + ascifiier.process(testtext) + cut)
        end
      end
      self.close
    end
# Open a set of usual printer device paths, print example text, then close the printers.
# +chartest+:: Can be +true+ or +nil+. If true, a character test will be sent to the printer. If false, a test page containing the printer name and printer path will be sent to the printer.
Open a set of usual printer device paths, print example text, then close the printers.
Open a set of usual printer device paths print example text then close the printers .
def identify(chartest=nil)
      Escper.log "[identify] ============"
      self.open
      @open_printers.each do |id, value|
        init = "\e@"
        cut = "\n\n\n\n\n\n" + "\x1D\x56\x00"
        testtext =
        "\e!\x38" +  
        "#{ I18n.t :printing_test }\r\n" +
        "\e!\x00" +  
        "#{ value[:name] }\r\n" +
        "#{ value[:device].inspect }"
        if chartest
          Escper.log "[identify] Printing all possible characters"
          print(id, init + Escper::Asciifier.all_chars + cut)
        else
          Escper.log "[identify] Printing infos about this printer"
          ascifiier = Escper::Asciifier.new(value[:codepage])
          print(id, init + ascifiier.process(testtext) + cut)
        end
      end
      self.close
    end
def identify ( chartest = nil ) Escper . log "[identify] ============" self . open @open_printers . each do | id , value | init = "\e@" cut = "\n\n\n\n\n\n" + "\x1D\x56\x00" testtext = "\e!\x38" + "#{ I18n.t :printing_test }\r\n" + "\e!\x00" + "#{ value[:name] }\r\n" + "#{ value[:device].inspect }" if chartest Escper . log "[identify] Printing all possible characters" print ( id , init + Escper :: Asciifier . all_chars + cut ) else Escper . log "[identify] Printing infos about this printer" ascifiier = Escper :: Asciifier . new ( value [ :codepage ] ) print ( id , init + ascifiier . process ( testtext ) + cut ) end end self . close end
Open a set of usual printer device paths, print example text, then close the printers.
Open a set of usual printer device paths print example text then close the printers .
# double tall, double wide, bold # Font A
chartest