Defect #61 » 61-enhanced.patch
| lib/redmine/export/pdf.rb (working copy) | ||
|---|---|---|
|
require 'iconv'
|
||
|
require 'rfpdf/fpdf'
|
||
|
require 'rfpdf/chinese'
|
||
|
require 'fpdf/korean'
|
||
|
require 'fpdf/japanese'
|
||
|
require 'fpdf/chinese'
|
||
|
module Redmine
|
||
|
module Export
|
||
| ... | ... | |
|
include ActionView::Helpers::TextHelper
|
||
|
include ActionView::Helpers::NumberHelper
|
||
|
|
||
|
class IFPDF < FPDF
|
||
|
class IFPDF < TCPDF
|
||
|
include Redmine::I18n
|
||
|
attr_accessor :footer_date
|
||
|
|
||
| ... | ... | |
|
set_language_if_valid lang
|
||
|
case current_language.to_s.downcase
|
||
|
when 'ko'
|
||
|
extend(PDF_Korean)
|
||
|
AddUHCFont()
|
||
|
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
||
|
extend(PDF_Korean)
|
||
|
AddUHCFont()
|
||
|
end
|
||
|
@font_for_content = 'UHC'
|
||
|
@font_for_footer = 'UHC'
|
||
|
when 'ja'
|
||
|
extend(PDF_Japanese)
|
||
|
AddSJISFont()
|
||
|
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
||
|
extend(PDF_Japanese)
|
||
|
AddSJISFont()
|
||
|
end
|
||
|
@font_for_content = 'SJIS'
|
||
|
@font_for_footer = 'SJIS'
|
||
|
when 'zh'
|
||
|
extend(PDF_Chinese)
|
||
|
AddGBFont()
|
||
|
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
||
|
extend(PDF_Chinese)
|
||
|
AddGBFont()
|
||
|
end
|
||
|
@font_for_content = 'GB'
|
||
|
@font_for_footer = 'GB'
|
||
|
when 'zh-tw'
|
||
|
extend(PDF_Chinese)
|
||
|
AddBig5Font()
|
||
|
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
||
|
extend(PDF_Chinese)
|
||
|
AddBig5Font()
|
||
|
end
|
||
|
@font_for_content = 'Big5'
|
||
|
@font_for_footer = 'Big5'
|
||
|
else
|
||
|
@font_for_content = 'Arial'
|
||
|
@font_for_footer = 'Helvetica'
|
||
|
@font_for_content = 'FreeSans'
|
||
|
@font_for_footer = 'FreeSans'
|
||
|
end
|
||
|
SetCreator(Redmine::Info.app_name)
|
||
|
SetFont(@font_for_content)
|
||
| ... | ... | |
|
title = query.new_record? ? l(:label_issue_plural) : query.name
|
||
|
title = "#{project} - #{title}" if project
|
||
|
pdf.SetTitle(title)
|
||
|
pdf.AliasNbPages
|
||
|
pdf.alias_nb_pages
|
||
|
pdf.footer_date = format_date(Date.today)
|
||
|
pdf.AddPage("L")
|
||
|
|
||
| ... | ... | |
|
def issue_to_pdf(issue)
|
||
|
pdf = IFPDF.new(current_language)
|
||
|
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}")
|
||
|
pdf.AliasNbPages
|
||
|
pdf.alias_nb_pages
|
||
|
pdf.footer_date = format_date(Date.today)
|
||
|
pdf.AddPage
|
||
|
|
||
| ... | ... | |
|
def gantt_to_pdf(gantt, project)
|
||
|
pdf = IFPDF.new(current_language)
|
||
|
pdf.SetTitle("#{l(:label_gantt)} #{project}")
|
||
|
pdf.AliasNbPages
|
||
|
pdf.alias_nb_pages
|
||
|
pdf.footer_date = format_date(Date.today)
|
||
|
pdf.AddPage("L")
|
||
|
pdf.SetFontStyle('B',12)
|
||