From 9c6377964c43ed034cf644a22311810629f42934 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 7 Dec 2010 18:53:15 +0000 Subject: [PATCH] Fixes gantt PDF pagination problem (#6348). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4474 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/helpers/gantt.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index c6a54d32c..fa3a1259c 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -246,6 +246,7 @@ module Redmine options[:image].stroke_width(1) options[:image].text(options[:indent], options[:top] + 2, project.name) when :pdf + pdf_new_page?(options) options[:pdf].SetY(options[:top]) options[:pdf].SetX(15) @@ -381,6 +382,7 @@ module Redmine options[:image].stroke_width(1) options[:image].text(options[:indent], options[:top] + 2, version.to_s_with_project) when :pdf + pdf_new_page?(options) options[:pdf].SetY(options[:top]) options[:pdf].SetX(15) @@ -535,6 +537,7 @@ module Redmine options[:image].stroke_width(1) options[:image].text(options[:indent], options[:top] + 2, issue.subject) when :pdf + pdf_new_page?(options) options[:pdf].SetY(options[:top]) options[:pdf].SetX(15) @@ -921,7 +924,7 @@ module Redmine :g_width => g_width, :indent => 0, :indent_increment => 5, - :top_increment => 3, + :top_increment => 5, :format => :pdf, :pdf => pdf } @@ -943,6 +946,15 @@ module Redmine cmp end end + + def pdf_new_page?(options) + if options[:top] > 180 + options[:pdf].Line(15, options[:top], PDF::TotalWidth, options[:top]) + options[:pdf].AddPage("L") + options[:top] = 15 + options[:pdf].Line(15, options[:top] - 0.1, PDF::TotalWidth, options[:top] - 0.1) + end + end end end end -- 2.39.5