64: def initialize(paper = "LETTER", columns = 3, column_separators_visible = true)
65: @pdf = PDF::Writer.new(:paper => paper, :orientation => :landscape)
66: @pdf.margins_pt 18
67: @pdf.y = @pdf.absolute_top_margin
68:
69: @title_font = "Times-Roman"
70: @heading_font = "Times-Roman"
71: @body_font = "Times-Roman"
72: @code_font = "Courier"
73: @title_font_size = 14
74: @h1_font_size = 11
75: @h2_font_size = 9
76: @h3_font_size = 8
77: @h4_font_size = 7
78: @body_font_size = 6
79:
80: @ptab = PDF::SimpleTable.new do |tab|
81: tab.column_order.replace %w(one two)
82:
83: tab.font_size = @body_font_size
84: tab.show_lines = :none
85: tab.show_headings = false
86: tab.orientation = :center
87: tab.position = :center
88: end
89: @ltab = PDF::SimpleTable.new do |tab|
90: tab.column_order.replace %w(line)
91:
92: tab.font_size = @body_font_size
93: tab.show_lines = :none
94: tab.show_headings = false
95: tab.orientation = :center
96: tab.position = :center
97: end
98:
99: yield self if block_given?
100:
101: @pdf.start_columns columns
102:
103: @ptab.font_size = @body_font_size
104: @ltab.font_size = @body_font_size
105:
106: @ptab.maximum_width = @pdf.column_width - 10
107: @ltab.maximum_width = @pdf.column_width - 10
108:
109: if column_separators_visible
110:
111: all = @pdf.open_object
112: @pdf.save_state
113: @pdf.stroke_color! Color::RGB::Black
114: @pdf.stroke_style PDF::Writer::StrokeStyle::DEFAULT
115: (1 .. (columns - 1)).each do |ii|
116: x = @pdf.left_margin + (@pdf.column_width * ii)
117: x += (@pdf.column_gutter * (ii - 0.5))
118: @pdf.line(x, @pdf.page_height - @pdf.top_margin, x, @pdf.bottom_margin)
119: @pdf.stroke
120: end
121: @pdf.restore_state
122: @pdf.close_object
123: @pdf.add_object(all, :all_pages)
124: end
125: end