private JRExporter xml(JasperIXmlExporter jasperExporter) { JRExporter jrExporter = new JRXmlExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getEmbeddingImages() != null) { jrExporter.setParameter( JRXmlExporterParameter.IS_EMBEDDING_IMAGES, jasperExporter.getEmbeddingImages()); } return jrExporter; }
private static void render(JRExporter exporter, JasperPrint print, String destFileName) { try { exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFileName); exporter.exportReport(); } catch (JRException jrEx) { LOG.error(ERROR_GENERATING + print.getName(), jrEx); } }
@SuppressWarnings({"rawtypes", "unchecked"}) protected void procesar(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub /*CABECERA DE SALIDA*/ response.setHeader("Content-Disposition", "attachment; filename=\"CronogramaCredito.pdf\";"); response.setHeader("Cache-Control", "no-cache"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0); response.setContentType("application/pdf"); /*OBTIENE FLUJO DE SALIDA*/ ServletOutputStream outputStream = response.getOutputStream(); /*PARAMETROS*/ Parameters parameters = Parameters.getInstance(); /*SERVICIO DE GENERACION DE REPORTES*/ ReporteJasperServiceImpl jasperServiceImpl = new ReporteJasperServiceImpl(); /*RECUPERA DATOS DE LA SIMULACION EN SESION*/ HttpSession session = request.getSession(true); CreditoCabeceraBO creditoCabeceraBO = (CreditoCabeceraBO) session.getAttribute("creditoCabeceraBO"); CreditoCronogramaBO creditoCronogramaBO = (CreditoCronogramaBO) session.getAttribute("creditoCronogramaBO"); List<Cuota> listaCuotasCredito = (List<Cuota>) session.getAttribute("listaCuotasCredito"); try { /* CARGA PARAMETROS PARA REPORTE JASPER*/ JasperReport reporte = (JasperReport) JRLoader.loadObject( this.getClass() .getClassLoader() .getResourceAsStream(parameters.getKey("REPORTE_CREDITO_PYME"))); /* CARGA PARAMETROS DEL REPORTE*/ Map paramReporte = jasperServiceImpl.getParamReporCredPYME(creditoCabeceraBO, creditoCronogramaBO); /* GENERA REPORTE*/ JRExporter exporterPDF = jasperServiceImpl.getExporterJasper( reporte, paramReporte, new JRBeanCollectionDataSource(listaCuotasCredito)); exporterPDF.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); /*MUESTRA REPORTE EN LINEA*/ exporterPDF.exportReport(); } catch (JRException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private JRExporter text(JasperITextExporter jasperExporter) { JRExporter jrExporter = new JRTextExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getCharacterWidth() != null) { jrExporter.setParameter( JRTextExporterParameter.CHARACTER_WIDTH, jasperExporter.getCharacterWidth()); } else { DRFont font = Defaults.getDefaults().getFont(); jrExporter.setParameter( JRTextExporterParameter.CHARACTER_WIDTH, new Float(StyleResolver.getFontWidth(font))); } if (jasperExporter.getCharacterHeight() != null) { jrExporter.setParameter( JRTextExporterParameter.CHARACTER_HEIGHT, jasperExporter.getCharacterHeight()); } else { DRFont font = Defaults.getDefaults().getFont(); jrExporter.setParameter( JRTextExporterParameter.CHARACTER_HEIGHT, new Float(StyleResolver.getFontHeight(font))); } if (jasperExporter.getPageWidth() != null) { jrExporter.setParameter(JRTextExporterParameter.PAGE_WIDTH, jasperExporter.getPageWidth()); } if (jasperExporter.getPageHeight() != null) { jrExporter.setParameter(JRTextExporterParameter.PAGE_HEIGHT, jasperExporter.getPageHeight()); } if (jasperExporter.getBetweenPagesText() != null) { jrExporter.setParameter( JRTextExporterParameter.BETWEEN_PAGES_TEXT, jasperExporter.getBetweenPagesText()); } if (jasperExporter.getLineSeparator() != null) { jrExporter.setParameter( JRTextExporterParameter.LINE_SEPARATOR, jasperExporter.getLineSeparator()); } return jrExporter; }
private JRExporter csv(JasperICsvExporter jasperExporter) { JRExporter jrExporter = new JRCsvExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getFieldDelimiter() != null) { jrExporter.setParameter( JRCsvExporterParameter.FIELD_DELIMITER, jasperExporter.getFieldDelimiter()); } if (jasperExporter.getRecordDelimiter() != null) { jrExporter.setParameter( JRCsvExporterParameter.RECORD_DELIMITER, jasperExporter.getRecordDelimiter()); } return jrExporter; }
private JRExporter docx(JasperIDocxExporter jasperExporter) { JRExporter jrExporter = new JRDocxExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getFramesAsNestedTables() != null) { jrExporter.setParameter( JRDocxExporterParameter.FRAMES_AS_NESTED_TABLES, jasperExporter.getFramesAsNestedTables()); } if (jasperExporter.getFlexibleRowHeight() != null) { jrExporter.setParameter( JRDocxExporterParameter.FLEXIBLE_ROW_HEIGHT, jasperExporter.getFlexibleRowHeight()); } return jrExporter; }
public static byte[] printReport( final File filejrxml, Map<String, Object> param, final Connection conn, String reportFormat) throws IOException, NamingException, SQLException, JRException { final JasperPrint jasperPrintTemp = getJasperPrint(filejrxml, param, conn); JasperPrintManager.printReport(jasperPrintTemp, false); JRExporter exporter = getJREXporter(reportFormat); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrintTemp); exporter.exportReport(); return byteArrayOutputStream.toByteArray(); }
/** * Run a Jasper report to CSV format and put the results in a byte array * * @param jasperPrint The Print object to render as CSV * @param exporter The exporter to use to export the report * @return A CSV formatted report * @throws net.sf.jasperreports.engine.JRException If there is a problem running the report */ private byte[] exportReportToBytes(JasperPrint jasperPrint, JRExporter exporter) throws JRException { byte[] output; ByteArrayOutputStream baos = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos); if (delimiter != null) { exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, delimiter); } exporter.exportReport(); output = baos.toByteArray(); return output; }
public void showReportfromJrxml() throws JRException, IOException { JasperReport jasp = JasperCompileManager.compileReport(jrxmlSrc); JasperPrint jaspPrint = JasperFillManager.fillReport(jasp, parameters, con); ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); JRExporter exporter = new JRPdfExporter(); exporter.setParameters(parameters); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jaspPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, arrayOutputStream); exporter.exportReport(); arrayOutputStream.close(); final AMedia amedia = new AMedia( "Balance Ingresos y Egresos.pdf", "pdf", "application/pdf", arrayOutputStream.toByteArray()); ifReport.setContent(amedia); }
@Override protected void ecrireFichier(final T toExport, final OutputStream os) throws IOException, HttpMessageNotWritableException { // Récupération du model (Template + Bean à écrire) final PdfConverterIn model = getServiceExport(toExport).construirePdfModel(toExport); // Récupération de l'InputStream du template final InputStream isTemplate = model.getTemplate().getInputStream(); try { // Création d'une dataSource Jasper avec le bean à exporter // Les dataSources sont forcément sous forme de map ou de collection final JRDataSource jasperDs = new JRBeanCollectionDataSource(Collections.singletonList(toExport)); // Merge de la dataSource et du template vers un JasperPrint (non dépendant du format final) final JasperPrint jasperPrint = JasperFillManager.fillReport(isTemplate, null, jasperDs); // Export du JasperPrint au format PDF (JRPdfExporter) dans l'outputStream final JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os); exporter.exportReport(); } catch (final JRException jre) { LOG.error( "Erreur lors de l'export PDF avec le template : {}", model.getTemplate().getDescription()); throw new HttpMessageNotWritableException( "Erreur lors de l'export Jasper avec le template " + model.getTemplate().getDescription(), jre); } catch (final Exception e) { LOG.error( "Erreur lors de l'export PDF avec le template : {}", model.getTemplate().getDescription()); throw e; } finally { IOUtils.closeQuietly(isTemplate); } }
/** 导出word */ private static void exportWord( JasperPrint jasperPrint, String defaultFilename, HttpServletRequest request, HttpServletResponse response) throws JRException, IOException { response.setContentType("application/msword;charset=utf-8"); String defaultname = null; if (defaultFilename.trim() != null && defaultFilename != null) { defaultname = defaultFilename + ".doc"; } else { defaultname = "export.doc"; } String fileName = new String(defaultname.getBytes("GBK"), "utf-8"); response.setHeader("Content-disposition", "attachment; filename=" + fileName); JRExporter exporter = new JRRtfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream()); exporter.exportReport(); }
private JRExporter xhtml(JasperIXhtmlExporter jasperExporter) { JRExporter jrExporter = new JRXhtmlExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getOutputImagesToDir() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, jasperExporter.getOutputImagesToDir()); } if (jasperExporter.getImagesDirName() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IMAGES_DIR_NAME, jasperExporter.getImagesDirName()); } if (jasperExporter.getImagesURI() != null) { jrExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, jasperExporter.getImagesURI()); } if (jasperExporter.getHtmlHeader() != null) { jrExporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, jasperExporter.getHtmlHeader()); } if (jasperExporter.getBetweenPagesHtml() != null) { jrExporter.setParameter( JRHtmlExporterParameter.BETWEEN_PAGES_HTML, jasperExporter.getBetweenPagesHtml()); } if (jasperExporter.getHtmlFooter() != null) { jrExporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER, jasperExporter.getHtmlFooter()); } if (jasperExporter.getWhitePageBackground() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, jasperExporter.getWhitePageBackground()); } if (jasperExporter.getWrapBreakWord() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_WRAP_BREAK_WORD, jasperExporter.getWrapBreakWord()); } if (jasperExporter.getSizeUnit() != null) { jrExporter.setParameter( JRHtmlExporterParameter.SIZE_UNIT, ConstantTransform.sizeUnit(jasperExporter.getSizeUnit())); } return jrExporter; }
public static void main(String[] args) throws SQLException, JRException, FileNotFoundException { JasperCompileManager.compileReportToFile("movimentacoes.jrxml"); Map<String, Object> parametros = new HashMap<String, Object>(); // ƒ preciso initializar a datasource para ler um arquivo movimentacoes.csv String[] columnNames = new String[] {"id", "data", "descricao", "tipoMovimentacao", "valor"}; JRCsvDataSource dataSource = new JRCsvDataSource(JRLoader.getLocationInputStream("movimentacoes.csv")); dataSource.setColumnNames(columnNames); dataSource.setDatePattern("yyyy-MM-dd"); JasperPrint print = JasperFillManager.fillReport("movimentacoes.jasper", parametros, dataSource); JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter( JRExporterParameter.OUTPUT_STREAM, new FileOutputStream("movimentacoes.pdf")); exporter.exportReport(); }
public JRExporter getExporter(final String _format) { checkFormat(_format); final JRExporter exporter = ((FormatInfo) FORMAT_INFO.get(_format)).getExporterInstance(); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); return exporter; }
@SuppressWarnings({"rawtypes"}) public static synchronized void gerarRelatorio( List<? extends Entidade> lista, String formato, String caminhoImagem) throws JRException, IOException { if (lista != null && !lista.isEmpty()) { DynamicReport relatorio = criaRelatorioDinamico(lista, caminhoImagem); FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); JasperPrint jasperPrint = DynamicJasperHelper.generateJasperPrint(relatorio, new ClassicLayoutManager(), lista); JRExporter jrExporter = null; String contentType = null; if ("PDF".equalsIgnoreCase(formato)) { jrExporter = new JRPdfExporter(); contentType = "application/pdf"; } if ("XLS".equalsIgnoreCase(formato)) { jrExporter = new JRXlsExporter(); contentType = "application/vnd.ms-excel"; jrExporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); jrExporter.setParameter( JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); jrExporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); } response.setContentType(contentType); response.setHeader( "Content-Disposition", "attachment; filename=" + relatorio.getReportName() + "." + formato.toLowerCase()); ServletOutputStream outputStream = response.getOutputStream(); jrExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); jrExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); jrExporter.exportReport(); outputStream.flush(); outputStream.close(); context.renderResponse(); context.responseComplete(); } }
private JRExporter exporter(JRExporter jrExporter, JasperIExporter jasperExporter) { if (jasperExporter.getOutputWriter() != null) { jrExporter.setParameter(JRExporterParameter.OUTPUT_WRITER, jasperExporter.getOutputWriter()); } if (jasperExporter.getOutputStream() != null) { jrExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, jasperExporter.getOutputStream()); } if (jasperExporter.getOutputFile() != null) { jrExporter.setParameter(JRExporterParameter.OUTPUT_FILE, jasperExporter.getOutputFile()); } if (jasperExporter.getOutputFileName() != null) { jrExporter.setParameter( JRExporterParameter.OUTPUT_FILE_NAME, jasperExporter.getOutputFileName()); } if (jasperExporter.getPageIndex() != null) { jrExporter.setParameter(JRExporterParameter.PAGE_INDEX, jasperExporter.getPageIndex()); } if (jasperExporter.getStartPageIndex() != null) { jrExporter.setParameter( JRExporterParameter.START_PAGE_INDEX, jasperExporter.getStartPageIndex()); } if (jasperExporter.getEndPageIndex() != null) { jrExporter.setParameter(JRExporterParameter.END_PAGE_INDEX, jasperExporter.getEndPageIndex()); } if (jasperExporter.getCharacterEncoding() != null) { jrExporter.setParameter( JRExporterParameter.CHARACTER_ENCODING, jasperExporter.getCharacterEncoding()); } if (jasperExporter.getOffsetX() != null) { jrExporter.setParameter(JRExporterParameter.OFFSET_X, jasperExporter.getOffsetX()); } if (jasperExporter.getOffsetY() != null) { jrExporter.setParameter(JRExporterParameter.OFFSET_Y, jasperExporter.getOffsetY()); } if (jasperExporter.getIgnorePageMargins() != null) { jrExporter.setParameter( JRExporterParameter.IGNORE_PAGE_MARGINS, jasperExporter.getIgnorePageMargins()); } return null; }
protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { // Will throw a runtime exception if no "datasource" property. initializeProperties(invocation); if (LOG.isDebugEnabled()) { LOG.debug( "Creating JasperReport for dataSource = " + dataSource + ", format = " + format, new Object[0]); } HttpServletRequest request = (HttpServletRequest) invocation.getInvocationContext().get(ServletActionContext.HTTP_REQUEST); HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(ServletActionContext.HTTP_RESPONSE); // Handle IE special case: it sends a "contype" request first. if ("contype".equals(request.getHeader("User-Agent"))) { try { response.setContentType("application/pdf"); response.setContentLength(0); ServletOutputStream outputStream = response.getOutputStream(); outputStream.close(); } catch (IOException e) { LOG.error("Error writing report output", e); throw new ServletException(e.getMessage(), e); } return; } // Construct the data source for the report. ValueStack stack = invocation.getStack(); ValueStackDataSource stackDataSource = null; Connection conn = (Connection) stack.findValue(connection); if (conn == null) stackDataSource = new ValueStackDataSource(stack, dataSource); // Determine the directory that the report file is in and set the reportDirectory parameter // For WW 2.1.7: // ServletContext servletContext = ((ServletConfig) // invocation.getInvocationContext().get(ServletActionContext.SERVLET_CONFIG)).getServletContext(); ServletContext servletContext = (ServletContext) invocation.getInvocationContext().get(ServletActionContext.SERVLET_CONTEXT); String systemId = servletContext.getRealPath(finalLocation); Map parameters = new ValueStackShadowMap(stack); File directory = new File(systemId.substring(0, systemId.lastIndexOf(File.separator))); parameters.put("reportDirectory", directory); parameters.put(JRParameter.REPORT_LOCALE, invocation.getInvocationContext().getLocale()); // put timezone in jasper report parameter if (timeZone != null) { timeZone = conditionalParse(timeZone, invocation); final TimeZone tz = TimeZone.getTimeZone(timeZone); if (tz != null) { // put the report time zone parameters.put(JRParameter.REPORT_TIME_ZONE, tz); } } // Add any report parameters from action to param map. Map reportParams = (Map) stack.findValue(reportParameters); if (reportParams != null) { if (LOG.isDebugEnabled()) { LOG.debug("Found report parameters; adding to parameters...", new Object[0]); } parameters.putAll(reportParams); } byte[] output; JasperPrint jasperPrint; // Fill the report and produce a print object try { JasperReport jasperReport = (JasperReport) JRLoader.loadObject(new File(systemId)); if (conn == null) jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, stackDataSource); else jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); } catch (JRException e) { LOG.error("Error building report for uri " + systemId, e); throw new ServletException(e.getMessage(), e); } // Export the print object to the desired output format try { if (contentDisposition != null || documentName != null) { final StringBuffer tmp = new StringBuffer(); tmp.append((contentDisposition == null) ? "inline" : contentDisposition); if (documentName != null) { tmp.append("; filename="); tmp.append(documentName); tmp.append("."); tmp.append(format.toLowerCase()); } response.setHeader("Content-disposition", tmp.toString()); } JRExporter exporter; if (format.equals(FORMAT_PDF)) { response.setContentType("application/pdf"); exporter = new JRPdfExporter(); } else if (format.equals(FORMAT_CSV)) { response.setContentType("text/csv"); exporter = new JRCsvExporter(); } else if (format.equals(FORMAT_HTML)) { response.setContentType("text/html"); // IMAGES_MAPS seems to be only supported as "backward compatible" from JasperReports 1.1.0 Map imagesMap = new HashMap(); request.getSession(true).setAttribute("IMAGES_MAP", imagesMap); exporter = new JRHtmlExporter(); exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap); exporter.setParameter( JRHtmlExporterParameter.IMAGES_URI, request.getContextPath() + imageServletUrl); // Needed to support chart images: exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); request.getSession().setAttribute("net.sf.jasperreports.j2ee.jasper_print", jasperPrint); } else if (format.equals(FORMAT_XLS)) { response.setContentType("application/vnd.ms-excel"); exporter = new JRXlsExporter(); } else if (format.equals(FORMAT_XML)) { response.setContentType("text/xml"); exporter = new JRXmlExporter(); } else if (format.equals(FORMAT_RTF)) { response.setContentType("application/rtf"); exporter = new JRRtfExporter(); } else { throw new ServletException("Unknown report format: " + format); } Map exportParams = (Map) stack.findValue(exportParameters); if (exportParams != null) { if (LOG.isDebugEnabled()) { LOG.debug("Found export parameters; adding to exporter parameters...", new Object[0]); } exporter.getParameters().putAll(exportParams); } output = exportReportToBytes(jasperPrint, exporter); } catch (JRException e) { String message = "Error producing " + format + " report for uri " + systemId; LOG.error(message, e); throw new ServletException(e.getMessage(), e); } response.setContentLength(output.length); // Will throw ServletException on IOException. writeReport(response, output); }
private JRExporter pdf(JasperIPdfExporter jasperExporter) { JRExporter jrExporter = new JRPdfExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getCreatingBatchModeBookmarks() != null) { jrExporter.setParameter( JRPdfExporterParameter.IS_CREATING_BATCH_MODE_BOOKMARKS, jasperExporter.getCreatingBatchModeBookmarks()); } if (jasperExporter.getCompressed() != null) { jrExporter.setParameter(JRPdfExporterParameter.IS_COMPRESSED, jasperExporter.getCompressed()); } if (jasperExporter.getEncrypted() != null) { jrExporter.setParameter(JRPdfExporterParameter.IS_ENCRYPTED, jasperExporter.getEncrypted()); } if (jasperExporter.getBitKey128() != null) { jrExporter.setParameter(JRPdfExporterParameter.IS_128_BIT_KEY, jasperExporter.getBitKey128()); } if (jasperExporter.getUserPassword() != null) { jrExporter.setParameter( JRPdfExporterParameter.USER_PASSWORD, jasperExporter.getUserPassword()); } if (jasperExporter.getOwnerPassword() != null) { jrExporter.setParameter( JRPdfExporterParameter.OWNER_PASSWORD, jasperExporter.getOwnerPassword()); } if (jasperExporter.getPermissions() != null && !jasperExporter.getPermissions().isEmpty()) { jrExporter.setParameter( JRPdfExporterParameter.PERMISSIONS, ConstantTransform.pdfPermission(jasperExporter.getPermissions())); } if (jasperExporter.getPdfVersion() != null) { jrExporter.setParameter( JRPdfExporterParameter.PDF_VERSION, ConstantTransform.pdfVersion(jasperExporter.getPdfVersion())); } if (jasperExporter.getMetadataTitle() != null) { jrExporter.setParameter( JRPdfExporterParameter.METADATA_TITLE, jasperExporter.getMetadataTitle()); } if (jasperExporter.getMetadataAuthor() != null) { jrExporter.setParameter( JRPdfExporterParameter.METADATA_AUTHOR, jasperExporter.getMetadataAuthor()); } if (jasperExporter.getMetadataSubject() != null) { jrExporter.setParameter( JRPdfExporterParameter.METADATA_SUBJECT, jasperExporter.getMetadataSubject()); } if (jasperExporter.getMetadataKeyWords() != null) { jrExporter.setParameter( JRPdfExporterParameter.METADATA_KEYWORDS, jasperExporter.getMetadataKeyWords()); } if (jasperExporter.getMetadataCreator() != null) { jrExporter.setParameter( JRPdfExporterParameter.METADATA_CREATOR, jasperExporter.getMetadataCreator()); } if (jasperExporter.getForceSvgShapes() != null) { jrExporter.setParameter( JRPdfExporterParameter.FORCE_SVG_SHAPES, jasperExporter.getForceSvgShapes()); } if (jasperExporter.getPdfJavaScript() != null) { jrExporter.setParameter( JRPdfExporterParameter.PDF_JAVASCRIPT, jasperExporter.getPdfJavaScript()); } if (jasperExporter.getTagged() != null) { jrExporter.setParameter(JRPdfExporterParameter.IS_TAGGED, jasperExporter.getTagged()); } if (jasperExporter.getTagLanguage() != null) { jrExporter.setParameter(JRPdfExporterParameter.TAG_LANGUAGE, jasperExporter.getTagLanguage()); } return jrExporter; }
private JRExporter html(JasperIHtmlExporter jasperExporter) { JRExporter jrExporter = new JRHtmlExporter(); exporter(jrExporter, jasperExporter); if (jasperExporter.getOutputImagesToDir() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, jasperExporter.getOutputImagesToDir()); } if (jasperExporter.getImagesDirName() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IMAGES_DIR_NAME, jasperExporter.getImagesDirName()); } if (jasperExporter.getImagesURI() != null) { jrExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, jasperExporter.getImagesURI()); } if (jasperExporter.getHtmlHeader() != null) { jrExporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, jasperExporter.getHtmlHeader()); } if (jasperExporter.getBetweenPagesHtml() != null) { jrExporter.setParameter( JRHtmlExporterParameter.BETWEEN_PAGES_HTML, jasperExporter.getBetweenPagesHtml()); } if (jasperExporter.getHtmlFooter() != null) { jrExporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER, jasperExporter.getHtmlFooter()); } if (jasperExporter.getRemoveEmptySpaceBetweenRows() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, jasperExporter.getRemoveEmptySpaceBetweenRows()); } if (jasperExporter.getWhitePageBackground() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, jasperExporter.getWhitePageBackground()); } if (jasperExporter.getUsingImagesToAlign() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, jasperExporter.getUsingImagesToAlign()); } if (jasperExporter.getWrapBreakWord() != null) { jrExporter.setParameter( JRHtmlExporterParameter.IS_WRAP_BREAK_WORD, jasperExporter.getWrapBreakWord()); } if (jasperExporter.getSizeUnit() != null) { jrExporter.setParameter( JRHtmlExporterParameter.SIZE_UNIT, ConstantTransform.sizeUnit(jasperExporter.getSizeUnit())); } if (jasperExporter.getFramesAsNestedTables() != null) { jrExporter.setParameter( JRHtmlExporterParameter.FRAMES_AS_NESTED_TABLES, jasperExporter.getFramesAsNestedTables()); } return jrExporter; }