Nayyer Shahbaz October 17, 2015one Comment

JRXML to PDF/A, DOC, DOCX, XPS, HTML, SVG, MobiXML, Excel, ePUB and different PDF versions using Aspose.Pdf for JasperReports 1.5.0

JRXML to PDF/A, DOC, DOCX, XPS, HTML, SVG, MobiXML, Excel, ePUB and different PDF versions using Aspose.Pdf for JasperReports 1.5.0

October 17, 2015
Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.Pdf for JasperReports iconA new release with some new features has hit the download section. Likewise every release, we always strive to introduce auspicious features which help our customers to fulfill their requirements. So we are pleased to announce the release of Aspose.Pdf for JasperReports 1.5.0 in which we have introduced inter file format conversion features. So now you get the option to transform JRXML file to PDF as well as various other file formats (which are already supported in Aspose.Pdf for Java).

Conversion to various file formats

In this new release, we have implemented some new classes and methods to support conversion of .JRXML file to various other file formats. Following changes have been introduced.

  • Implemented classes: SavingFormatType and PdfFormatType
Implemented methods in the class JrPdfExporter:
  • public void setPdfFormat(int format)/PdfFormatType/
  • public int getPdfFormat()
  • public void setSavingFormat(int type)/SavingFormatType/
  • public int getSavingFormat()
Following are the details regarding newly implemented feature to save the report in the non-pdf file format. For this purpose, we have implemented methods in the class com.aspose.pdf.jr.jasperreports.JrPdfExporter:
  • public void setSavingFormat(int type) //SavingFormatType constant
  • public int getSavingFormat()
We also have Implemented a class: com.aspose.pdf.jr.PdfFormatType With specified below constants:
  • PDF
  • DOC
  • XPS
  • HTML
  • DOCX
  • SVG
  • MOBIXML
  • EXCEL
  • EPUB
Code Snippet:

JasperReport jasperReport = JasperCompileManager
    .compileReport("input.jrxml");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
            new HashMap(), new JREmptyDataSource(10));

JrPdfExporter exporter = new JrPdfExporter();
exporter.setParameter(PdfExporterParameter.JASPER_PRINT, jasperPrint);
String fileName = "output_Pdf_A.pdf";
exporter.setParameter(PdfExporterParameter.OUTPUT_FILE_NAME, fileName);

JrPdfExportParametersBean exportParameters = new JrPdfExportParametersBean();

exportParameters.setPdfAMode(true);
//configure the result file format type
exporter.setSavingFormat(SavingFormatType.DOC);

exportParameters.setSecuredMode(false);

exportParameters.setLicenseFile("Aspose.Pdf.JasperReports.lic");
exporter.setParameter(PdfExporterParameter.LICENSE,
            exportParameters.getAsposePdfLicenseMap());

exporter.exportReport();

Save report in specific PDF format

We have implemented different features to save the report in the specific PDF format. Therefore we have implemented methods in the class com.aspose.pdf.jr.jasperreports.JrPdfExporter:

  • public void setPdfFormat(int format)//PdfFormatType constant
  • public int getPdfFormat()
Implemented class: com.aspose.pdf.jr.PdfFormatType with following constants.
  • PDF_A_1A
  • PDF_A_1B
  • PDF_A_2A
  • PDF_A_3A
  • PDF_A_2B
  • PDF_A_3B
  • v_1_3
  • v_1_4
  • v_1_5
  • v_1_6
  • v_1_7
  • PDF_X_1A
  • PDF_X_3
  • DEFAULT
code snippet.

JasperReport jasperReport = JasperCompileManager
                .compileReport("input.jrxml");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
            new HashMap(), new JREmptyDataSource(10));

JrPdfExporter exporter = new JrPdfExporter();
exporter.setParameter(PdfExporterParameter.JASPER_PRINT, jasperPrint);
String fileName = "output_Pdf_A.pdf";
exporter.setParameter(PdfExporterParameter.OUTPUT_FILE_NAME, fileName);

JrPdfExportParametersBean exportParameters = new JrPdfExportParametersBean();

exportParameters.setPdfAMode(true);
//configure the result pdf format type
exporter.setPdfFormat(PdfFormatType.PDF_A_1A);

exportParameters.setSecuredMode(false);

exportParameters.setLicenseFile("Aspose.Pdf.JasperReports.lic");
exporter.setParameter(PdfExporterParameter.LICENSE,
            exportParameters.getAsposePdfLicenseMap());

exporter.exportReport();

Synchronization with JasperReports-6.1.0

This new release is synchronized with latest JasperReport version 6.1.0 and earlier versions. For compatibility with new versions of JasperReports, we have created a new package named com.aspose.pdf.jr6_1_0. However the name of the package must be considered when setting up the connection library in Jasperreport-Server in files applicationContext.xml and viewReportBeans.xml. So for each JasperReports version, we have specific product binaries.

  • aspose.pdf.jasperreports.jr3.1-1.5.0.jar
  • aspose.pdf.jasperreports.jr3.7-1.5.0.jar
  • aspose.pdf.jasperreports.jr4.5-1.5.0.jar
  • aspose.pdf.jasperreports.jr5.5-1.5.0.jar
  • aspose.pdf.jasperreports.jr5.6-1.5.0.jar
  • aspose.pdf.jasperreports.jr6.1-1.5.0.jar

Aspose.Pdf for JasperReports offers exciting report features such as tables, charts and images and enables you to export reports from JasperReports and JasperServer to Portable Document Format (PDF). In this release, there have been other fixes related to component and we recommend you to please download and start exploring the exciting new release of Aspose.Pdf for JasperReports 1.5.0.

Join the Conversation

1 Comment

Leave a comment

Posted inAspose.PDF Product Family, Nayyer Shahbaz
 

Related Articles