@@ -98,7 +98,7 module Redmine | |||
|
98 | 98 | |
|
99 | 99 | def textstring(s) |
|
100 | 100 | # Format a text string |
|
101 |
if s |
|
|
101 | if s =~ /^</ # This means the string is hex-dumped. | |
|
102 | 102 | return s |
|
103 | 103 | else |
|
104 | 104 | return '('+escape(s)+')' |
@@ -146,11 +146,21 module Redmine | |||
|
146 | 146 | end |
|
147 | 147 | |
|
148 | 148 | def Bookmark(txt, level=0, y=0) |
|
149 | utf16 = Iconv.conv('UTF-16', 'UTF-8', txt) | |
|
150 | 149 | if (y == -1) |
|
151 | 150 | y = GetY() |
|
152 | 151 | end |
|
153 |
@outlines << {:t => |
|
|
152 | @outlines << {:t => txt, :l => level, :p => PageNo(), :y => (@h - y)*@k} | |
|
153 | end | |
|
154 | ||
|
155 | def bookmark_title(txt) | |
|
156 | txt = begin | |
|
157 | utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt) | |
|
158 | hextxt = "<FEFF" # FEFF is BOM | |
|
159 | hextxt << utf16txt.unpack("C*").map {|x| sprintf("%02X",x) }.join | |
|
160 | hextxt << ">" | |
|
161 | rescue | |
|
162 | txt | |
|
163 | end || '' | |
|
154 | 164 | end |
|
155 | 165 | |
|
156 | 166 | def putbookmarks |
@@ -184,7 +194,7 module Redmine | |||
|
184 | 194 | n=self.n+1 |
|
185 | 195 | @outlines.each_with_index do |o, i| |
|
186 | 196 | newobj() |
|
187 |
out('<</Title '+ |
|
|
197 | out('<</Title '+bookmark_title(o[:t])) | |
|
188 | 198 | out("/Parent #{n+o[:parent]} 0 R") |
|
189 | 199 | if (o[:prev]) |
|
190 | 200 | out("/Prev #{n+o[:prev]} 0 R") |
General Comments 0
You need to be logged in to leave comments.
Login now