Class: Redmine::Export::PDF::IFPDF
- Inherits:
-
FPDF
- Object
- FPDF
- Redmine::Export::PDF::IFPDF
show all
- Includes:
- I18n
- Defined in:
- lib/redmine/export/pdf.rb
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Methods included from I18n
#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages
Constructor Details
- (IFPDF) initialize(lang)
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/redmine/export/pdf.rb', line 32
def initialize(lang)
super()
set_language_if_valid lang
case current_language.to_s.downcase
when 'ja'
extend(PDF_Japanese)
AddSJISFont()
@font_for_content = 'SJIS'
@font_for_footer = 'SJIS'
when 'zh'
extend(PDF_Chinese)
AddGBFont()
@font_for_content = 'GB'
@font_for_footer = 'GB'
when 'zh-tw'
extend(PDF_Chinese)
AddBig5Font()
@font_for_content = 'Big5'
@font_for_footer = 'Big5'
else
@font_for_content = 'Arial'
@font_for_footer = 'Helvetica'
end
SetCreator(Redmine::Info.app_name)
SetFont(@font_for_content)
end
|
Instance Attribute Details
Returns the value of attribute footer_date
30
31
32
|
# File 'lib/redmine/export/pdf.rb', line 30
def
@footer_date
end
|
Instance Method Details
- (Object) Cell(w, h = 0, txt = '', border = 0, ln = 0, align = '', fill = 0, link = '')
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/redmine/export/pdf.rb', line 84
def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='')
@ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8')
txt = txt.gsub(/[“�]/, '"') if txt
txt = begin
txtar = txt.split('\\')
txtar << '' if txt[-1] == ?\\
txtar.collect {|x| @ic.iconv(x)}.join('\\').gsub(/\\/, "\\\\\\\\")
rescue
txt
end || ''
super w,h,txt,border,ln,align,fill,link
end
|
99
100
101
102
103
104
105
106
107
|
# File 'lib/redmine/export/pdf.rb', line 99
def Footer
SetFont(@font_for_footer, 'I', 8)
SetY(-15)
SetX(15)
Cell(0, 5, @footer_date, 0, 0, 'L')
SetY(-15)
SetX(-30)
Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C')
end
|
- (Object) SetFontStyle(style, size)
59
60
61
|
# File 'lib/redmine/export/pdf.rb', line 59
def SetFontStyle(style, size)
SetFont(@font_for_content, style, size)
end
|
- (Object) SetTitle(txt)
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/redmine/export/pdf.rb', line 63
def SetTitle(txt)
txt = begin
utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt)
hextxt = "<FEFF" hextxt << utf16txt.unpack("C*").map {|x| sprintf("%02X",x) }.join
hextxt << ">"
rescue
txt
end || ''
super(txt)
end
|
- (Object) textstring(s)
75
76
77
78
79
80
81
82
|
# File 'lib/redmine/export/pdf.rb', line 75
def textstring(s)
if s =~ /^</ return s
else
return '('+escape(s)+')'
end
end
|