Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to download, not generate the PDF report?
Yufan
(First of all many thanks to previous answer, which provided me a lot of helping. :wub: :wub: :wub: )<br />
<br />
<br />
Hi,<br />
<br />
Currently I am able to generate the PDF format report with HTML render option in the servlet.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
...
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
...</pre>
<br />
Now in my system, user is able to see the the html pdf report.<br />
<br />
But how to generate a PDF report for user to Download it?<br />
<br />
The scenario is like :<br />
<br />
<br />
<em class='bbc'><span style='font-size: 12px;'>1. User click the link(<a href/>) from the web page, which triggers a servlet.<br />
<br />
2. On the same page, there popluates a message "xxxx.PDF, open/save/cancel".<br />
<br />
3. User click the "Save" button, and the pdf will be saved to user's local PC.<br />
<br />
</span></em><br />
<br />
<br />
I guess that I should not use the HTML render option, could someone tell me which API shall I call to complete this scenario?<br />
<br />
<br />
Thanks again,<br />
<br />
Yufan
Find more posts tagged with
Comments
Yufan
I have completed this scenario and thanks to some old posts.<br />
<br />
The code I am using is :<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
// create task to run
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask(design);
// check parameters
task.validateParameters();
// set output options
EXCELRenderOption options = new EXCELRenderOption();
options.setOutputFormat("xls");
options.setOutputFileName("report\example.xls");
task.setRenderOption(options);
task.run();
task.close();
</pre>
mwilliams
Glad you found a solution. Let us know whenever you have questions!