Class: Rpdf2txt::PageNode

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

Instance Attribute Summary collapse

Attributes inherited from TreeNode

#parent

Attributes inherited from PdfObject

#attributes, #decoder, #oid, #src

Instance Method Summary collapse

Methods inherited from TreeNode

#extract_oids, #root?

Methods inherited from PdfObject

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

Constructor Details

This class inherits a constructor from Rpdf2txt::PdfObject

Instance Attribute Details

#kidsObject (readonly)

Returns the value of attribute kids.



482
483
484
# File 'lib/rpdf2txt/object.rb', line 482

def kids
  @kids
end

Instance Method Details

#build_tree(object_catalogue, parent = nil) ⇒ Object



483
484
485
486
487
488
489
490
491
# File 'lib/rpdf2txt/object.rb', line 483

def build_tree(object_catalogue, parent=nil)
  @kids = []
  extract_oids(@attributes[:kids]).each { |id|
    child = object_catalogue[id]
    @kids.push(child)
    child.build_tree(object_catalogue, self)
  }
  super
end

#eachObject



492
493
494
495
496
# File 'lib/rpdf2txt/object.rb', line 492

def each
  @kids.each { |kid|
    kid.each { |result| yield result }
  }
end

#media_boxObject



497
498
499
500
501
# File 'lib/rpdf2txt/object.rb', line 497

def media_box
  if(mb = @attributes[:mediabox])
    mb.collect { |val| val.to_f }
  end
end