samaresh Posted November 15, 2007 Share Posted November 15, 2007 is there a way to generate PDF using jasper server api? does jasperserver gives api/exposes any webservice method to generate pdf? Link to comment Share on other sites More sharing options...
lucianc Posted November 15, 2007 Share Posted November 15, 2007 The runReport web service operation can produce PDF output. You can find more details about this in the JasperServer web services guide. HTH,Lucian Link to comment Share on other sites More sharing options...
samaresh Posted November 15, 2007 Author Share Posted November 15, 2007 it will be very helpful if you can post sample code to generate pdf using runreport. i have seen that we have to set run_output_format to pdf.can you please give the steps to do it??? Thanks in advance Link to comment Share on other sites More sharing options...
codyjasperForge Posted November 15, 2007 Share Posted November 15, 2007 There is a great example of this in the JasperServer distribution. Look under samples -> webapp-sample, and it has the details that you will need. Pay close attention to the web service client code, it helped me the most. Link to comment Share on other sites More sharing options...
samaresh Posted November 16, 2007 Author Share Posted November 16, 2007 i have downloaded jasperserver-2.0.1-src.zip and seen under jasper server 2.0.1jasperserver-2.0.1jasperserversamplesjava-webapp-samplesrccomjaspersoftjasperserversampleWSClient.javait has not given any example of getting pdf from runreport method. please help me out. Thanks in Advance!!! Here is the Code====================================================== import net.sf.jasperreports.engine.JasperPrint;import com.jaspersoft.jasperserver.irplugin.JServer; import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.*; public class WSClient { private JServer server = null; public WSClient(String webServiceUrl, String username, String password) { server = new JServer(); server.setUsername(username); server.setPassword(password); server.setUrl(webServiceUrl); } public java.util.List list(String uri) throws Exception { ResourceDescriptor rd = new ResourceDescriptor(); rd.setWsType( ResourceDescriptor.TYPE_FOLDER); rd.setUriString(uri); return server.getWSClient().list(rd); } public ResourceDescriptor get(String uri) throws Exception { return get(uri, null); } public ResourceDescriptor get(String uri, java.util.List args) throws Exception { ResourceDescriptor rd = new ResourceDescriptor(); rd.setWsType( ResourceDescriptor.TYPE_REPORTUNIT); rd.setUriString(uri); return server.getWSClient().get(rd, null,args); } public JasperPrint runReport(String reportUri, java.util.Map parameters) throws Exception { ResourceDescriptor rd = new ResourceDescriptor(); rd.setWsType( ResourceDescriptor.TYPE_REPORTUNIT); rd.setUriString(reportUri); return server.getWSClient().runReport(rd, parameters); } }==================================================== Link to comment Share on other sites More sharing options...
codyjasperForge Posted November 16, 2007 Share Posted November 16, 2007 Now you should look at each .jsp included in the sample, this is where the actual implementations are. They are very straight forward. (runReport.jsp, executeReport.jsp etc.) Hope it helps. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now