Method: PDF::Reader::Parser#hex_string
- Defined in:
- lib/pdf/reader/parser.rb
#hex_string ⇒ Object
Reads a PDF hex string from the buffer and converts it to a Ruby String
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/pdf/reader/parser.rb', line 99 def hex_string str = "" loop do token = @buffer.token break if token == ">" str << token end # add a missing digit if required, as required by the spec str << "0" unless str.size % 2 == 0 str.scan(/../).map {|i| i.hex.chr}.join end |