19 |
19 |
|
20 |
20 |
require 'iconv'
|
21 |
21 |
require 'rfpdf/fpdf'
|
22 |
|
require 'rfpdf/chinese'
|
|
22 |
require 'fpdf/korean'
|
|
23 |
require 'fpdf/japanese'
|
|
24 |
require 'fpdf/chinese'
|
23 |
25 |
|
24 |
26 |
module Redmine
|
25 |
27 |
module Export
|
... | ... | |
27 |
29 |
include ActionView::Helpers::TextHelper
|
28 |
30 |
include ActionView::Helpers::NumberHelper
|
29 |
31 |
|
30 |
|
class IFPDF < FPDF
|
|
32 |
class IFPDF < TCPDF
|
31 |
33 |
include Redmine::I18n
|
32 |
34 |
attr_accessor :footer_date
|
33 |
35 |
|
... | ... | |
36 |
38 |
set_language_if_valid lang
|
37 |
39 |
case current_language.to_s.downcase
|
38 |
40 |
when 'ko'
|
39 |
|
extend(PDF_Korean)
|
40 |
|
AddUHCFont()
|
|
41 |
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
|
42 |
extend(PDF_Korean)
|
|
43 |
AddUHCFont()
|
|
44 |
end
|
41 |
45 |
@font_for_content = 'UHC'
|
42 |
46 |
@font_for_footer = 'UHC'
|
43 |
47 |
when 'ja'
|
44 |
|
extend(PDF_Japanese)
|
45 |
|
AddSJISFont()
|
|
48 |
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
|
49 |
extend(PDF_Japanese)
|
|
50 |
AddSJISFont()
|
|
51 |
end
|
46 |
52 |
@font_for_content = 'SJIS'
|
47 |
53 |
@font_for_footer = 'SJIS'
|
48 |
54 |
when 'zh'
|
49 |
|
extend(PDF_Chinese)
|
50 |
|
AddGBFont()
|
|
55 |
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
|
56 |
extend(PDF_Chinese)
|
|
57 |
AddGBFont()
|
|
58 |
end
|
51 |
59 |
@font_for_content = 'GB'
|
52 |
60 |
@font_for_footer = 'GB'
|
53 |
61 |
when 'zh-tw'
|
54 |
|
extend(PDF_Chinese)
|
55 |
|
AddBig5Font()
|
|
62 |
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
|
63 |
extend(PDF_Chinese)
|
|
64 |
AddBig5Font()
|
|
65 |
end
|
56 |
66 |
@font_for_content = 'Big5'
|
57 |
67 |
@font_for_footer = 'Big5'
|
58 |
68 |
else
|
59 |
|
@font_for_content = 'Arial'
|
60 |
|
@font_for_footer = 'Helvetica'
|
|
69 |
@font_for_content = 'FreeSans'
|
|
70 |
@font_for_footer = 'FreeSans'
|
61 |
71 |
end
|
62 |
72 |
SetCreator(Redmine::Info.app_name)
|
63 |
73 |
SetFont(@font_for_content)
|
... | ... | |
120 |
130 |
title = query.new_record? ? l(:label_issue_plural) : query.name
|
121 |
131 |
title = "#{project} - #{title}" if project
|
122 |
132 |
pdf.SetTitle(title)
|
123 |
|
pdf.AliasNbPages
|
|
133 |
pdf.alias_nb_pages
|
124 |
134 |
pdf.footer_date = format_date(Date.today)
|
125 |
135 |
pdf.AddPage("L")
|
126 |
136 |
|
... | ... | |
189 |
199 |
def issue_to_pdf(issue)
|
190 |
200 |
pdf = IFPDF.new(current_language)
|
191 |
201 |
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}")
|
192 |
|
pdf.AliasNbPages
|
|
202 |
pdf.alias_nb_pages
|
193 |
203 |
pdf.footer_date = format_date(Date.today)
|
194 |
204 |
pdf.AddPage
|
195 |
205 |
|
... | ... | |
316 |
326 |
def gantt_to_pdf(gantt, project)
|
317 |
327 |
pdf = IFPDF.new(current_language)
|
318 |
328 |
pdf.SetTitle("#{l(:label_gantt)} #{project}")
|
319 |
|
pdf.AliasNbPages
|
|
329 |
pdf.alias_nb_pages
|
320 |
330 |
pdf.footer_date = format_date(Date.today)
|
321 |
331 |
pdf.AddPage("L")
|
322 |
332 |
pdf.SetFontStyle('B',12)
|