65: def initialize(paper = "LETTER", columns = 3)
66: @pdf = PDF::Writer.new(:paper => paper, :orientation => :landscape)
67: @pdf.margins_pt 18
68: @pdf.y = @pdf.absolute_top_margin
69:
70: @title_font = "Times-Roman"
71: @heading_font = "Times-Roman"
72: @body_font = "Times-Roman"
73: @code_font = "Courier"
74: @title_font_size = 14
75: @h1_font_size = 11
76: @h2_font_size = 9
77: @h3_font_size = 8
78: @h4_font_size = 7
79: @body_font_size = 6
80:
81: @ptab = PDF::SimpleTable.new do |tab|
82: tab.column_order.replace %w(one two)
83:
84: tab.font_size = @body_font_size
85: tab.show_lines = :none
86: tab.show_headings = false
87: tab.orientation = :center
88: tab.position = :center
89: end
90: @ltab = PDF::SimpleTable.new do |tab|
91: tab.column_order.replace %w(line)
92:
93: tab.font_size = @body_font_size
94: tab.show_lines = :none
95: tab.show_headings = false
96: tab.orientation = :center
97: tab.position = :center
98: end
99:
100: yield self if block_given?
101:
102: @pdf.start_columns columns
103:
104: @ptab.font_size = @body_font_size
105: @ltab.font_size = @body_font_size
106:
107: @ptab.maximum_width = @pdf.column_width - 10
108: @ltab.maximum_width = @pdf.column_width - 10
109:
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