From 95287ea8d8dc32e0d492284b0003ccbc0c6a027b Mon Sep 17 00:00:00 2001
From: Jeremias Maerki
Logging is now a little different than it was in FOP 0.20.5. We've switched from
- Avalon Logging to Jakarta Commons Logging.
+ Avalon Logging to Jakarta Commons Logging.
While with Avalon Logging the loggers were directly given to FOP, FOP now retrieves
its logger(s) through a statically available LogFactory. This is similar to the
general pattern that you use when you work with Apache Log4J directly, for example.
@@ -187,10 +187,10 @@ try {
which documents what we're going to build.
- By default, Jakarta Commons Logging uses
+ By default, Jakarta Commons Logging uses
JDK logging (available in JDKs 1.4 or higher) as its backend. You can configure Commons
Logging to use an alternative backend, for example Log4J. Please consult the
- documentation for Jakarta Commons Logging on
+ documentation for Jakarta Commons Logging on
how to configure alternative backends.
+ After the Apache FOP 0.94 release, the image handling subsystem has been rewritten in
+ order to improve the range of supported images and image subtypes, to lower the
+ overall memory consumption when handling images, to produce smaller output files and to
+ increase the performance in certain areas. Of course, this causes a few changes most of
+ which the user will probably not notice. The most important changes are:
+
+ The actual image loading framework
+ no longer resides in Apache FOP, but was instead placed in
+ XML Graphics Commons.
+
- The table below summarizes the theoretical support for graphical formats within FOP. In other words, within the constraints of the limitations listed here, these formats should work. However, many of them have not been tested, and there may be limitations that have not yet been discovered or documented. The packages needed to support some formats are not included in the FOP distribution and must be installed separately. Follow the links in the "Support Thru" column for more details.
+ The table below summarizes the theoretical support for graphical formats
+ within FOP. In other words, within the constraints of the limitations listed here,
+ these formats should work. However, many of them have not been tested,
+ and there may be limitations that have not yet been discovered or documented.
+ The packages needed to support some formats are not included in the FOP distribution
+ and must be installed separately. Follow the links in the "Support Through" columns
+ for more details.
+ Legend:
+
+ Not all image formats are supported for all output formats! For example, while you can
+ use EPS (Encapsulated PostScript) files when you generate PostScript output, this format
+ will not be supported by any other output format. Here's an overview which image formats
+ are supported by which output format:
+
+ Legend:
+
- FOP has native ability to handle some graphic file formats.
+ XML Graphics Commons supports a number
+ graphic file formats natively as basic functionality: all bitmap formats for which there
+ are Image I/O codecs available (JPEG, PNG, GIF, TIFF, etc.), EPS and EMF.
- Apache XML Graphics Commons contains codecs for PNG and TIFF access. FOP can use these.
+ FOP has no native image plug-ins for the image loading framework of its own but currently
+ hosts the Batik-dependent SVG and WMF plug-ins until they can be moved to
+ Apache Batik.
- For JDKs 1.4 or higher, FOP provides a wrapper to load images through the
- JDK's Image I/O API (JSR 015).
- Image I/O allows to dynamically add additional image codecs. An example of such an add-on library are the
- JAI Image I/O Tools available from Sun.
+ Apache Batik will later receive the
+ SVG and WMF plug-ins for the image loading framework that are currently hosted inside
+ FOP.
- Because of licensing issues, the JIMI image library is not included in the FOP distribution. First, download and install it.
-Then, copy the file "JimiProClasses.zip" from the archive to {fop-install-dir}/lib/jimi-1.0.jar. Please note that FOP binary distributions are compiled with JIMI support, so there is no need for you to build FOP to add the support. If jimi-1.0.jar is installed in the right place, it will automatically be used by FOP, otherwise it will not.
+ Current FOP distributions include a distribution of the
+ Apache Batik.
+ Because Batik's API changes frequently, it is highly recommended that you use the
+ version that ships with FOP, at least when running FOP.
- FOP has been compiled with JAI support, but JAI is not included in the FOP distribution.
-To use it, install JAI, then copy the jai_core.jar and the jai_codec.jar files to {fop-install-dir}/lib.
-JAI is much faster than JIMI, but is not available for all platforms. See What platforms are supported? on the JAI FAQ page for more details.
+ Batik must be run in a graphical environment.
+ It uses AWT classes for rendering SVG, which in turn require an X server on Unixish
+ systems. If you run a server without X, or if you can't connect to the X server due to
+ security restrictions or policies (a so-called "headless" environment), SVG rendering
+ will fail.
Current FOP distributions include a distribution of the Apache Batik version 1.6.
-It is automatically installed with FOP.
-Because Batik's API changes frequently, it is highly recommended that you use the version that ships with FOP, at least when running FOP. Batik must be run in a graphical environment.
-It uses AWT classes for rendering SVG, which in turn require an X server on Unixish systems.
-If you run a server without X, or if you can't connect to the X server due to security restrictions or policies (a so-called "headless" environment), SVG rendering will fail. Here are some workarounds: FOP native support for BMP images is limited to the RGB color-space. FOP provides support for two output targets:
- Other output targets can't be supported at the moment because
- FOP lacks a PostScript interpreter. Furthermore, FOP is not able
- to parse the preview bitmaps sometimes contained in EPS files.
-
- FOP native support of JPEG does not include all variants, especially those containing
- unusual color lookup tables and color profiles.
- If you have trouble with a JPEG image in FOP, try opening it with an image processing
- program (such as Photoshop or Gimp) and then saving it. Specifying 24-bit color output
- may also help. For the PDF and PostScript renderers most JPEG images can be passed
- through without decompression. User reports indicate that grayscale, RGB, and
- CMYK color-spaces are all rendered properly.
-
- If using JAI for PNG support, only RGB and RGBA color-spaces are supported for
- FOP rendering.
-
- Transparency is supported but not guaranteed to work with every output format.
- FOP uses Apache Batik for SVG support.
-This format can be handled as an
+ BMP images are supported through an Image I/O codec. There may be limitations of the
+ codec which are outside the control of Apache FOP.
+
-The SVG is rendered into PDF by using PDF commands to draw and fill
-lines and curves. This means that the graphical objects created with
-this remain as vector graphics. The same applies to PostScript output.
-For other output formats the SVG graphic will be converted to a bitmap
-image.
+ Windows Enhanced Metafiles (EMF) are only supported in RTF output where they are
+ embedded without decoding.
Apache FOP allows to use EPS files when generating PostScript output only.
-There are a number of SVG things that cannot be converted directly into
-PDF. Parts of the graphic such as effects, patterns and images are inserted
-into the PDF as a raster graphic. The resolution of these raster images can
- be controlled through the "target resolution" setting in the
- configuration.
+
+
-
-
+ Format
- Type
- FOP native support
- Batik SVG
- Batik codecs
+ Format
+ Type
+ Support Through
+
+
Apache FOP (native)
+ Apache Batik
Image I/O
- JAI
- JIMI
+ BMP (Microsoft Windows Bitmap)
bitmap
- X
-
+ X [1]
+
+
EMF (Windows Enhanced Metafile)
+ vector (with embedded bitmaps)
+ (X)
EPS (Encapsulated PostScript)
- metafile (both bitmap and vector), probably most frequently used for vector drawings
+ metafile (both bitmap and vector), most frequently used for vector drawings
(X)
-
-
-
GIF (Graphics Interchange Format)
bitmap
- X
X
- X
- X
JPEG (Joint Photographic Experts Group)
bitmap
(X)
-
X
-
-
PNG (Portable Network Graphic)
@@ -85,9 +115,6 @@
X
- X
-
-
SVG (Scalable Vector Graphics)
@@ -95,271 +122,379 @@
X
-
-
-
TIFF (Tag Image Format File)
bitmap
(X)
- X
- X
- X
-
-
+ X [1]
-
EMF (Windows Enhanced Metafile)
+ WMF (Windows Metafile)
vector (with embedded bitmaps)
- (X)
-
-
-
+ (X)
+
+
+
+
+
+ Image Format
+ PDF
+ PostScript
+ Java2D, PNG, TIFF, AWT
+ PCL
+ AFP
+ RTF
+
+
+ BMP (Microsoft Windows Bitmap)
+ X
+ X
+ X
+ X
+ X
+ X
+
+
+ EMF (Windows Enhanced Metafile)
+
+
+
+
+
+ X [1]
+
+
+ EPS (Encapsulated PostScript)
+
+ X [1]
+
+
+
+
+
+
+ GIF (Graphics Interchange Format)
+ X
+ X
+ X
+ X
+ X
+ X
+
+
+ JPEG (Joint Photographic Experts Group)
+ X [1]
+ X [1]
+ X
+ X
+ X [1]
+ X
+
+
+ PNG (Portable Network Graphic)
+ X
+ X
+ X
+ X
+ X
+ X
+
+
+ SVG (Scalable Vector Graphics)
+ X
+ X
+ X
+ X
+ X
+ X
+
+
+ TIFF (Tag Image Format File)
+ X [2]
+ X [2]
+ X
+ X
+ X [2]
+ X
+
+
+ WMF (Windows Metafile)
+ X
+ X
+ X
+ X
+ X
+ X
+
+
+
-
-Djava.awt.headless=true
command line option.-Djava.awt.headless=true
+ command line option.
+
-
- fo:instream-foreign-object
or in a separate
-file referenced with fo:external-graphic
.
-Currently transparency is limited in PDF so many svg images that -contain effects or graphics with transparent areas may not be displayed -correctly. + GIF images are supported through an Image I/O codec. Transparency is supported but + not guaranteed to work with every output format.
If possible, Batik will use normal PDF or PostScript text when inserting text. It does -this by checking if the text can be drawn normally and the font is -supported. This example svg text.svg / -text.pdf -shows how various types and effects with text are handled. -Note that tspan and outlined text are not yet implemented.
+-Otherwise, text is converted and drawn as a set of shapes by Batik, using the stroking text painter. -This means that a typical character will -have about 10 curves (each curve consists of at least 20 characters). -This can make the output files large and when it is viewed the -viewer may not normally draw those fine curves very well (In Adobe Acrobat, turning on -"Smooth Line Art" in the preferences will fix this). -If the text is inserted into the output file using the inbuilt text commands -it will use a single character. + FOP native support (i.e. the handling of undecoded images) of JPEG does not include all + variants, especially those containing unusual color lookup tables and color profiles. + If you have trouble with a JPEG image in FOP, try opening it with an image processing + program (such as Photoshop or Gimp) and then saving it. Specifying 24-bit color output + may also help. For the PDF and PostScript renderers most JPEG images can be passed + through without decompression. User reports indicate that grayscale, RGB, and + CMYK color spaces are all rendered properly. However, for other output formats, the + JPEG images have to be decompressed. Tests have shown that there are some limitation + in some Image I/O codecs concerning images in the CMYK color space. Work-arounds are + in place but may not always work as expected.
+- Note that because SVG text can be rendered as either text or a vector graphic, you - may need to consider settings in your viewer for both. The Acrobat viewer has both - "smooth line art" and "smooth text" settings that may need to be set for SVG images - to be displayed nicely on your screen (see Edit / Preferences / Display). - This setting will not affect the printing of your document, which should be OK in - any case, but will only affect the quality of the screen display.
+ PNG images are supported through an Image I/O codec. Transparency is supported but + not guaranteed to work with every output format. +FOP uses Apache Batik for SVG support.
+ This format can be handled as an fo:instream-foreign-object
or in a separate
+ file referenced with fo:external-graphic
.
+ The SVG is rendered into PDF by using PDF commands to draw and fill + lines and curves. This means that the graphical objects created with + this remain as vector graphics. The same applies to PostScript output. + For other output formats the SVG graphic may be converted to a bitmap + image. +
++ There are a number of SVG things that cannot be converted directly into + PDF. Parts of the graphic such as effects, patterns and images are inserted + into the PDF as a raster graphic. The resolution of these raster images can + be controlled through the "target resolution" setting in the + configuration.
++ Currently transparency is limited in PDF so many SVG images that + contain effects or graphics with transparent areas may not be displayed + correctly. +
+If possible, Batik will use normal PDF or PostScript text when inserting text. It does + this by checking if the text can be drawn normally and the font is + supported. This example svg text.svg / + text.pdf + shows how various types and effects with text are handled. + Note that tspan and outlined text are not yet implemented.
++ Otherwise, text is converted and drawn as a set of shapes by Batik, using the + stroking text painter. This means that a typical character will + have about 10 curves (each curve consists of at least 20 characters). + This can make the output files large and when it is viewed the + viewer may not normally draw those fine curves very well (In Adobe Acrobat, turning on + "Smooth Line Art" in the preferences will fix this). Copy/paste functionality + will not be supported in this case. + If the text is inserted into the output file using the inbuilt text commands + it will use a single character. +
++ Note that because SVG text can be rendered as either text or a vector graphic, you + may need to consider settings in your viewer for both. The Acrobat viewer has both + "smooth line art" and "smooth text" settings that may need to be set for SVG images + to be displayed nicely on your screen (see Edit / Preferences / Display). + This setting will not affect the printing of your document, which should be OK in + any case, but will only affect the quality of the screen display.
++ Currently, SVG images are rendered with the dimensions specified in the SVG + file, within the viewport specified in the fo:external-graphic element. + For everything to work properly, the two should be equal. The SVG standard leaves + this issue as an implementation detail. Additional scaling options are available + through XSL-FO means. +
++ If you use pixels to specify the size of an SVG graphic the "source resolution" setting + in the configuration will be used to determine the + size of a pixel. The use of pixels to specify sizes is discouraged as they may + be interpreted differently in different environments. +
+- Currently, SVG images are rendered with the dimensions specified in the SVG - file, within the viewport specified in the fo:external-graphic element. - For everything to work properly, the two should be equal. The SVG standard leaves - this issue as an implementation detail. FOP will probably implement a scaling - mechanism in the future. + FOP can embed TIFF images without decompression into PDF, PostScript and AFP if they + have either CCITT T.4, CCITT T.6, or JPEG compression. Otherwise, a TIFF-capable + Image I/O codec is necessary for decoding the image.
- If you use pixels to specify the size of an SVG graphic the "source resolution" setting - in the configuration will be used to determine the - size of a pixel. The use of pixels to specify sizes is discouraged as they may - be interpreted differently in different environments. + There may be some limitation concerning images in the CMYK color space.
+ Windows Metafiles (WMF) are supported through classes in + Apache Batik. At the moment, support + for this format is experimental and may not always work as expected. +
- FOP-native TIFF support is limited to PDF and PostScript output only. Also, - according to user reports, FOP's native support for TIFF is limited to images with the - following characteristics (all must be true for successful rendering): -
-JAI: Supports RGB and RGBA only for FOP rendering.
-Windows Enhanced Metafiles (EMF) are only supported in RTF output.
-@@ -371,7 +506,8 @@ into a raster graphic are not drawn properly in PDF. The image is opaque.
Please note that not all images contain resolution information. If it's not available - 72 dpi is assumed (the default resolution of PDF and PostScript). + the source resolution set on the FopFactory (or through the user configuration XML) is used. + The default here is 72 dpi.
Bitmap images are generally embedded into the output format at their original resolution @@ -382,14 +518,23 @@ into a raster graphic are not drawn properly in PDF. The image is opaque. used as a work-around to resample images in FO documents.
+ Some image formats such as TIFF support multiple pages/sub-images per file. You can
+ select a particular page using a special URI fragment in the form:
+ <uri>#page=<nr>
+ (for example: http://localhost/images/myimage.tiff#page=3
)
+
FOP caches images between runs. There is one cache per FopFactory instance. The URI is used as a key to identify images which means that when a particular URI appears again, the image is taken from the cache. If you have a servlet that generates a different - image each time it is called with the same URL you need to use a constantly - changing dummy parameter on the URL to avoid caching. + image each time it is called with the same URI you need to use a constantly + changing dummy parameter on the URI to avoid caching.
The image cache has been improved considerably in the redesigned code. Therefore, a diff --git a/src/documentation/content/xdocs/trunk/running.xml b/src/documentation/content/xdocs/trunk/running.xml index a3d2dd0d2..38df4be82 100644 --- a/src/documentation/content/xdocs/trunk/running.xml +++ b/src/documentation/content/xdocs/trunk/running.xml @@ -28,21 +28,24 @@
The following software must be installed:
org.apache.commons.io.output.ByteArrayOutputStream