Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow_header_for_the_table #75

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Gemfile.lock
manual.pdf
.idea/
12 changes: 8 additions & 4 deletions lib/prawn/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = options[:header].present? ? options[:header] : true
options.each { |k, v| send("#{k}=", v) }

if block
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the line. Leaving dead code as comments pollutes the file, and one can always look in the commit history to see the "blame"

move_past_bottom
# we are at the top of a new page
0
end
Expand Down Expand Up @@ -695,6 +695,10 @@ def with_position
@pdf.y = final_y
end

def move_past_bottom
@pdf.start_new_page(:top_margin => 135, :bottom_margin => 90)
end

end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/prawn/table/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Prawn
class Table
VERSION = '0.2.3'.freeze
VERSION = '0.2.3'
end
end