jasper-command-line 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/jasper-command-line/jasper.rb +25 -17
- data/lib/jasper-command-line/version.rb +1 -1
- metadata +1 -1
@@ -86,27 +86,35 @@ module JasperCommandLine
|
|
86
86
|
# Export it!
|
87
87
|
|
88
88
|
if sign_options
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
temp_file = Tempfile.new(['pdf-', '.pdf'])
|
90
|
+
temp_signed_file = Tempfile.new(['signed-pdf-', '.pdf'])
|
91
|
+
file = temp_file.path
|
92
|
+
signed_file = temp_signed_file.path
|
93
|
+
|
94
|
+
temp_file.close!
|
95
|
+
temp_signed_file.close!
|
93
96
|
|
94
|
-
|
95
|
-
'-n',
|
96
|
-
'-t', file.path,
|
97
|
-
'-s', sign_options[:key_file],
|
98
|
-
'-p', %Q["#{sign_options[:password]}"],
|
99
|
-
'-o', signed_file.path
|
100
|
-
]
|
101
|
-
call_options.push '-l', %Q["#{sign_options[:location]}"] if sign_options[:location]
|
102
|
-
call_options.push '-r', %Q["#{sign_options[:reason]}"] if sign_options[:reason]
|
97
|
+
File.open(file, 'wb') { |f| f.write JasperExportManager._invoke('exportReportToPdf', 'Lnet.sf.jasperreports.engine.JasperPrint;', jasper_print) }
|
103
98
|
|
104
|
-
|
99
|
+
call_options = [
|
100
|
+
'-n',
|
101
|
+
'-t', file,
|
102
|
+
'-s', sign_options[:key_file],
|
103
|
+
'-p', %Q["#{sign_options[:password]}"],
|
104
|
+
'-o', signed_file
|
105
|
+
]
|
106
|
+
call_options.push '-l', %Q["#{sign_options[:location]}"] if sign_options[:location]
|
107
|
+
call_options.push '-r', %Q["#{sign_options[:reason]}"] if sign_options[:reason]
|
105
108
|
|
106
|
-
|
109
|
+
`java -jar #{File.dirname(__FILE__)}/java/PortableSigner/PortableSigner.jar #{call_options.join(' ')}`
|
110
|
+
|
111
|
+
begin
|
112
|
+
return File.read(signed_file)
|
107
113
|
ensure
|
108
|
-
|
109
|
-
|
114
|
+
begin
|
115
|
+
File.unlink file, signed_file
|
116
|
+
rescue
|
117
|
+
end
|
110
118
|
end
|
111
119
|
else
|
112
120
|
JasperExportManager._invoke('exportReportToPdf', 'Lnet.sf.jasperreports.engine.JasperPrint;', jasper_print)
|