将 JasperReports 生成的 XML 从服务器端转换为客户端的 PDF
我正在做一个项目,客户在分支机构之间的带宽非常有限。当该项目涉及基于网络的计费系统时,该系统将生成 pdf 格式的账单。然而,由于带宽有限,pdf bill 的性能非常慢。
因为我使用的报告方法是JasperReport,所以我现在的想法是:从服务器端将jasper生成的xml文件中的账单抽出来,然后在客户端将xml转换为pdf (在浏览器中)。这是因为xml(或文本)通过http的压缩率比pdf高。
现在的问题是,如何在客户端(或浏览器)端将jasper生成的xml文件转换为pdf?
有什么建议吗?
(找到了另一个使用javascript生成pdf的解决方案(jspdf),但是该项目似乎已停止一阵子...)
I am doing a project where the customer has a very limited bandwidth between branches. When the project is regard of a web based billing system that will produce a bill in pdf format. However because the limited bandwidth, the performance of pdf bill is very slow.
Because the reporting method that I used is JasperReport
, what I am thinking now is: from the server side will pump out the bill in jasper generated xml file, then the xml will be converted to pdf at client side (in the browser). It is because compressing rate of xml (or text) through http is higher than pdf.
Now the problem is, how to convert the jasper generated xml file into pdf at the client (or browser) side?
Any suggestion?
(found another solution using javascript to geneate pdf (jspdf), however the project seems being stop for a while...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好问题。我不知道基于纯浏览器的解决方案,您可以使用 java applet 或以 webstart 启动的 java 应用程序来执行执行转换的 java 程序(使用 JasperReports jar)。
另一个想法可能是将报告格式化为 HTML,并让用户使用浏览器打印它。
Good question. I'm not aware of the pure browser based solution, you could use a java applet or a java application started with webstart to execute a java program that does the conversion (with JasperReports jars).
Another idea could be to format the report in HTML and let the user print it with the browser.