Module: PdfPageHelper

Defined in:
app/pdfs/concerns/pdf_page_helper.rb

Instance Method Summary collapse

Instance Method Details



30
31
32
33
34
35
# File 'app/pdfs/concerns/pdf_page_helper.rb', line 30

def footer(data = nil, options = {})
  text data
  if options[:page]
    number_pages "<page> / <total>", at: [bounds.right - 50, 0]
  end
end

#process_header(data) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/pdfs/concerns/pdf_page_helper.rb', line 13

def process_header(data)
  default_options = {
    cell_style: { borders: [] },
    column_widths: [225, 220]
  }

  table(data, default_options) do
    row(0).style font_style: :bold, size: 14
    row(1..-1).style size: 10
    column(0).style align: :left, padding: 0
    column(1).style align: :right, padding: 0
    cells[2, 0].style size: 12 if cells[2, 0].present?
  end

  move_down 50
end

#repeat_header(data = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/pdfs/concerns/pdf_page_helper.rb', line 3

def repeat_header(data = nil)
  repeat :all do
    canvas do
      bounding_box [bounds.left+75, bounds.top-20], :width  => bounds.width do
        process_header(data)
      end
    end
  end
end