diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-04 14:54:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-04 14:54:19 +0000 |
commit | 4a5d3e03531f37a46c80a976d5a38189db70a8ff (patch) | |
tree | 50370fc02a1d4a1eec6f8b9877e7b53cea16ad0d /lib/redmine | |
parent | 859016523820efd5d343b9683a3e26eb3b7b28ba (diff) | |
download | redmine-4a5d3e03531f37a46c80a976d5a38189db70a8ff.tar.gz redmine-4a5d3e03531f37a46c80a976d5a38189db70a8ff.zip |
Scramble PDF title (#1204).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2233 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/export/pdf.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb index 68e34b65e..5d75494ed 100644 --- a/lib/redmine/export/pdf.rb +++ b/lib/redmine/export/pdf.rb @@ -55,6 +55,27 @@ module Redmine def SetFontStyle(style, size) SetFont(@font_for_content, style, size) end + + def SetTitle(txt) + txt = begin + utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt) + hextxt = "<FEFF" # FEFF is BOM + hextxt << utf16txt.unpack("C*").map {|x| sprintf("%02X",x) }.join + hextxt << ">" + rescue + txt + end || '' + super(txt) + end + + def textstring(s) + # Format a text string + if s =~ /^</ # This means the string is hex-dumped. + return s + else + return '('+escape(s)+')' + end + end def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') |