001: /*
002: * ============================================================================
003: * GNU Lesser General Public License
004: * ============================================================================
005: *
006: * JasperReports - Free Java report-generating library.
007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * JasperSoft Corporation
024: * 303 Second Street, Suite 450 North
025: * San Francisco, CA 94107
026: * http://www.jaspersoft.com
027: */
028: package net.sf.jasperreports.engine.export;
029:
030: import net.sf.jasperreports.engine.JRExporterParameter;
031: import net.sf.jasperreports.engine.util.JRProperties;
032:
033: /**
034: * Contains parameters useful for export in PDF format.
035: * <p>
036: * The PDF exporter can send data to an output stream or a file on disk. The engine looks among the export parameters in
037: * order to find the selected output type in this order: OUTPUT_STREAM, OUTPUT_FILE, OUTPUT_FILE_NAME.
038: * <p>
039: *
040: * @author Teodor Danciu (teodord@users.sourceforge.net)
041: * @version $Id: JRPdfExporterParameter.java 1827 2007-08-24 13:54:20Z teodord $
042: */
043: public class JRPdfExporterParameter extends JRExporterParameter {
044:
045: public static Character PDF_VERSION_1_2 = new Character('2'); // Not using iText constants in order not to depend on the library version
046: public static Character PDF_VERSION_1_3 = new Character('3');
047: public static Character PDF_VERSION_1_4 = new Character('4');
048: public static Character PDF_VERSION_1_5 = new Character('5');
049: public static Character PDF_VERSION_1_6 = new Character('6');
050:
051: /**
052: *
053: */
054: protected JRPdfExporterParameter(String name) {
055: super (name);
056: }
057:
058: /**
059: * A boolean value specifying whether the PDF document should contain an outline section
060: */
061: public static final JRPdfExporterParameter IS_CREATING_BATCH_MODE_BOOKMARKS = new JRPdfExporterParameter(
062: "Is Creating Batch Mode Bookmarks");
063:
064: /**
065: * Property whose value is used as default state of the {@link #IS_CREATING_BATCH_MODE_BOOKMARKS IS_CREATING_BATCH_MODE_BOOKMARKS} export flag.
066: * <p/>
067: * This property is by default not set (<code>false</code>).
068: *
069: * @see JRProperties
070: */
071: public static final String PROPERTY_CREATE_BATCH_MODE_BOOKMARKS = JRProperties.PROPERTY_PREFIX
072: + "export.pdf.create.batch.mode.bookmarks";
073:
074: /**
075: * A boolean value specifying whether the PDF document should be compressed.
076: */
077: public static final JRPdfExporterParameter IS_COMPRESSED = new JRPdfExporterParameter(
078: "Is Compressed");
079:
080: /**
081: * Property whose value is used as default state of the {@link #IS_COMPRESSED IS_COMPRESSED} export flag.
082: * <p/>
083: * This property is by default not set (<code>false</code>).
084: *
085: * @see JRProperties
086: */
087: public static final String PROPERTY_COMPRESSED = JRProperties.PROPERTY_PREFIX
088: + "export.pdf.compressed";
089:
090: /**
091: * A boolean value specifying whether the final PDF document should be encrypted.
092: */
093: public static final JRPdfExporterParameter IS_ENCRYPTED = new JRPdfExporterParameter(
094: "Is Encrypted");
095:
096: /**
097: * Property whose value is used as default state of the {@link #IS_ENCRYPTED IS_ENCRYPTED} export flag.
098: * <p/>
099: * This property is by default not set (<code>false</code>).
100: *
101: * @see JRProperties
102: */
103: public static final String PROPERTY_ENCRYPTED = JRProperties.PROPERTY_PREFIX
104: + "export.pdf.encrypted";
105:
106: /**
107: * A boolean value specifying whether the encryption key is 128 bits.
108: */
109: public static final JRPdfExporterParameter IS_128_BIT_KEY = new JRPdfExporterParameter(
110: "Is 128 Bit Key");
111:
112: /**
113: * Property whose value is used as default state of the {@link #IS_128_BIT_KEY IS_128_BIT_KEY} export flag.
114: * <p/>
115: * This property is by default not set (<code>false</code>).
116: *
117: * @see JRProperties
118: */
119: public static final String PROPERTY_128_BIT_KEY = JRProperties.PROPERTY_PREFIX
120: + "export.pdf.128.bit.key";
121:
122: /**
123: * The user password needed to open the document, if it is encrypted.
124: */
125: public static final JRPdfExporterParameter USER_PASSWORD = new JRPdfExporterParameter(
126: "User Password");
127:
128: /**
129: * Property whose value is used as default for the {@link #USER_PASSWORD USER_PASSWORD} export parameter.
130: *
131: * @see JRProperties
132: */
133: public static final String PROPERTY_USER_PASSWORD = JRProperties.PROPERTY_PREFIX
134: + "export.pdf.user.password";
135:
136: /**
137: * The password belonging to the owner of the document, if it is encrypted. If the password is null, it will be replaced
138: * by a random string.
139: */
140: public static final JRPdfExporterParameter OWNER_PASSWORD = new JRPdfExporterParameter(
141: "Owner Password");
142:
143: /**
144: * Property whose value is used as default for the {@link #OWNER_PASSWORD OWNER_PASSWORD} export parameter.
145: *
146: * @see JRProperties
147: */
148: public static final String PROPERTY_OWNER_PASSWORD = JRProperties.PROPERTY_PREFIX
149: + "export.pdf.owner.password";
150:
151: /**
152: * An integer value representing the PDF permissions for the generated document. The open permissions for the document
153: * can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders,
154: * AllowAssembly and AllowDegradedPrinting (these can all be found in the PdfWriter class of iText library). The
155: * permissions can be combined by applying bitwise OR to them.
156: */
157: public static final JRPdfExporterParameter PERMISSIONS = new JRPdfExporterParameter(
158: "Permissions");
159:
160: /**
161: * A <tt>Character</tt> instance representing the version of the generated PDF. This class contains predefined constants
162: * that can be passed as parameters directly.
163: */
164: public static final JRPdfExporterParameter PDF_VERSION = new JRPdfExporterParameter(
165: "PDF Version");
166:
167: /**
168: * Property whose value is used as default for the {@link #PDF_VERSION PDF_VERSION} export parameter.
169: * Possible values of the this property are 2, 3, 4, 5 and 6.
170: *
171: * @see JRProperties
172: */
173: public static final String PROPERTY_PDF_VERSION = JRProperties.PROPERTY_PREFIX
174: + "export.pdf.version";
175:
176: /**
177: * The Title of the PDF document, as String.
178: */
179: public static final JRPdfExporterParameter METADATA_TITLE = new JRPdfExporterParameter(
180: "Metadata Title");
181:
182: /**
183: * The Author of the PDF document, as String.
184: */
185: public static final JRPdfExporterParameter METADATA_AUTHOR = new JRPdfExporterParameter(
186: "Metadata Author");
187:
188: /**
189: * The Subject of the PDF document, as String.
190: */
191: public static final JRPdfExporterParameter METADATA_SUBJECT = new JRPdfExporterParameter(
192: "Metadata Subject");
193:
194: /**
195: * The Keywords of the PDF document, as comma-separated String.
196: */
197: public static final JRPdfExporterParameter METADATA_KEYWORDS = new JRPdfExporterParameter(
198: "Metadata Keywords");
199:
200: /**
201: * The Creator or Application for the PDF document, as String, defaults to JasperReports.
202: */
203: public static final JRPdfExporterParameter METADATA_CREATOR = new JRPdfExporterParameter(
204: "Metadata Creator");
205:
206: /**
207: * Flag that decides whether the PDF exporter should use a {@link com.lowagie.text.SplitCharacter SplitCharacter}
208: * implementation which ensures that report texts are broken into lines by iText in the same manner as done by the
209: * fill process.
210: * <p>
211: * The default line-breaking logic differs from AWT (which is used during the report fill) to iText (used by the PDF
212: * exporter). By setting this flag, the logic used by AWT is imposed to iText. The drawback is that the PDF export
213: * performance would drop. Because of this, the flag is not set by default.
214: * <p>
215: * This flag can be set system-wide using the
216: * {@link #PROPERTY_FORCE_LINEBREAK_POLICY PROPERTY_FORCE_LINEBREAK_POLICY} property.
217: * This export parameter overrides the property value.
218: *
219: * @see #PROPERTY_FORCE_LINEBREAK_POLICY
220: * @see net.sf.jasperreports.engine.util.BreakIteratorSplitCharacter
221: */
222: public static final JRPdfExporterParameter FORCE_LINEBREAK_POLICY = new JRPdfExporterParameter(
223: "Force linebreak policy");
224:
225: /**
226: * Property that provides a default value for the {@link #FORCE_LINEBREAK_POLICY FORCE_LINEBREAK_POLICY}
227: * PDF exporter parameter.
228: *
229: * @see #FORCE_LINEBREAK_POLICY
230: */
231: public static final String PROPERTY_FORCE_LINEBREAK_POLICY = JRProperties.PROPERTY_PREFIX
232: + "export.pdf.force.linebreak.policy";
233:
234: /**
235: * Flag to force the rendering of SVG images using shapes, on the PDF Graphics2D context.
236: *
237: * This allows rendering fonts as shapes and avoid font mapping issues that might cause Unicode
238: * text not to show up properly, but has the disadvantage of producing larger PDF files.
239: * By default, the flag is set to true, mainly due to backward compatibility reasons.
240: *
241: * To reduce PDF file size for documents containing SVG images such as charts, the flag should be
242: * turned to false, and the PDF exporter font mappings should be correctly configured using the
243: * {@link JRExporterParameter#FONT_MAP FONT_MAP} exporter parameter to ensure proper rendering of
244: * text in the SVG.
245: *
246: * This flag can be set system-wide using the {@link #PROPERTY_FORCE_SVG_SHAPES PROPERTY_FORCE_SVG_SHAPES}
247: * property. This export parameter overrides the property value.
248: *
249: * @see #PROPERTY_FORCE_SVG_SHAPES
250: * @see net.sf.jasperreports.engine.JRExporterParameter#FONT_MAP
251: */
252: public static final JRPdfExporterParameter FORCE_SVG_SHAPES = new JRPdfExporterParameter(
253: "Force SVG Shapes");
254:
255: /**
256: * Property that provides a default value for the {@link #FORCE_SVG_SHAPES FORCE_SVG_SHAPES}
257: * PDF exporter parameter.
258: */
259: public static final String PROPERTY_FORCE_SVG_SHAPES = JRProperties.PROPERTY_PREFIX
260: + "export.pdf.force.svg.shapes";
261:
262: /**
263: * The user defined JavaScript piece of code to be inserted in the generated PDF document
264: */
265: public static final JRPdfExporterParameter PDF_JAVASCRIPT = new JRPdfExporterParameter(
266: "PDF JavaScript");
267:
268: /**
269: * Property whose value is used as default for the {@link #PDF_JAVASCRIPT PDF_JAVASCRIPT} export parameter.
270: *
271: * @see JRProperties
272: */
273: public static final String PROPERTY_PDF_JAVASCRIPT = JRProperties.PROPERTY_PREFIX
274: + "export.pdf.javascript";
275:
276: }
|