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

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

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=, #relative_x, #relative_y, #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.



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

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.



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

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

#fit=(f) ⇒ Object



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

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

#image=(file) ⇒ Object



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

def image=(file)
  @file = file
end

#image_height=(h) ⇒ Object



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

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

#image_width=(w) ⇒ Object



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

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

#natural_content_heightObject



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

def natural_content_height
  @natural_height
end

#natural_content_widthObject



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

def natural_content_width
  @natural_width
end

#position=(p) ⇒ Object



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

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

#scale=(s) ⇒ Object



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

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

#vposition=(vp) ⇒ Object



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

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