Working with JasperReports
Aspose.Words for JasperReports is available for free, time unlimited evaluation from the download page. The evaluation and licensed versions of the product is the same download.
When you are happy with the evaluation version, purchase a license. Make sure you understand and agree to the license terms.
The license is available for download from the order page after the order was paid. The license is a clear text, digitally signed XML file. The license contains information such as the client name, the purchased product and the type of the license. Do not modify the content of the license file: it invalidates the license.
There are several ways to activate a license:
- Call setLicense.
- Set an exporter parameter in the code.
- Set an exporter parameter in applicationContext.xml.
The first two are used with JasperReports, the last with JasperServer.
Call setLicense
This method is used with JasperReports.
- Download the license to your computer and copy it to the appropriate folder (for example your application’s folder or JasperReports\lib).
- Add the following code to your project:
import com.aspose.pdf.jr3_7_0.jasperreports.*;
try
{
// create a stream object containing the license file
FileInputStream fstream = new FileInputStream("C:\\Aspose.PDF.JasperReports.lic");
// Set the license through the stream object
License license = new License();
license.setLicense(fstream);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
Set the licenseFile Exporter Parameter in the Code
This method is used with JasperReports.
- Download the license to your computer and copy it to the appropriate folder (for example your application’s folder or JasperReports\lib).
- Add the following code to your project:
import com.aspose.pdf.jr3_7_0.jasperreports.*;
com.aspose.pdf.jr3_7_0.jasperreports.JrPdfExporter exporter = new com.aspose.pdf.jr3_7_0.jasperreports.JrPdfExporter();
exporter.setParameter(PdfExporterParameter.LICENSE, "Aspose.PDF.JasperReports.lic");
exporter.exportReport();