Module: PdfFormFiller

Defined in:
lib/pdf_form_filler.rb,
lib/pdf_form_filler/version.rb

Defined Under Namespace

Classes: Form

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Instance Method Details

#stroke_axis(pdf, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pdf_form_filler.rb', line 5

def stroke_axis(pdf, options={})
  options = { :height => (pdf.cursor - 20).to_i,
              :width => pdf.bounds.width.to_i
            }.merge(options)

  pdf.dash(1, :space => 4)
  pdf.stroke_horizontal_line(-21, options[:width], :at => 0)
  pdf.stroke_vertical_line(-21, options[:height], :at => 0)
  pdf.undash

  pdf.fill_circle [0, 0], 1

  (100..options[:width]).step(100) do |point|
    pdf.fill_circle [point, 0], 1
    pdf.draw_text point, :at => [point-5, -10], :size => 7
  end

  (100..options[:height]).step(100) do |point|
    pdf.fill_circle [0, point], 1
    pdf.draw_text point, :at => [-17, point-2], :size => 7
  end
end