Class: Rpdf2txt::Resource

Inherits:
PdfObject show all
Defined in:
lib/rpdf2txt/object.rb

Instance Attribute Summary

Attributes inherited from PdfObject

#attributes, #decoder, #oid, #src

Instance Method Summary collapse

Methods inherited from PdfObject

#_parse_attributes, #catalogue_object, #decoded_stream, #extract_attribute_stream, #parse_attributes, #revision_id

Constructor Details

#initialize(src = nil, target_encoding = 'utf8') ⇒ Resource

Returns a new instance of Resource.



372
373
374
375
376
377
378
379
380
381
382
# File 'lib/rpdf2txt/object.rb', line 372

def initialize(src=nil, target_encoding='utf8')
	if(src.is_a? Hash)
		@attributes = src
	elsif(src.is_a? String)
		super
	else
		@attributes = {}
	end
	@fonts = {}
    @xobjects = {}
end

Instance Method Details

#build_tree(object_catalogue, parent = nil) ⇒ Object



383
384
385
386
# File 'lib/rpdf2txt/object.rb', line 383

def build_tree(object_catalogue, parent=nil)
	super
    [:font, :xobject].each { |type| build_attributes type, object_catalogue }
end

#font(key) ⇒ Object



387
388
389
# File 'lib/rpdf2txt/object.rb', line 387

def font(key)
	@fonts[key]
end

#xobject(key) ⇒ Object



390
391
392
# File 'lib/rpdf2txt/object.rb', line 390

def xobject(key)
  @xobjects[key]
end