OSDN Git Service

Fixes gantt PDF pagination problem (#6348).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 7 Dec 2010 18:53:15 +0000 (18:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 7 Dec 2010 18:53:15 +0000 (18:53 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4474 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/helpers/gantt.rb

index c6a54d3..fa3a125 100644 (file)
@@ -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