
947
DEVELOPING
COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
Las
t
upda
te
d 8/5/2010
Using style profiles
The previous example uses the
StyledText
element to define inline text formatting. To define styles that you can
apply by reference, use the
StyleProfile
element. Style profiles let you apply a set of styles to different elements in
the PDF output file. The following code shows how to define a style profile for the table of contents
Header
:
<StyleProfile name="TOCheaderStyle">
<Header>
<Center>
<StyledText>
<p> color="red" font-weight="bold" font="Arial">Table of Contents</p>
</StyledText>
</Center>
</Header>
</StyleProfile>
To apply the style profile, specify the
StyleProfile
name by using the
styleReference
attribute of the
Header
element, as the following example shows:
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="Out1">
<PDF source="Title"/>
<TableOfContents>
<Header styleReference="TOCheaderStyle"/>
</TableOfContents>
<PDF source="Doc1"/>
<PDF source="Doc2"/>
<PDF source="Doc3"/>
<PDF source="Doc4"/>
</PDF>
<StyleProfile name="TOCheaderStyle">
<Header>
<Center>
<StyledText>
<p> color="red" font-weight="bold" font="Arial">Table of Contents</p>
</StyledText>
</Center>
</Header>
</StyleProfile>
</DDX>
Grouping PDF documents
To apply a style profile to a group of documents in the output PDF file, use the
PDFGroup
element. The following
example shows how to create a group of chapters in the output file and apply a style profile to the
Footer
element for
all of the documents in the group: