Chapter 7. Graphics and Color

Graphics are mentioned briefly in Chapter 3 and Chapter 6 in the discussions of blocks and inlines. You will need to consult your formatter’s documentation to determine what graphics formats are viable. All the formatters I’ve used are happy with JPEG.

Color is one of the most generally applicable properties in the specification, which makes it somewhat harder to describe concisely. If you have a CSS background, you might already be familiar with its use on web pages. The coverage is just as broad as in CSS, and indeed many of the properties carry over directly from CSS. The specification of color is quite similar to that in CSS; colors can be specified by name or as Red-Green-Blue (RGB) color value numbers. However, XSL-FO includes additional, more sophisticated ways to specify colors.

While color can add value to presentation, it can also spoil it. It should support your message, not overwhelm it. Use it carefully and it will work well.

Graphics

The fo:external-graphic formatting object is always inline. If you want it to act like a block, you have to wrap it in a block.

The fo:instream-foreign-object is often used to include Scalable Vector Graphics (SVG) directly in the file, and it has all the same properties as an external-graphic.

fo:external-graphic provides the wrapper for graphics. Why external? Because the actual graphic’s file is external to the XML source document. If wrapped in a block or inline, the graphic is appropriately laid out by ...

Get XSL-FO now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.