From c28e497e4ba484ffeec5ac06011ca615cbe05f6c Mon Sep 17 00:00:00 2001 From: Jiri Litomysky Date: Wed, 26 Oct 2016 18:44:38 +0200 Subject: [PATCH 1/5] allow header for our tables --- lib/prawn/table.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/prawn/table.rb b/lib/prawn/table.rb index 264bf7a..c91a6dd 100644 --- a/lib/prawn/table.rb +++ b/lib/prawn/table.rb @@ -137,7 +137,7 @@ def make_table(data, options={}, &block) def initialize(data, document, options={}, &block) @pdf = document @cells = make_cells(data) - @header = false + @header = true options.each { |k, v| send("#{k}=", v) } if block @@ -479,8 +479,8 @@ def initial_row_on_initial_page # If there isn't enough room left on the page to fit the first data row # (including the header), start the table on the next page. - @pdf.bounds.move_past_bottom - + #@pdf.bounds.move_past_bottom + move_past_bottom # we are at the top of a new page 0 end @@ -695,6 +695,10 @@ def with_position @pdf.y = final_y end + def move_past_bottom + @pdf.start_new_page(:top_margin => 120, :bottom_margin => 90) + end + end end From 1eeab91c158c586acae7c8017437ca7d8569ebc4 Mon Sep 17 00:00:00 2001 From: Jiri Litomysky Date: Thu, 27 Oct 2016 11:02:03 +0200 Subject: [PATCH 2/5] update another start new page --- lib/prawn/table.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prawn/table.rb b/lib/prawn/table.rb index c91a6dd..36dffeb 100644 --- a/lib/prawn/table.rb +++ b/lib/prawn/table.rb @@ -433,7 +433,7 @@ def ink_and_draw_cells_and_start_new_page(cells_this_page, cell) ink_and_draw_cells(cells_this_page, draw_cells) # start a new page or column - @pdf.bounds.move_past_bottom + move_past_bottom offset = (@pdf.y - cell.y) From ece67d436e8e2b01d2207ebda264b1ca6e55e239 Mon Sep 17 00:00:00 2001 From: Alexander Nikolskiy Date: Thu, 27 Oct 2016 15:08:27 +0200 Subject: [PATCH 3/5] heat it up --- .gitignore | 1 + lib/prawn/table/version.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ceb10c7..fca087c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ Gemfile.lock manual.pdf +.idea/ \ No newline at end of file diff --git a/lib/prawn/table/version.rb b/lib/prawn/table/version.rb index 40ee275..16483e6 100644 --- a/lib/prawn/table/version.rb +++ b/lib/prawn/table/version.rb @@ -1,5 +1,5 @@ module Prawn class Table - VERSION = '0.2.3'.freeze + VERSION = '0.2.3' end end From 3c6d3f415c0fd56b72fa435dee8a460407bd8785 Mon Sep 17 00:00:00 2001 From: Jiri Litomysky Date: Tue, 1 Nov 2016 16:47:16 +0100 Subject: [PATCH 4/5] fix header --- lib/prawn/table.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prawn/table.rb b/lib/prawn/table.rb index 36dffeb..b7ba46f 100644 --- a/lib/prawn/table.rb +++ b/lib/prawn/table.rb @@ -137,7 +137,7 @@ def make_table(data, options={}, &block) def initialize(data, document, options={}, &block) @pdf = document @cells = make_cells(data) - @header = true + @header = options[:header].present? ? options[:header] : true options.each { |k, v| send("#{k}=", v) } if block From 041ae20b4a443dd1984620b08a874792674cada4 Mon Sep 17 00:00:00 2001 From: Jiri Litomysky Date: Thu, 24 Nov 2016 17:11:17 +0100 Subject: [PATCH 5/5] fix margin for new page in table --- lib/prawn/table.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prawn/table.rb b/lib/prawn/table.rb index b7ba46f..9ebf4a7 100644 --- a/lib/prawn/table.rb +++ b/lib/prawn/table.rb @@ -696,7 +696,7 @@ def with_position end def move_past_bottom - @pdf.start_new_page(:top_margin => 120, :bottom_margin => 90) + @pdf.start_new_page(:top_margin => 135, :bottom_margin => 90) end end