PDF: switch TCPDF UTF-8 or FPDF ANSI (#61).

If server is Windows or language is CJK or Thai, Redmine uses FPDF.
Else Redmine uses TCPDF.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5259 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-30 11:32:35 +00:00
parent 988841d69a
commit 325af8d48c
2 changed files with 33 additions and 7 deletions

View File

@ -179,8 +179,16 @@ module Redmine
# Returns a PDF string of a list of issues
def issues_to_pdf(issues, project, query)
if Redmine::Platform.mswin? ||
( current_language.to_s.downcase == 'ko' ||
current_language.to_s.downcase == 'ja' ||
current_language.to_s.downcase == 'zh' ||
current_language.to_s.downcase == 'zh-tw' ||
current_language.to_s.downcase == 'th' )
pdf = IFPDF.new(current_language)
else
pdf = ITCPDF.new(current_language)
end
title = query.new_record? ? l(:label_issue_plural) : query.name
title = "#{project} - #{title}" if project
pdf.SetTitle(title)
@ -251,7 +259,16 @@ module Redmine
# Returns a PDF string of a single issue
def issue_to_pdf(issue)
if Redmine::Platform.mswin? ||
( current_language.to_s.downcase == 'ko' ||
current_language.to_s.downcase == 'ja' ||
current_language.to_s.downcase == 'zh' ||
current_language.to_s.downcase == 'zh-tw' ||
current_language.to_s.downcase == 'th' )
pdf = IFPDF.new(current_language)
else
pdf = ITCPDF.new(current_language)
end
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}")
pdf.alias_nb_pages
pdf.footer_date = format_date(Date.today)

View File

@ -507,7 +507,16 @@ module Redmine
end if Object.const_defined?(:Magick)
def to_pdf
if Redmine::Platform.mswin? ||
( current_language.to_s.downcase == 'ko' ||
current_language.to_s.downcase == 'ja' ||
current_language.to_s.downcase == 'zh' ||
current_language.to_s.downcase == 'zh-tw' ||
current_language.to_s.downcase == 'th' )
pdf = ::Redmine::Export::PDF::IFPDF.new(current_language)
else
pdf = ::Redmine::Export::PDF::ITCPDF.new(current_language)
end
pdf.SetTitle("#{l(:label_gantt)} #{project}")
pdf.alias_nb_pages
pdf.footer_date = format_date(Date.today)