Module: Prawn::Blank

Defined in:
lib/prawn/blank.rb

Defined Under Namespace

Classes: Appearance, Field, Form, Style, TextField

Instance Method Summary collapse

Instance Method Details

#acroformObject



35
36
37
38
# File 'lib/prawn/blank.rb', line 35

def acroform
  store.root.data[:AcroForm] ||= ref!(Form.new)
  store.root.data[:AcroForm].data
end

#add_field(field) ⇒ Object

protected



28
29
30
31
32
33
# File 'lib/prawn/blank.rb', line 28

def add_field(field)
  annotation = ref!(field.to_h)
  acroform.add_field(annotation)
  page.dictionary.data[:Annots] ||= []
  page.dictionary.data[:Annots] << annotation
end

#get_field_rect(at, width, height) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/prawn/blank.rb', line 17

def get_field_rect(at,width,height)
  unless at.nil?
    x,y=map_to_absolute(at)
  else
    x,y=image_position(width,height,{})
    move_text_position height
  end
  return [x,y,x+width,y+height]
end

#text_field(options = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/prawn/blank.rb', line 9

def text_field(options={})
  f=TextField.new(self,options)
  if block_given?
    yield(f)
  end
  add_field(f)
end