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

Constant Summary

Constants inherited from Prawn::Table::Cell

FPTolerance

Instance Attribute Summary

Attributes inherited from Prawn::Table::Cell

#background_color, #border_colors, #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_width, #border_bottom_width=, #border_color=, #border_left_color, #border_left_color=, #border_left_width, #border_left_width=, #border_right_color, #border_right_color=, #border_right_width, #border_right_width=, #border_top_color, #border_top_color=, #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

- (Image) initialize(pdf, point, options = {})



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

- (Object) draw_content

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

- (Object) fit=(f)



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

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

- (Object) image=(file)



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

def image=(file)
  @file = file
end

- (Object) image_height=(h)



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

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

- (Object) image_width=(w)



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

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

- (Object) natural_content_height



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

def natural_content_height
  @natural_height
end

- (Object) natural_content_width



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

def natural_content_width
  @natural_width
end

- (Object) position=(p)



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

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

- (Object) scale=(s)



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

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

- (Object) vposition=(vp)



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

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