Jump to content
Changes to the Jaspersoft community edition download ×

JRGraphics2DExporter - Export jrxml as JPG


Novaa

Recommended Posts

Hello Community,

i need to export an jrxml to jpg.

This is my code:

JasperReport report = (JasperReport) JRLoader.loadObjectFromFile("Barcode.jasper");        HashMap parameter = new HashMap();        JasperPrint print = JasperFillManager.fillReport(report, parameter);        JRGraphics2DExporter exporter = new JRGraphics2DExporter();        exporter.setExporterInput(new SimpleExporterInput(print));        exporter.setExporterOutput(new SimpleGraphics2DExporterOutput());        SimpleGraphics2DReportConfiguration param = new SimpleGraphics2DReportConfiguration();        SimpleGraphics2DExporterOutput param2 = new SimpleGraphics2DExporterOutput();[/code]

What i need to do next?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

JasperPrint jasperPrint = (JasperPrint) JasperFillManager.fillReport(jasperReport, null, new JREmptyDataSource());

Image img = JasperPrintManager.printPageToImage(jasperPrint, 0, 2.0f);

BufferedImage bi = (BufferedImage)img;

ImageIO.write(bi, "jpg", new File(outputFilename));

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...