1 = RFPDF Template Plugin
3 A template plugin allowing the inclusion of ERB-enabled RFPDF template files.
5 == Example .rb method Usage
7 In the controller, something like:
15 pdf.extend(PDF_Chinese)
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"
25 == Example .rfdf Usage
27 In the controller, something like:
30 @options_for_rfpdf ||= {}
31 @options_for_rfpdf[:file_name] = "nice_looking.pdf"
34 In the layout (make sure this is the only item in the layout):
35 <%= @content_for_layout %>
37 In the view (mypdf.rfpdf):
44 pdf.extend(PDF_Chinese)
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"))
55 pdf.extend(PDF_Japanese)
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"))
66 pdf.extend(PDF_Korean)
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("이것은 원본 이다"))
78 pdf.SetFont('Arial', '', 10)
79 pdf.Write(5, "should be working")
86 You can configure Rfpdf by using an @options_for_rfpdf hash in your controllers.
88 Here are a few options:
90 :filename (default: action_name.pdf)
91 Filename of PDF to generate
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).
98 Layouts and partials are currently not supported; just need
99 to wrap the PDF generation differently.