@@ -1,48 +1,53 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require 'iconv' |
|
18 | require 'iconv' | |
19 |
|
19 | |||
20 | module IfpdfHelper |
|
20 | module IfpdfHelper | |
21 |
|
21 | |||
22 | class IFPDF < FPDF |
|
22 | class IFPDF < FPDF | |
23 |
|
23 | |||
24 | attr_accessor :footer_date |
|
24 | attr_accessor :footer_date | |
|
25 | ||||
|
26 | def initialize | |||
|
27 | super | |||
|
28 | SetCreator("redMine #{Redmine::VERSION}") | |||
|
29 | end | |||
25 |
|
30 | |||
26 | def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') |
|
31 | def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') | |
27 | @ic ||= Iconv.new('ISO-8859-1', 'UTF-8') |
|
32 | @ic ||= Iconv.new('ISO-8859-1', 'UTF-8') | |
28 | txt = begin |
|
33 | txt = begin | |
29 | @ic.iconv(txt) |
|
34 | @ic.iconv(txt) | |
30 | rescue |
|
35 | rescue | |
31 | txt |
|
36 | txt | |
32 | end |
|
37 | end | |
33 | super w,h,txt,border,ln,align,fill,link |
|
38 | super w,h,txt,border,ln,align,fill,link | |
34 | end |
|
39 | end | |
35 |
|
40 | |||
36 | def Footer |
|
41 | def Footer | |
37 | SetFont('Helvetica', 'I', 8) |
|
42 | SetFont('Helvetica', 'I', 8) | |
38 | SetY(-15) |
|
43 | SetY(-15) | |
39 | SetX(15) |
|
44 | SetX(15) | |
40 | Cell(0, 5, @footer_date, 0, 0, 'L') |
|
45 | Cell(0, 5, @footer_date, 0, 0, 'L') | |
41 | SetY(-15) |
|
46 | SetY(-15) | |
42 | SetX(-30) |
|
47 | SetX(-30) | |
43 | Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C') |
|
48 | Cell(0, 5, PageNo().to_s + '/{nb}', 0, 0, 'C') | |
44 | end |
|
49 | end | |
45 |
|
50 | |||
46 | end |
|
51 | end | |
47 |
|
52 | |||
48 | end |
|
53 | end |
General Comments 0
You need to be logged in to leave comments.
Login now