/** * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfStream(InputStream, OutputStream)}. */ public static void printReportToPdfStream( InputStream inputStream, OutputStream outputStream ) throws JRException { JasperExportManager.exportReportToPdfStream(inputStream, outputStream); }
/** * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfStream(InputStream, OutputStream)}. */ public static void printReportToPdfStream( InputStream inputStream, OutputStream outputStream ) throws JRException { JasperExportManager.exportReportToPdfStream( inputStream, outputStream ); }
/** * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfStream(JasperPrint, OutputStream)}. */ public static void printReportToPdfStream( JasperPrint jasperPrint, OutputStream outputStream ) throws JRException { JasperExportManager.exportReportToPdfStream( jasperPrint, outputStream ); }
/** * @deprecated Replaced by {@link JasperExportManager#exportReportToPdfStream(JasperPrint, OutputStream)}. */ public static void printReportToPdfStream( JasperPrint jasperPrint, OutputStream outputStream ) throws JRException { JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }
private void exportReportToPdf(final JasperPrint jasperPrint, final OutputStream outputStream) throws JRException { JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }
private void exportReportToPdf(final JasperPrint jasperPrint, final OutputStream outputStream) throws JRException { JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }
public void writeToContent(OutputStream out) throws IOException { try { JasperExportManager.exportReportToPdfStream(report, out); } catch (JRException ex) { IOException ioe = new IOException(ex.getMessage()); ioe.initCause(ex); throw ioe; } } };
/** * Fills a report and sends it directly to an OutputStream in PDF format. * The intermediate JasperPrint object is not saved on disk. */ public static void runReportToPdfStream( InputStream inputStream, OutputStream outputStream, Map parameters, JRDataSource jrDataSource ) throws JRException { /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, parameters, jrDataSource); JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }
/** * Fills a report and sends it directly to an OutputStream in PDF format. * The intermediate JasperPrint object is not saved on disk. */ public static void runReportToPdfStream( InputStream inputStream, OutputStream outputStream, Map parameters, Connection conn ) throws JRException { /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, parameters, conn); JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }
/** * Exports the generated report read from the supplied input stream into PDF format and * writes the results to the output stream specified by the second parameter. * * @param inputStream input stream to read the generated report object from * @param outputStream output stream to write the resulting PDF content to * @see net.sf.jasperreports.engine.export.JRPdfExporter */ public static void exportReportToPdfStream( InputStream inputStream, OutputStream outputStream ) throws JRException { JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(inputStream); exportReportToPdfStream(jasperPrint, outputStream); }
/** * Fills a report and sends it directly to an OutputStream in PDF format. * The intermediate JasperPrint object is not saved on disk. * * @param inputStream compiled report input stream * @param outputStream PDF output stream * @param parameters parameters map * @throws JRException * @see net.sf.jasperreports.engine.fill.JRFiller#fillReport(JasperReport, Map) */ public static void runReportToPdfStream( InputStream inputStream, OutputStream outputStream, Map parameters ) throws JRException { /* */ JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, parameters); JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); }
/** * Gera um boleto em PDF, e grava no OutputStream passado. * * @param out Local para gravação do PDF. */ public void geraPDF(OutputStream out){ try { JasperPrint relatorio = geraRelatorio(); JasperExportManager.exportReportToPdfStream(relatorio, out); } catch (Exception e) { throw new GeracaoBoletoException(e); } }
/** * Gera um boleto em PDF, e grava no OutputStream passado. * * @param out Local para gravação do PDF. */ public void geraPDF(OutputStream out){ try { JasperPrint relatorio = geraRelatorio(); JasperExportManager.exportReportToPdfStream(relatorio, out); } catch (Exception e) { throw new GeracaoBoletoException(e); } }
/** * Writes a Jasper Reports representation of the given Grid to the given OutputStream. */ public static void toJasperReport( Grid grid, Map<String, Object> params, OutputStream out ) throws Exception { if ( grid == null ) { return; } final StringWriter writer = new StringWriter(); render( grid, params, writer, JASPER_TEMPLATE ); String report = writer.toString(); JasperReport jasperReport = JasperCompileManager.compileReport( IOUtils.toInputStream( report, StandardCharsets.UTF_8 ) ); JasperPrint print = JasperFillManager.fillReport( jasperReport, params, grid ); JasperExportManager.exportReportToPdfStream( print, out ); }
public static void visualizaJasperEmPdf(String nomeArquivoJasper, List<?> listaDados, Map<String, Object> parametros) { FacesContext facesContext = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); try { ServletOutputStream streamDeSaida = response.getOutputStream(); JRDataSource dados = new JRBeanCollectionDataSource(listaDados); JasperPrint impressoraJasper = JasperFillManager.fillReport(nomeArquivoJasper, parametros, dados); response.setContentType("application/pdf"); response.setHeader("Content-disposition", "inline; filename=\"relatorio.pdf\""); JasperExportManager.exportReportToPdfStream(impressoraJasper, streamDeSaida); facesContext.responseComplete(); } catch (JRException | IOException e) { LogUtils.generate(e); } }
public void renderReport(boolean removeFrame) { try { JasperPrint jasperPrint = generateReport(removeFrame); log.info("BEGIN: Export report"); switch (reportType) { case HTML: JasperExportManager.exportReportToHtmlFile(jasperPrint, outputReportLocation); break; case PDF: JasperExportManager.exportReportToPdfStream(jasperPrint, Files.newOutputStream(Paths.get(outputReportLocation))); break; default: throw new ConfigurationException("ReportType is not specified"); } if (doGenerateXmlReport) { XMLReporter.create(context, sessionId).generateReport(); } log.info("END: Export report"); } catch (JRException | IOException e) { log.error("Error during report rendering", e); throw new TechnicalException(e); } }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { JasperPrint report = (JasperPrint) context .get(ActionContextConstants.ACTION_PARAM); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JasperExportManager.exportReportToPdfStream(report, baos); IResource resource = new MemoryResource("application/pdf", baos .toByteArray()); String resourceId = ResourceManager.getInstance().register(resource); context.put(ActionContextConstants.ACTION_PARAM, ResourceProviderServlet .computeUrl(SessionManager.getSession().getServletRequest(), resourceId)); return super.execute(actionHandler, context); } catch (JRException ex) { throw new ActionException(ex); } } }