Pallavipradeep
Pallavipradeep

Reputation: 101

How to generate a PDF file from jasperserver report using java

Am displaying a jasper report through my application using iframe tag inside my jsp like this

<%String url="http://192.168.0.117:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2Fsamples&reportUnit=%2Freports%2Fsamples%2FAllAccounts&decorate=no&j_username=jasperadmin&j_password=jasperadmin"; %>
 <iFRAME  frameborder="1" class=repframe    id="filterIFrame" name="filterIFrame" scrolling="no" src='<%=url %>' height=700px width=1500px>
 </iFRAME>

Now when user clicks on button it should generate a pdf file. I tried so many links that showing sample code like if .jasper or .jrxml files are stored in web server then we can pick that file and save it as PDF. But for me it should pick from jasper server location through url or report path and should get stored in application server.

Suggest me how to go about.

Upvotes: 0

Views: 2225

Answers (1)

Jigar Mehta
Jigar Mehta

Reputation: 133

Append "&output=pdf" in your report URL for downloading it in PDF format.

For Example:

Use this URL:

<%String url="http://192.168.0.117:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2Fsamples&reportUnit=%2Freports%2Fsamples%2FAllAccounts&decorate=no&j_username=jasperadmin&j_password=jasperadmin&output=pdf"; %>

Upvotes: 1

Related Questions