forked from practicingruby/prawn-layout
/
table_header_overrun.rb
35 lines (28 loc) · 1002 Bytes
/
table_header_overrun.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Text was overflowing into following cells because of some issues with
# floating point numbers in naive wrap.
#
# Resolved in: 9c357bc488d26e7bbc2e442606106106d349e232
#
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
require "rubygems"
require "prawn"
require "prawn/layout"
@prawn_document_options = {
:page_layout => :landscape,
:left_margin => 36,
:right_margin => 36,
:top_margin => 36,
:bottom_margin => 36}
Prawn::Document.generate("table_header_overrun.pdf", @prawn_document_options) do
headers = [ "Customer", "Grand\nHijynx", "Kh", "Red\nCorvette", "Rushmore", "bPnr", "lGh", "retail\nPantaloons", "sRsm", "Total\nBoxes"]
data = [[1,0,1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1,0,1]]
table(data,
:headers => headers,
:font_size => 16,
:horizontal_padding => 5,
:vertical_padding => 3,
:border => 2,
:position => :center)
start_new_page
table [['MyString']], :headers=>['Field1']
end