comparison vendor/plugins/rfpdf/.svn/text-base/README.svn-base @ 0:513646585e45

* Import Redmine trunk SVN rev 3859
author Chris Cannam
date Fri, 23 Jul 2010 15:52:44 +0100
parents
children cbce1fd3b1b7
comparison
equal deleted inserted replaced
-1:000000000000 0:513646585e45
1 = RFPDF Template Plugin
2
3 A template plugin allowing the inclusion of ERB-enabled RFPDF template files.
4
5 == Example .rb method Usage
6
7 In the controller, something like:
8
9 def mypdf
10 pdf = FPDF.new()
11
12 #
13 # Chinese
14 #
15 pdf.extend(PDF_Chinese)
16 pdf.AddPage
17 pdf.AddBig5Font
18 pdf.SetFont('Big5','',18)
19 pdf.Write(5, '²{®É®ð·Å 18 C Àã«× 83 %')
20 icBig5 = Iconv.new('Big5', 'UTF-8')
21 pdf.Write(15, icBig5.iconv("宋体 should be working"))
22 send_data pdf.Output, :filename => "something.pdf", :type => "application/pdf"
23 end
24
25 == Example .rfdf Usage
26
27 In the controller, something like:
28
29 def mypdf
30 @options_for_rfpdf ||= {}
31 @options_for_rfpdf[:file_name] = "nice_looking.pdf"
32 end
33
34 In the layout (make sure this is the only item in the layout):
35 <%= @content_for_layout %>
36
37 In the view (mypdf.rfpdf):
38
39 <%
40 pdf = FPDF.new()
41 #
42 # Chinese
43 #
44 pdf.extend(PDF_Chinese)
45 pdf.AddPage
46 pdf.AddBig5Font
47 pdf.SetFont('Big5','',18)
48 pdf.Write(5, '²{®É®ð·Å 18 C Àã«× 83 %')
49 icBig5 = Iconv.new('Big5', 'UTF-8')
50 pdf.Write(15, icBig5.iconv("宋体 should be working"))
51
52 #
53 # Japanese
54 #
55 pdf.extend(PDF_Japanese)
56 pdf.AddSJISFont();
57 pdf.AddPage();
58 pdf.SetFont('SJIS','',18);
59 pdf.Write(5,'9ÉñåéÇÃåˆäJÉeÉXÉgÇåoǃPHP 3.0ÇÕ1998îN6åéÇ…åˆéÆÇ…ÉäÉäÅ[ÉXÇ≥ÇÍNjǵÇΩÅB');
60 icSJIS = Iconv.new('SJIS', 'UTF-8')
61 pdf.Write(15, icSJIS.iconv("これはテキストである should be working"))
62
63 #
64 # Korean
65 #
66 pdf.extend(PDF_Korean)
67 pdf.AddUHCFont();
68 pdf.AddPage();
69 pdf.SetFont('UHC','',18);
70 pdf.Write(5,'PHP 3.0Àº 1998³â 6¿ù¿¡ °ø½ÄÀûÀ¸·Î ¸±¸®ÁîµÇ¾ú´Ù. °ø°³ÀûÀÎ Å×½ºÆ® ÀÌÈľà 9°³¿ù¸¸À̾ú´Ù.');
71 icUHC = Iconv.new('UHC', 'UTF-8')
72 pdf.Write(15, icUHC.iconv("이것은 원본 이다"))
73
74 #
75 # English
76 #
77 pdf.AddPage();
78 pdf.SetFont('Arial', '', 10)
79 pdf.Write(5, "should be working")
80 %>
81 <%= pdf.Output() %>
82
83
84 == Configuring
85
86 You can configure Rfpdf by using an @options_for_rfpdf hash in your controllers.
87
88 Here are a few options:
89
90 :filename (default: action_name.pdf)
91 Filename of PDF to generate
92
93 Note: If you're using the same settings for @options_for_rfpdf often, you might want to
94 put your assignment in a before_filter (perhaps overriding :filename, etc in your actions).
95
96 == Problems
97
98 Layouts and partials are currently not supported; just need
99 to wrap the PDF generation differently.