How to turn off JasperReports generated image file names for HTML reports?

邮差的信 提交于 2020-01-04 09:18:50

问题


I have a Jasper report that gets sent out at a scheduled time via Quartz. After JasperReports generates the markup I shove it into an email that goes out to the customer. There are several sub-reports inside this main report with footer images at the bottom of the main report. The images src values point back to the generated image file name (the one's Jasper makes, ie: blah/img_0_0_13). I setup a web server to hold the report's generated HTML files, so they can be accessed anywhere, ie: http://example.com/jasperreport/images/thisreallysucks/SampleReport.html_files/img_0_0_13

So my question is how do I turn off this crazy file name generation and just use something simple ie: http://example.com/jasperreport/images/thisdoesntsuckasbad/SampleReport.html_file/example_logo.gif

I am setting JRHtmlExporterParameter.IMAGES_URI to point to web server with the images.

Another big problem with this is if any of the sub-reports are missing due to lack of data, then the generated files for the images change. I have 4 sub-reports...


回答1:


"Lazy loaded images are not given a name, because they are supposed to be loaded by the browser from a public URL available at HTML-rendering time."

http://books.google.com/books?id=LWTbssKt6MUC&pg=PA197&lpg=PA197&dq=jasperreport+the+best+way+to+handle+html+images&source=bl&ots=aSG-engMXd&sig=U7XuZWQs8dseDCwW9ZWAbJG_qT4&hl=en&sa=X&ei=by4fT6nHNsbL0QGA3fEG&ved=0CH0Q6AEwCQ#v=onepage&q=jasperreport%20the%20best%20way%20to%20handle%20html%20images&f=false

There is a "Is Lazy" setting in iReport for images, which does what I want.



来源:https://stackoverflow.com/questions/8994640/how-to-turn-off-jasperreports-generated-image-file-names-for-html-reports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!