public static byte[] getPdf(JasperPrint jasperPrint) throws JRException {
        byte[] content = null;
        ByteArrayOutputStream baos = null;
        try {
            baos = new ByteArrayOutputStream();
            JRPdfExporter exporter = new JRPdfExporter();
            content = getBytes(exporter, baos, jasperPrint);
        } finally {
            if (baos != null) {
                try {
                    baos.flush();
                    baos.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return content;
    }
public static byte [ ] getPdf ( JasperPrint jasperPrint ) throws JRException { byte [ ] content = null ; ByteArrayOutputStream baos = null ; try { baos = new ByteArrayOutputStream ( ) ; JRPdfExporter exporter = new JRPdfExporter ( ) ; content = getBytes ( exporter , baos , jasperPrint ) ; } finally { if ( baos != null ) { try { baos . flush ( ) ; baos . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } return content ; }
/*
public static JasperPrint fillReport(File jasper, Map params, Connection conn) throws Exception {
FileInputStream input = new FileInputStream(jasper);
return JasperFillManager.fillReport(input, params, conn);
}