Problem when passing an image to a JasperReport

0

I'm trying to send an image as a parameter to a jasperRepor, but when I'm going to generate the report it tells me that the parameter is null.

public void generarReporte(String ruta) throws JRException {

    try {

        //   File reportFile = new File("");
        HashMap<String, Object> parametro = new HashMap<>();
        InputStream io = this.getClass().getClassLoader().getResourceAsStream("IME/" + ruta);

        parametro.put("logo", io);
        System.out.println(ruta);

        System.out.println(parametro.toString());
        JasperReport jasperReport = (JasperReport) JRLoader.loadObject(new File("src\aplicacionmipe\report1.jasper"));

        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parametro);
        JasperViewer view = new JasperViewer(jasperPrint, false);
        view.setVisible(true);
    } catch (JRException ex) {

        System.out.println("Error: " + ex);
    }

}
    
asked by Jeisson Hernandez 06.12.2017 в 21:40
source

0 answers