From 3251457d369d38ebc6aeb7a83e8922b03d7809af Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 16 Feb 2007 20:22:07 +0000 Subject: [PATCH] Attempted to improve/fix documentation on images. There was some out-dated and wrong information on the page. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@508559 13f79535-47bb-0310-9956-ffa450edef68 --- .../content/xdocs/trunk/graphics.xml | 180 ++++++++++++------ 1 file changed, 122 insertions(+), 58 deletions(-) diff --git a/src/documentation/content/xdocs/trunk/graphics.xml b/src/documentation/content/xdocs/trunk/graphics.xml index beb860223..fb0a393f3 100644 --- a/src/documentation/content/xdocs/trunk/graphics.xml +++ b/src/documentation/content/xdocs/trunk/graphics.xml @@ -75,7 +75,7 @@ (X) - + X @@ -85,7 +85,7 @@ X - + X @@ -105,11 +105,21 @@ (X) X - + X X + + EMF (Windows Enhanced Metafile) + vector (with embedded bitmaps) + (X) + + + + + + "(X)" means restricted support. Please see the details below. @@ -122,9 +132,9 @@

- Batik codecs + "Internal" codecs

- Apache Batik contains codecs for PNG and TIFF access. FOP can use these. + Apache XML Graphics Commons contains codecs for PNG and TIFF access. FOP can use these.

@@ -153,7 +163,7 @@ JAI is much faster than JIMI, but is not available for all platforms. See
- Batik + Apache Batik

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.

@@ -186,6 +196,11 @@ If you run a server without X, or if you can't connect to the X server due to se (including GhostScript) will render the EPS correctly. + + Please note that the EPS embedding feature has been deprecated in the + PDF specification version 1.4. You should not use this feature anymore, especially + since newer PDF tools don't support embedded EPS files anymore. +

Other output targets can't be supported at the moment because FOP lacks a PostScript interpreter. Furthermore, FOP is not able @@ -194,28 +209,37 @@ If you run a server without X, or if you can't connect to the X server due to se

JPEG -

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. +

+ 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.

PNG -

If using JAI for PNG support, only RGB and RGBA color-spaces are supported for FOP rendering.

+

+ 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. +

SVG
Introduction -

FOP uses Batik for SVG support. +

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.

Batik's SVG Rasterizer utility may also be used to convert standalone SVG documents into PDF. For more information please see the -SVG Rasterizer documentation +SVG Rasterizer documentation on the Batik site.
@@ -224,74 +248,89 @@ on the Batik site.

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. +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.

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 this graphic may not -be ideal depending on the FOP dpi (72dpi) and the scaling for that graphic. -We hope to improve this in the future.

+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 not supported in PDF so many svg images that -contain effects or graphics with transparent areas will not be displayed +Currently transparency is limited in PDF so many svg images that +contain effects or graphics with transparent areas may not be displayed correctly.

- Placing SVG Text into PDF -

If possible, Batik will use normal PDF text when inserting text. It does + Placing SVG Text into PDF and PostScript +

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. +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 pdf files large and when the pdf is viewed the -viewer does not normally draw those fine curves very well (turning on -Smooth Line Art in the Acrobat preferences will fix this). -If the text is inserted into the PDF using the inbuilt text commands -for PDF it will use a single character. +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.

-

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.

+

+ 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.

Scaling -

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.

+

+ 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. +

+

+ 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. +

Known Problems
TIFF -

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):

+

+ 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): +

+ + Native support in this case means that the images can be embedded into the output format + without decoding it. +

JAI: Supports RGB and RGBA only for FOP rendering.

+
+ EMF +

Windows Enhanced Metafiles (EMF) are only supported in RTF output.

+
Graphics Resolution -

Some bitmapped image file formats store a dots-per-inch (dpi) or other resolution value. Since PDF and most output formats do not have a concept of resolution, but only of absolute image units (i.e. pixels) FOP ignores the resolution values as well. Instead, FOP uses the dimensions of the image as specified in the fo:external-graphic element to render the image:

- -

If you need a higher apparent output resolution for bitmapped images, first make sure that at least one dimension of the image is defined in your XSL-FO input. Apart from that, resolution problems are in the image file itself, and must be corrected there: use or create a higher-resolution image file.

- The explanation above describes only the basic default behavior. There are other attributes of the fo:external-graphic element that can affect the behavior described above. +

+ Some bitmapped image file formats store a dots-per-inch (dpi) or other resolution + values. FOP tries to use this resolution information whenever possible to determine + the image's intrinsic size. This size is used during the layout process when it is not + superceeded by an explicit size on fo:external-graphic (content-width and content-height + properties). +

+

+ 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). +

+

+ Bitmap images are generally embedded into the output format at their original resolution + (as is). No resampling of the image is performed. Explicit resampling is on our wishlist, + but hasn't been implemented, yet. Bitmaps included in SVG graphics may be resampled to + the resolution specified in the "target resolution" setting in the + configuration if SVG filters are applied. This can be + used as a work-around to resample images in FO documents. +

Image caching

- FOP caches images between runs. The URL is used as a key to identify images which means that when - a particular URL 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 + 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.

- The image cache has been improved considerably in the redesigned code. Therefore, a resetCache() method - has become unnecessary. If you still experience OutOfMemoryErrors, please notify us. + The image cache has been improved considerably in the redesigned code. Therefore, a + resetCache() method like in earlier versions of FOP has become unnecessary. If you + still experience OutOfMemoryErrors, please notify us.

-- 2.39.5