I use the following code the generate a pdf to output stream from a custom datasource. A also load directelly the compiled .jasper file so you don't have to compile the .jrxml file for each run. is = ReportConstants.getPdfJasperFilename(); ds = new JRBeanCollectionDataSource(getSortedBean()); try { JasperReport jasperReport = (JasperReport) JRLoader.loadObject(is); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds); JasperExportManager.exportReportToPdfStream(jasperPrint, os); } catch (JRException e) { e.printStackTrace(); logger.error(e); }