Working with JasperReports

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:

The first two are used with JasperReports, the last with JasperServer.

Call setLicense

This method is used with JasperReports.

  1. Download the license to your computer and copy it to the appropriate folder (for example your application’s folder or JasperReports\lib).
  2. 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.

  1. Download the license to your computer and copy it to the appropriate folder (for example your application’s folder or JasperReports\lib).
  2. 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();