Class: Rpdf2txt::Encoding
Instance Attribute Summary
Attributes inherited from PdfObject
#attributes, #decoder, #oid, #src
Instance Method Summary collapse
Methods inherited from PdfObject
#_parse_attributes, #build_tree, #catalogue_object, #decoded_stream, #extract_attribute_stream, #initialize, #parse_attributes, #revision_id
Constructor Details
This class inherits a constructor from Rpdf2txt::PdfObject
Instance Method Details
#convert_symbol(txt) ⇒ Object
259 260 261 262 263 264 265 266 267 268 |
# File 'lib/rpdf2txt/object.rb', line 259 def convert_symbol(txt) res = '' txt.each_byte { |byte| if(name = differences[byte]) byte = Symbol.byte(name) || byte end res << byte } res end |
#differences ⇒ Object
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/rpdf2txt/object.rb', line 242 def differences @differences or begin @differences = {} offset = 0 idx = 0 @attributes[:differences].each { |diff| if(/^\d+$/n.match(diff)) offset = diff.to_i else @differences.store(offset + idx, diff[/\w+/n]) idx += 1 end } @differences end end |
#symbol_name(byte) ⇒ Object
269 270 271 |
# File 'lib/rpdf2txt/object.rb', line 269 def symbol_name(byte) differences[byte] end |