org.apache.fop.svg

Class PDFTranscoder

Implemented Interfaces:
Configurable

public class PDFTranscoder
extends AbstractFOPTranscoder
implements Configurable

This class enables to transcode an input to a pdf document.

Two transcoding hints (KEY_WIDTH and KEY_HEIGHT) can be used to respectively specify the image width and the image height. If only one of these keys is specified, the transcoder preserves the aspect ratio of the original image.

The KEY_BACKGROUND_COLOR defines the background color to use for opaque image formats, or the background color that may be used for image formats that support alpha channel.

The KEY_AOI represents the area of interest to paint in device space.

Three additional transcoding hints that act on the SVG processor can be specified:

KEY_LANGUAGE to set the default language to use (may be used by a <switch> SVG element for example), KEY_USER_STYLESHEET_URI to fix the URI of a user stylesheet, and KEY_PIXEL_TO_MM to specify the pixel to millimeter conversion factor.

KEY_AUTO_FONTS to disable the auto-detection of fonts installed in the system. The PDF Transcoder cannot use AWT's font subsystem and that's why the fonts have to be configured differently. By default, font auto-detection is enabled to match the behaviour of the other transcoders, but this may be associated with a price in the form of a small performance penalty. If font auto-detection is not desired, it can be disable using this key.

Version:
$Id: PDFTranscoder.java 611278 2008-01-11 19:50:53Z jeremias $
Author:
Keiron Liddle

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.fop.svg.AbstractFOPTranscoder

AbstractFOPTranscoder.FOPErrorHandler, AbstractFOPTranscoder.FOPTranscoderUserAgent

Field Summary

static TranscodingHints.Key
KEY_AUTO_FONTS
The key is used to specify whether the available fonts should be automatically detected.
static TranscodingHints.Key
KEY_DEVICE_RESOLUTION
The key is used to specify the resolution for on-the-fly images generated due to complex effects like gradients and filters.
protected PDFDocumentGraphics2D
graphics
Graphics2D instance that is used to paint to

Fields inherited from class org.apache.fop.svg.AbstractFOPTranscoder

KEY_STROKE_TEXT, VALUE_FORMAT_OFF, VALUE_FORMAT_ON, userAgent

Constructor Summary

PDFTranscoder()
Constructs a new PDFTranscoder.

Method Summary

void
configure(Configuration cfg)
protected BridgeContext
createBridgeContext()
BridgeContext
createBridgeContext(String version)
protected UserAgent
createUserAgent()
protected void
transcode(Document document, String uri, TranscoderOutput output)
Transcodes the specified Document as an image in the specified output.

Methods inherited from class org.apache.fop.svg.AbstractFOPTranscoder

createDocumentFactory, createUserAgent, getLogger, isTextStroked, setEntityResolver, setLogger

Field Details

KEY_AUTO_FONTS

public static final TranscodingHints.Key KEY_AUTO_FONTS
The key is used to specify whether the available fonts should be automatically detected. The alternative is to configure the transcoder manually using a configuration file.

KEY_DEVICE_RESOLUTION

public static final TranscodingHints.Key KEY_DEVICE_RESOLUTION
The key is used to specify the resolution for on-the-fly images generated due to complex effects like gradients and filters.

graphics

protected PDFDocumentGraphics2D graphics
Graphics2D instance that is used to paint to

Constructor Details

PDFTranscoder

public PDFTranscoder()
Constructs a new PDFTranscoder.

Method Details

configure

public void configure(Configuration cfg)
            throws ConfigurationException

createBridgeContext

protected BridgeContext createBridgeContext()

createBridgeContext

public BridgeContext createBridgeContext(String version)

createUserAgent

protected UserAgent createUserAgent()
Overrides:
createUserAgent in interface AbstractFOPTranscoder

transcode

protected void transcode(Document document,
                         String uri,
                         TranscoderOutput output)
            throws TranscoderException
Transcodes the specified Document as an image in the specified output.
Parameters:
document - the document to transcode
uri - the uri of the document or null if any
output - the ouput where to transcode

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.