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

rovell74

Members
  • Posts

    1
  • Joined

  • Last visited

rovell74's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  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...