001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either 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, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: *
022: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023: * in the United States and other countries.]
024: *
025: * ------------
026: * PdfOutputProcessorMetaData.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.modules.output.pageable.pdf.internal;
030:
031: import org.jfree.fonts.FontMappingUtility;
032: import org.jfree.fonts.itext.ITextFontStorage;
033: import org.jfree.report.layout.output.AbstractOutputProcessorMetaData;
034: import org.jfree.report.layout.output.OutputProcessorFeature;
035: import org.jfree.util.Configuration;
036: import org.jfree.util.ExtendedConfiguration;
037: import org.jfree.util.ExtendedConfigurationWrapper;
038:
039: /**
040: * Creation-Date: 12.05.2007, 20:16:18
041: *
042: * @author Thomas Morgner
043: */
044: public class PdfOutputProcessorMetaData extends
045: AbstractOutputProcessorMetaData {
046: public PdfOutputProcessorMetaData(
047: final Configuration configuration,
048: final ITextFontStorage fontStorage) {
049: super (configuration, fontStorage);
050: setFamilyMapping(null, "Helvetica");
051: addFeature(OutputProcessorFeature.FAST_FONTRENDERING);
052: addFeature(OutputProcessorFeature.BACKGROUND_IMAGE);
053: addFeature(OutputProcessorFeature.PAGE_SECTIONS);
054: addFeature(OutputProcessorFeature.SPACING_SUPPORTED);
055: addFeature(OutputProcessorFeature.PAGEBREAKS);
056:
057: if ("true"
058: .equals(configuration
059: .getConfigProperty("org.jfree.report.modules.output.pageable.pdf.WatermarkPrinted"))) {
060: addFeature(OutputProcessorFeature.WATERMARK_SECTION);
061: }
062: if ("true"
063: .equals(configuration
064: .getConfigProperty("org.jfree.report.modules.output.pageable.pdf.EmbedFonts"))) {
065: addFeature(OutputProcessorFeature.EMBED_ALL_FONTS);
066: }
067:
068: final ExtendedConfiguration extendedConfig = new ExtendedConfigurationWrapper(
069: configuration);
070: final double deviceResolution = extendedConfig
071: .getIntProperty(
072: "org.jfree.report.modules.output.pageable.pdf.DeviceResolution",
073: 0);
074: if (deviceResolution > 0) {
075: setNumericFeatureValue(
076: OutputProcessorFeature.DEVICE_RESOLUTION,
077: deviceResolution);
078: }
079: }
080:
081: public String getNormalizedFontFamilyName(final String name) {
082: final String mappedName = super
083: .getNormalizedFontFamilyName(name);
084: if (FontMappingUtility.isSerif(mappedName)) {
085: return "Times";
086: }
087: if (FontMappingUtility.isSansSerif(mappedName)) {
088: return "Helvetica";
089: }
090: if (FontMappingUtility.isCourier(mappedName)) {
091: return "Courier";
092: }
093: if (FontMappingUtility.isSymbol(mappedName)) {
094: return "Symbol";
095: }
096: return mappedName;
097: }
098:
099: public String getExportDescriptor() {
100: return "pageable/pdf";
101: }
102:
103: public ITextFontStorage getITextFontStorage() {
104: return (ITextFontStorage) getFontStorage();
105: }
106: }
|