Parent

Namespace

Included Modules

Class/Module Index [+]

Quicksearch

Origami::Page

Class representing a Page in the PDF document.

Public Class Methods

new(hash = {}) click to toggle source
# File lib/origami/page.rb, line 464
def initialize(hash = {})
  super(hash)
  
  set_indirect(true)
end

Public Instance Methods

add_annot(*annotations) click to toggle source

Add an Annotation to the Page.

# File lib/origami/page.rb, line 479
def add_annot(*annotations)
  unless annotations.all?{|annot| annot.is_a?(Annotation) or annot.is_a?(Reference)}
    raise TypeError, "Only Annotation objects must be passed."
  end
  
  self.Annots ||= []

  annotations.each do |annot| 
    annot.solve[:P] = self if is_indirect?
    self.Annots << annot 
  end
end
add_flash_application(swfspec, params = {}) click to toggle source

Embed a SWF Flash application in the page.

# File lib/origami/page.rb, line 517
def add_flash_application(swfspec, params = {})
  options =
  {
    :windowed => false,
    :transparent => false,
    :navigation_pane => false,
    :toolbar => false,
    :pass_context_click => false,
    :activation => Annotation::RichMedia::Activation::PAGE_OPEN,
    :deactivation => Annotation::RichMedia::Deactivation::PAGE_CLOSE,
    :flash_vars => nil
  }
  options.update(params)

  annot = create_richmedia(:Flash, swfspec, options)
  add_annot(annot)

  annot
end
annotations() click to toggle source

Returns the array of Annotation objects of the Page.

# File lib/origami/page.rb, line 507
def annotations
  annots = self.Annots
  return [] unless annots.is_a?(Array)
  
  annots.map{|annot| annot.solve} 
end
draw_image() click to toggle source

TODO :nodoc:

# File lib/origami/graphics/xobject.rb, line 458
def draw_image
  raise NotImplementedError
end
draw_line(from, to, attr = {}) click to toggle source

See ContentStream#draw_line.

# File lib/origami/graphics/xobject.rb, line 463
def draw_line(from, to, attr = {})
  last_content_stream.draw_line(from, to, attr); self
end
draw_polygon(coords = [], attr = {}) click to toggle source

See ContentStream#draw_polygon.

# File lib/origami/graphics/xobject.rb, line 468
def draw_polygon(coords = [], attr = {})
  last_content_stream.draw_polygon(coords, attr); self
end
draw_rectangle(x, y, width, height, attr = {}) click to toggle source

See ContentStream#draw_rectangle.

# File lib/origami/graphics/xobject.rb, line 473
def draw_rectangle(x, y, width, height, attr = {})
  last_content_stream.draw_rectangle(x, y, width, height, attr); self
end
each_annot(&b) click to toggle source

Iterate through each Annotation of the Page.

# File lib/origami/page.rb, line 495
def each_annot(&b)
  annots = self.Annots
  return unless annots.is_a?(Array)

  annots.each do |annot|
    b.call(annot.solve) 
  end
end
onClose(action) click to toggle source

Will execute an action when the page is closed.

# File lib/origami/page.rb, line 554
def onClose(action)
  unless action.is_a?(Action) or action.is_a?(Reference)
    raise TypeError, "An Action object must be passed."
  end
  
  self.AA ||= PageAdditionalActions.new
  self.AA.C = action

  self
end
onOpen(action) click to toggle source

Will execute an action when the page is opened.

# File lib/origami/page.rb, line 540
def onOpen(action)
  unless action.is_a?(Action) or action.is_a?(Reference)
    raise TypeError, "An Action object must be passed."
  end
  
  self.AA ||= PageAdditionalActions.new
  self.AA.O = action
  
  self
end
paint_shading(shade) click to toggle source

TODO :nodoc:

# File lib/origami/graphics/xobject.rb, line 483
def paint_shading(shade)
  raise NotImplementedError
end
pre_build() click to toggle source
# File lib/origami/page.rb, line 470
def pre_build
  self.Resources = Resources.new.pre_build unless self.has_key?(:Resources)

  super
end
set_dash_pattern(pattern) click to toggle source

See ContentStream#set_dash_pattern.

# File lib/origami/graphics/xobject.rb, line 538
def set_dash_pattern(pattern)
  last_content_stream.set_dash_pattern(pattern); self
end
set_fill_color(color) click to toggle source

See ContentStream#set_fill_color.

# File lib/origami/graphics/xobject.rb, line 528
def set_fill_color(color)
  last_content_stream.set_fill_color(color); self
end
set_line_cap(cap) click to toggle source

See ContentStream#set_line_cap.

# File lib/origami/graphics/xobject.rb, line 548
def set_line_cap(cap)
  last_content_stream.set_line_cap(cap); self
end
set_line_join(join) click to toggle source

See ContentStream#set_line_join.

# File lib/origami/graphics/xobject.rb, line 553
def set_line_join(join)
  last_content_stream.set_line_join(join); self
end
set_line_width(width) click to toggle source

See ContentStream#set_line_width.

# File lib/origami/graphics/xobject.rb, line 543
def set_line_width(width)
  last_content_stream.set_line_width(width); self
end
set_stroke_color(color) click to toggle source

See ContentStream#set_stroke_color.

# File lib/origami/graphics/xobject.rb, line 533
def set_stroke_color(color)
  last_content_stream.set_stroke_color(color); self
end
set_text_char_spacing(char_spacing) click to toggle source

See ContentStream#set_text_char_spacing.

# File lib/origami/graphics/xobject.rb, line 523
def set_text_char_spacing(char_spacing)
  last_content_stream.set_text_char_spacing(char_spacing); self
end
set_text_font(font, size) click to toggle source

TODO :nodoc:

# File lib/origami/graphics/xobject.rb, line 488
def set_text_font(font, size)
  raise NotImplementedError
end
set_text_leading(leading) click to toggle source

See ContentStream#set_text_leading.

# File lib/origami/graphics/xobject.rb, line 498
def set_text_leading(leading)
  last_content_stream.set_text_leading(leading); self
end
set_text_pos(tx, ty) click to toggle source

See ContentStream#set_text_pos.

# File lib/origami/graphics/xobject.rb, line 493
def set_text_pos(tx, ty)
  last_content_stream.set_text_pos(tx, ty); self
end
set_text_rendering(rendering) click to toggle source

See ContentStream#set_text_rendering.

# File lib/origami/graphics/xobject.rb, line 503
def set_text_rendering(rendering)
  last_content_stream.set_text_rendering(rendering); self
end
set_text_rise(rise) click to toggle source

See ContentStream#set_text_rise.

# File lib/origami/graphics/xobject.rb, line 508
def set_text_rise(rise)
  last_content_stream.set_text_rise(rise); self
end
set_text_scale(scaling) click to toggle source

See ContentStream#set_text_scale.

# File lib/origami/graphics/xobject.rb, line 513
def set_text_scale(scaling)
  last_content_stream.set_text_scale(scaling); self
end
set_text_word_spacing(word_spacing) click to toggle source

See ContentStream#set_text_word_spacing.

# File lib/origami/graphics/xobject.rb, line 518
def set_text_word_spacing(word_spacing)
  last_content_stream.set_text_word_spacing(word_spacing); self
end
write(text, attr = {}) click to toggle source

See ContentStream#write.

# File lib/origami/graphics/xobject.rb, line 478
def write(text, attr = {})
  last_content_stream.write(text, attr); self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.