What Is "external-graphic" Formatting Object?

This section describes 'external-graphic' formatting object, which generates an inline area from an image specified as an external source.

What Is an "external-graphic" Formatting Object? "external-graphic" is an inline-level formatting object that takes an image from an external source to generate an inline area.

An "external-graphic" formatting object takes no content and supports the following main attributes:

Here is my tutorial example, external-graphic-Formatting-Object.fo, that shows an "external-graphic" formatting object inserting a PNG image into an inline stack:

<?xml version="1.0" encoding="utf-8"?>
<!-- external-graphic-Formatting-Object.fo
 - Copyright (c) 2016, HerongYang.com, All Rights Reserved.
-->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
 <fo:layout-master-set>
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="4in" page-width="3.5in">
   <fo:region-body region-name="body" background-color="#eeeeee"/>
  </fo:simple-page-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body">
   <fo:block margin="0.1in" padding="0.2in" 
    border-width="1px" border-style="solid"
    background-color="#eeffff" color="#000000" 
    text-align="justify" font-family="sans-serif">
The tangram (Chinese: 七巧板; pinyin: qiqiaoban; 
literally: "seven boards of skill") 
    <fo:external-graphic src="Tangram.png"
     alignment-baseline="middle" 
     margin="2pt" padding="2pt" background-color="#ff88ff"
     border-width="1px" border-style="solid"/>
is a dissection 
puzzle consisting of seven flat shapes, called tans, 
which are put together to form shapes.
   </fo:block>
  </fo:flow>
 </fo:page-sequence>
</fo:root>

If you process this example XSL-FO document with Apache FOP tool on the AWT window, you should see a tangram picture aligned in the middle of the line:

"external-graphic" Formatting Object

Last update: 2016.

Table of Contents

 About This XSL-FO Tutorial Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

 Block-Level Formatting Objects

 Inline-Level Formatting Objects

Including Graphics in XSL-FO document

What Is "external-graphic" Formatting Object?

 Control DPI with "content-width" and "content-height"

 Fixed Higher DPI with "scale-to-fit"

 Resolution Included in Image Files

 Image Over and Under Flow Area

 "external-graphic" with SVG Diagram

 "instream-foreign-object" Formatting Object

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations

 References

 PDF Printing Version