Class: EideticPDF::PdfObjects::PdfPage

Inherits:
PdfPageBase show all
Defined in:
lib/epdfo.rb

Overview

one page of a PDF document, not counting resources defined in a parent

Instance Attribute Summary

Attributes inherited from IndirectObject

#gen, #seq

Instance Method Summary collapse

Methods inherited from PdfPageBase

#additional_actions=, #crop_box=, #duration=, #hidden=, #media_box=, #resources=, #rotate=, #transition=

Methods inherited from PdfDictionaryObject

#dictionary

Methods inherited from IndirectObject

#footer, #header, #reference_object, #reference_string, #to_s

Constructor Details

#initialize(seq, gen, parent) ⇒ PdfPage

Returns a new instance of PdfPage.



762
763
764
765
# File 'lib/epdfo.rb', line 762

def initialize(seq, gen, parent)
  super(seq, gen, parent)
  dictionary['Type'] = PdfName.new('Page')
end

Instance Method Details

#annots=(annots) ⇒ Object



786
787
788
789
790
# File 'lib/epdfo.rb', line 786

def annots=(annots)
  # annots: array of dictionary objects
  (@annots ||= []).concat(annots)
  dictionary['Annots'] = PdfArray.new(@annots.map { |annot| annot.reference_object })
end

#beads=(beads) ⇒ Object



792
793
794
795
# File 'lib/epdfo.rb', line 792

def beads=(beads)
  # beads: array of dictionary objects
  dictionary['B'] = PdfArray.new(beads.map { |bead| bead.reference_object })
end

#bodyObject



767
768
769
770
771
772
773
774
# File 'lib/epdfo.rb', line 767

def body
  if contents.size > 1
    dictionary['Contents'] = PdfArray.new(contents.map { |stream| stream.reference_object })
  elsif contents.size == 1
    dictionary['Contents'] = contents.first.reference_object
  end
  super
end

#contentsObject

PdfStream’s



777
778
779
# File 'lib/epdfo.rb', line 777

def contents
  @contents ||= []
end

#thumb=(thumb) ⇒ Object



781
782
783
784
# File 'lib/epdfo.rb', line 781

def thumb=(thumb)
  # thumb: stream
  dictionary['Thumb'] = thumb.reference_object
end