Class: Prawn::Table::Cell::Image

Inherits:
Prawn::Table::Cell show all
Defined in:
lib/prawn/table/cell/image.rb

Overview

A Cell that contains another table.

Constant Summary

Constants inherited from Prawn::Table::Cell

FPTolerance

Instance Attribute Summary

Attributes inherited from Prawn::Table::Cell

#background_color, #border_colors, #border_lines, #border_widths, #borders, #colspan, #content, #dummy_cells, #height, #padding, #rowspan

Instance Method Summary collapse

Methods inherited from Prawn::Table::Cell

#avg_spanned_min_width, #border_bottom_color, #border_bottom_color=, #border_bottom_line, #border_bottom_line=, #border_bottom_width, #border_bottom_width=, #border_color=, #border_left_color, #border_left_color=, #border_left_line, #border_left_line=, #border_left_width, #border_left_width=, #border_line=, #border_right_color, #border_right_color=, #border_right_line, #border_right_line=, #border_right_width, #border_right_width=, #border_top_color, #border_top_color=, #border_top_line, #border_top_line=, #border_top_width, #border_top_width=, #border_width=, #content_height, #content_width, #draw, #draw_background, #draw_borders, #draw_bounded_content, draw_cells, #height_ignoring_span, make, #max_width, #max_width_ignoring_span, #min_width, #min_width_ignoring_span, #padding_bottom, #padding_bottom=, #padding_left, #padding_left=, #padding_right, #padding_right=, #padding_top, #padding_top=, #set_width_constraints, #spanned_content_height, #spanned_content_width, #style, #width, #width=, #width_ignoring_span, #x, #x=, #y, #y=

Constructor Details

#initialize(pdf, point, options = {}) ⇒ Image

Returns a new instance of Image.



16
17
18
19
20
21
22
23
# File 'lib/prawn/table/cell/image.rb', line 16

def initialize(pdf, point, options={})
  @image_options = {}
  super

  @pdf_object, @image_info = @pdf.build_image_object(@file)
  @natural_width, @natural_height = @image_info.calc_image_dimensions(
    @image_options)
end

Instance Method Details

#draw_contentObject

Draw the image on the page.



63
64
65
# File 'lib/prawn/table/cell/image.rb', line 63

def draw_content
  @pdf.embed_image(@pdf_object, @image_info, @image_options)
end

#fit=(f) ⇒ Object



33
34
35
# File 'lib/prawn/table/cell/image.rb', line 33

def fit=(f)
  @image_options[:fit] = f
end

#image=(file) ⇒ Object



25
26
27
# File 'lib/prawn/table/cell/image.rb', line 25

def image=(file)
  @file = file
end

#image_height=(h) ⇒ Object



37
38
39
# File 'lib/prawn/table/cell/image.rb', line 37

def image_height=(h)
  @image_options[:height] = h
end

#image_width=(w) ⇒ Object



41
42
43
# File 'lib/prawn/table/cell/image.rb', line 41

def image_width=(w)
  @image_options[:width] = w
end

#natural_content_heightObject



57
58
59
# File 'lib/prawn/table/cell/image.rb', line 57

def natural_content_height
  @natural_height
end

#natural_content_widthObject



53
54
55
# File 'lib/prawn/table/cell/image.rb', line 53

def natural_content_width
  @natural_width
end

#position=(p) ⇒ Object



45
46
47
# File 'lib/prawn/table/cell/image.rb', line 45

def position=(p)
  @image_options[:position] = p
end

#scale=(s) ⇒ Object



29
30
31
# File 'lib/prawn/table/cell/image.rb', line 29

def scale=(s)
  @image_options[:scale] = s
end

#vposition=(vp) ⇒ Object



49
50
51
# File 'lib/prawn/table/cell/image.rb', line 49

def vposition=(vp)
  @image_options[:vposition] = vp
end