4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/pdf/medivo/fdf_generator.rb', line 4
def self.file(info)
PdfGenerator.tmp_pdf do |afile|
afile.write "%FDF-1.2\x0d%\xe2\xe3\xcf\xd3\x0d\x0a"; afile.write "1 0 obj\x0d<< " afile.write "\x0d/FDF << " afile.write "/Fields [ "
info.each { |key, value|
if value.class == Hash
value.each { |sub_key, sub_value|
afile.write '<< /T (' + key.to_s + '_' + sub_key.to_s + ') /V '
afile.write '(' + escape_data(sub_value) + ') /ClrF 2 /ClrFf 1 >> '
}
else
afile.write '<< /T (' + key.to_s + ') /V (' + escape_data(value) + ') /ClrF 2 /ClrFf 1 >> '
end
}
afile.write "] \x0d" afile.write ">> \x0d" afile.write ">> \x0dendobj\x0d"
afile.write "trailer\x0d<<\x0d/Root 1 0 R \x0d\x0d>>\x0d"
afile.write "%%EOF\x0d\x0a"
end
end
|