Jump to content
We've recently updated our Privacy Statement, available here ×

rovell74

Members
  • Posts

    1
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by rovell74

  1. I'm using JasperReports to generate pdf and put it to the OutputStream. It it possible to send pdf directly to a printer without displaying dialog box to select the printer? The code i use is JasperPrint jasperPrint = null; response.setContentType("application/x-download"); response.setHeader("Content-Disposition", String.format("attachment; filename=""+fileName+""")); OutputStream out = response.getOutputStream(); String path = resourceLoader.getResource(reportResource).getURI().getPath(); JasperReport jasperReport = JasperCompileManager.compileReport(path); //Map<String, Object> parameters = new HashMap<String, Object>(); jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, dataSource); //JasperExportManager.exportReportToPdfStream(jasperPrint, out); /**/ JRPdfExporter exporter = new JRPdfExporter();//tJasperReportsContext.getInstance()); SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration(); if (printDialog) { configuration.setPdfJavaScript("this.print()"); } exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(out)); exporter.setConfiguration(configuration); exporter.exportReport(); Thank
×
×
  • Create New...