1 /* 2 * ============================================================================ 3 * GNU Lesser General Public License 4 * ============================================================================ 5 * 6 * JasperReports - Free Java report-generating library. 7 * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 22 * 23 * JasperSoft Corporation 24 * 303 Second Street, Suite 450 North 25 * San Francisco, CA 94107 26 * http://www.jaspersoft.com 27 */ 28 package net.sf.jasperreports.engine.export; 29 30 import net.sf.jasperreports.engine.JRExporterParameter; 31 32 33 /** 34 * Contains parameters useful for export in PDF format. 35 * <p> 36 * The PDF exporter can send data to an output stream or a file on disk. The engine looks among the export parameters in 37 * order to find the selected output type in this order: OUTPUT_STREAM, OUTPUT_FILE, OUTPUT_FILE_NAME. 38 * <p> 39 * 40 * @author Teodor Danciu (teodord@users.sourceforge.net) 41 * @version $Id: JRPdfExporterParameter.java 1509 2006-11-29 16:38:57 +0200 (Wed, 29 Nov 2006) shertage $ 42 */ 43 public class JRPdfExporterParameter extends JRExporterParameter 44 { 45 46 47 public static Character PDF_VERSION_1_2 = new Character('2'); // Not using iText constants in order not to depend on the library version 48 public static Character PDF_VERSION_1_3 = new Character('3'); 49 public static Character PDF_VERSION_1_4 = new Character('4'); 50 public static Character PDF_VERSION_1_5 = new Character('5'); 51 public static Character PDF_VERSION_1_6 = new Character('6'); 52 53 54 /** 55 * 56 */ 57 protected JRPdfExporterParameter(String name) 58 { 59 super(name); 60 } 61 62 /** 63 * A boolean value specifying whether the PDF document should contain an outline section 64 */ 65 public static final JRPdfExporterParameter IS_CREATING_BATCH_MODE_BOOKMARKS = new JRPdfExporterParameter("Is Creating Batch Mode Bookmarks"); 66 67 /** 68 * A boolean value specifying whether the PDF document should be compressed. 69 */ 70 public static final JRPdfExporterParameter IS_COMPRESSED = new JRPdfExporterParameter("Is Compressed"); 71 72 /** 73 * A boolean value specifying whether the final PDF document should be encrypted. 74 */ 75 public static final JRPdfExporterParameter IS_ENCRYPTED = new JRPdfExporterParameter("Is Encrypted"); 76 77 /** 78 * A boolean value specifying whether the encryption key is 128 bits. 79 */ 80 public static final JRPdfExporterParameter IS_128_BIT_KEY = new JRPdfExporterParameter("Is 128 Bit Key"); 81 82 83 /** 84 * The user password needed to open the document, if it is encrypted. 85 */ 86 public static final JRPdfExporterParameter USER_PASSWORD = new JRPdfExporterParameter("User Password"); 87 88 89 /** 90 * The password belonging to the owner of the document, if it is encrypted. If the password is null, it will be replaced 91 * by a random string. 92 */ 93 public static final JRPdfExporterParameter OWNER_PASSWORD = new JRPdfExporterParameter("Owner Password"); 94 95 96 /** 97 * An integer value representing the PDF permissions for the generated document. The open permissions for the document 98 * can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, 99 * AllowAssembly and AllowDegradedPrinting (these can all be found in the PdfWriter class of iText library). The 100 * permissions can be combined by applying bitwise OR to them. 101 */ 102 public static final JRPdfExporterParameter PERMISSIONS = new JRPdfExporterParameter("Permissions"); 103 104 105 /** 106 * A <tt>Character</tt> instance representing the version of the generated PDF. This class contains predefined constants 107 * that can be passed as parameters directly. 108 */ 109 public static final JRPdfExporterParameter PDF_VERSION = new JRPdfExporterParameter("PDF Version"); 110 111 /** 112 * The Title of the PDF document, as String. 113 */ 114 public static final JRPdfExporterParameter METADATA_TITLE = new JRPdfExporterParameter("Metadata Title"); 115 116 /** 117 * The Author of the PDF document, as String. 118 */ 119 public static final JRPdfExporterParameter METADATA_AUTHOR = new JRPdfExporterParameter("Metadata Author"); 120 121 /** 122 * The Subject of the PDF document, as String. 123 */ 124 public static final JRPdfExporterParameter METADATA_SUBJECT = new JRPdfExporterParameter("Metadata Subject"); 125 126 /** 127 * The Keywords of the PDF document, as comma-separated String. 128 */ 129 public static final JRPdfExporterParameter METADATA_KEYWORDS = new JRPdfExporterParameter("Metadata Keywords"); 130 131 /** 132 * The Creator or Application for the PDF document, as String, defaults to JasperReports. 133 */ 134 public static final JRPdfExporterParameter METADATA_CREATOR = new JRPdfExporterParameter("Metadata Creator"); 135 136 137 /** 138 * Flag that decides whether the PDF exporter should use a {@link com.lowagie.text.SplitCharacter SplitCharacter} 139 * implementation which ensures that report texts are broken into lines by iText in the same manner as done by the 140 * fill process. 141 * <p> 142 * The default line-breaking logic differs from AWT (which is used during the report fill) to iText (used by the PDF 143 * exporter). By setting this flag, the logic used by AWT is imposed to iText. The drawback is that the PDF export 144 * performance would drop. Because of this, the flag is not set by default. 145 * <p> 146 * This flag can be set system-wide using the 147 * {@link net.sf.jasperreports.engine.util.JRProperties#PDF_FORCE_LINEBREAK_POLICY PDF_FORCE_LINEBREAK_POLICY} property. 148 * This export parameter overrides the property value. 149 * 150 * @see net.sf.jasperreports.engine.util.JRProperties#PDF_FORCE_LINEBREAK_POLICY 151 * @see net.sf.jasperreports.engine.util.BreakIteratorSplitCharacter 152 */ 153 public static final JRPdfExporterParameter FORCE_LINEBREAK_POLICY = new JRPdfExporterParameter("Force linebreak policy"); 154 155 156 /** 157 * Flag to force the rendering of SVG images using shapes, on the PDF Graphics2D context. 158 * 159 * This allows rendering fonts as shapes and avoid font mapping issues that might cause Unicode 160 * text not to show up properly, but has the disadvantage of producing larger PDF files. 161 * By default, the flag is set to true, mainly due to backward compatibility reasons. 162 * 163 * To reduce PDF file size for documents containing SVG images such as charts, the flag should be 164 * turned to false, and the PDF exporter font mappings should be correctly configured using the 165 * {@link JRExporterParameter#FONT_MAP FONT_MAP} exporter parameter to ensure proper rendering of 166 * text in the SVG. 167 * 168 * This flag can be set system-wide using the 169 * {@link net.sf.jasperreports.engine.export.JRPdfExporter#PDF_FORCE_SVG_SHAPES PDF_FORCE_SVG_SHAPES} property. 170 * This export parameter overrides the property value. 171 * 172 * @see net.sf.jasperreports.engine.export.JRPdfExporter#PDF_FORCE_SVG_SHAPES 173 * @see net.sf.jasperreports.engine.JRExporterParameter#FONT_MAP 174 */ 175 public static final JRPdfExporterParameter FORCE_SVG_SHAPES = new JRPdfExporterParameter("Force SVG Shapes"); 176 177 178 /** 179 * A {@link JRHyperlinkProducerFactory JRHyperlinkProducerFactory} which should be used for custom 180 * hyperlink types during export. 181 */ 182 public static final JRPdfExporterParameter HYPERLINK_PRODUCER_FACTORY = new JRPdfExporterParameter("Hyperlink producer factory"); 183 184 185 /** 186 * The user defined JavaScript piece of code to be inserted in the generated PDF document 187 */ 188 public static final JRPdfExporterParameter PDF_JAVASCRIPT = new JRPdfExporterParameter("PDF JavaScript"); 189 } 190