Exporting to PDF
The page describes the default mechanism for converting PSML documents to PDF and how to customize the formatting.
Overview
XSL Formatting Objects (FO) is a companion standard to XML and XSLT. Its main design objectives are to provide developers with a standards-based language that can process raw XML data into visually rich output. With XSL FO, getting richly formatted pages from native XML is a relatively straightforward pipeline compared to using a proprietary typesetting solution or the transformation from XML into a more format-oriented syntax, such as TeX.
By comparison, particularly for developers with XSLT experience, FO is a familiar, standards-based syntax supported by both open source and commercial implementations. To leverage the benefits of FO, PageSeeder comes pre-configured with Apache’s FOP processor—a respected, open source FO processor. This capability enables PageSeeder to blindly export any PSML document as a PDF file.
The only problem with document formats being expressed in a programming language, is that developers are often not the best people to modify the formats. For this reason, the FO implementation in PageSeeder is accompanied by a simplified language, FOConfig, that gives non-programmers some control over the page layout and liberates developers from being responsible for all changes.
The technical experience required to modify FOConfig is much closer to working with Cascading Style Sheets (CSS) or a desktop publishing app.
Architecture
To generate a PDF document, the process uses the following components:
- The
pdf-export-config.xml
file that defines the formatting values of the output. - A processor to generate XSL-FO code from the
pdf-export-config.xml
file and the PSML content. - The publish engine passes the generated code to Apache FOP which returns the documents as PDF.
Structure
The pdf-export-config.xml
contains a list of rules in the following structure. The default rules are under the <styles>
element with no @label
. These can be overridden for PSML documents with specific document labels. This allows a publication consisting of multiple PSML documents to have different formatting rules for its different parts, depending on document labels (for example, titlepage
, frontmatter
, appendix
). Using multiple <styles> elements requires pso-pdf v0.4.0 or higher (included in PageSeeder v5.98 or higher). Previous versions require <styles> with no @label to be the root element.
<config> [<styles label="[document label]"> [rules that override default for documents with this label] </styles>] ... <styles> [default rules] </styles> ... </config>
The rule elements allowed inside <styles>
include the following:
<page>
– an element to contain the<property>
elements that describe the page layout.- Region elements – a collection of predefined layout objects such as
<header>
,<footer>
and<body>
. - Block elements – formatting objects that correspond to the elements defined in PSML, including
<heading>
, lists and more. - Inline – these format the content contained by inline labels in PSML.
- Special – various specialized elements.
Attached to each element can be multiple name / value pairs categorized as <property>
or <region-property>
elements. To make config straightforward to learn and useful elsewhere, wherever possible, names and values are the same as XSL-FO.
Also supported are the following shorthand attributes which correspond to longer values:
background
,background-position
,border
,border-bottom
,border-color
,border-left
,border-right
,border-style
,border-spacing
,border-top
,border-width
,font
,margin
,padding
,page-break-after
,page-break-before
,page-break-inside
,pause
,position
,vertical-align
,white-space
By default, PageSeeder uses the FOP 2.3 formatting engine. For more details about which properties are supported, see Apache FOP Compliance Page .
For a copy of the default file, see pdf-export-config.
<page>
element
Used to define the page properties, it corresponds to the XSL-FO simple-page-master element. Supported properties are:
page-width
(defines the width of a page)page-height
(defines the height of a page)margin-top
margin-bottom
margin-left
margin-right
space-before
space-after
start-indent
end-indent
reference-orientation
FOConfig:
<page> <property name="page-height" value="29.7cm"/> <property name="page-width" value="21cm"/> <property name="margin-top" value="2cm"/> <property name="margin-bottom" value="2cm"/> <property name="margin-left" value="2cm"/> <property name="margin-right" value="2cm"/> </page>
PDF:
The distance between the top of the page and the top of the header.
<page><property name="margin-top" value="2cm"/>
The distance between the right side of the page and the right boundary of the body text.
<page><property name="margin-right" value="2cm"/>
The distance between the bottom of the header and the top of the body text.
<body><region-property name="margin-top" value="1cm"/>
The distance between the left side of the page and the left boundary of the body text.
<page><property name="margin-left" value="2cm"/>
The full height of the page.
<page><property name="page-height" value="29.7cm"/>
The full width of the page.
<page><property name="page-width" value="21cm"/>
The distance between the bottom of the body text and the top of the footer.
<body><region-property name="margin-bottom" value="2cm"/>
The distance between the bottom of the footer and the bottom of the page.
<page><property name="margin-bottom" value="2cm"/>
Region elements
These are the components that equate to what are often called master pages in conventional desktop apps.
<body>
Used to define the area that contains the document content. On these elements, it is valid to use a property that corresponds to the XSL FO <region-body>
element.
On the <body>
element, it is valid to use either or both a normal <property>
and a <region-property>
. In addition to the common values (except @extent
), the following are valid attributes on a <region-property>
:
@margin-top
@margin-bottom
@margin-left
@margin-right
@space-before
@space-after
@start-indent
@end-indent
@column-count
@column-gap
Also supported on <property>
are the attribute values
that correspond to a nested XSL FO <block>
element.
Example:
<body> <region-property name="margin-top" value="1cm"/> <region-property name="margin-bottom" value="2cm"/> <property name="font-family" value="Times Roman"/> </body>
<header>
and <footer>
Used to define the page headers and footers and correspond to the XSL FO <region-before>
and <region-after>
elements.
Two types of property elements are allowed in a <body>
element: normal <property>
and <region-property>
.
In addition to the common supported attributes, except @extent
, the @precedence
attribute is supported on <region-property>.
Property values for a block are supported as normal and correspond to a nested XSL FO <block>
element.
Configuring different headers and footers for first page and even/odd pages are defined by the attributes @first
(allowed values are true
and false
) and @odd-or-even
(allowed values are odd
and even
).
Headers and footers are composed of three customizable regions, represented by the following elements:
<left>
<center>
<right>
Each of these elements can have a @width
attribute and can contain elements which translate to specific fields. Allowed elements are:
<property>
(any block property)<text>
<image>
(attribute@src
is used to define the location of the graphic)<date>
(attribute@pattern
can be used to define the output, see below)<page-number>
<total-pages>
<filename>
<label>
(attribute@name
is used to specify the inline label, see below)
The <label>
element is how to support dynamic headings/footers. Where specified in the FOConfig, in the PDF output, the <label>
element is replaced by the value of the content from the PSML inline label of the same name. For example, if the document content was something like the following:
text <inline name="CompanyName">General Motors</inline> text
Config:
<header first="true"> <center width="500px"> <label name="CompanyName" /> </center> </header> <header> <property name="extent" value="1cm"/> <property name="line-height" value="12pt"/> <property name="font-size" value="10pt"/> <property name="border-bottom-style" value="solid"/> <property name="border-bottom-width" value="0.2mm"/> <left> <filename/> <left> <right width="250px"> <date pattern="[D1o] [MNn], [Y]" /> </right> </header> <footer> <property name="extent" value="1cm" /> <property name="font-size" value="10pt"/> <center> <text>Page </text> <page-number/> <text> of </text> <total-pages/> </center> </footer>
Until an instance of this inline label occurs, that value in the header remains empty, however, each time the value changes in the content, it is reflected in the next new page of the PDF output.
PDF:
The first page has a specific header which only contains text in its center. The content is taken from the first <inline>
with @label="CompanyName"
.
<header first="true"><center width="500px"><label name="CompanyName" />
Can specify Odd or Even within <header>
element. If not specified, both odd and even pages contain the same data. This left field contains the filename.
<header><left><filename/><left>
In this case is blank.
<header><center/>
The right header field contains the date and its width is 250px.
<header><left width="250px"><date pattern="[D1o] [MNn], [Y]" /></left>
The border is specified as below the header line, as a solid line of 0.2mm width.
<header><property name="border-bottom-style" value="solid"/> <header><property name="border-bottom-width" value="0.2mm"/>
The footer is specified centered text containing the page number and total pages.
<footer> <center> <text>Page </text> <page-number/> <text> of </text> <total-pages/> </center>
<left>
and <right>
Used to define left and right marginalia and correspond to the XSL FO region-start and region-end elements.
There are two types of properties allowed: region properties and normal properties.
All Common Region Properties are supported.
All Block Properties are supported as normal properties and correspond to a nested XSL FO block element.
These elements work the same as the <header>
and <footer>
elements. The main difference is that their content is defined using the three following elements:
<top>
<middle>
<bottom>
These elements work the same as the children elements of the header/footer elements (<left>
, <center>
and <right>
).
Example:
<right first="true"> <region-property name="extent" value="60px" /> <property name="font-size" value="10pt"/> <top> <property name="border-left-style" value="solid"/> <property name="border-left-width" value="1mm"/> <text>top</text> </top> <middle height="100px"> <text>middle</text> </middle> <bottom> <property name="border-left-style" value="solid"/> <property name="border-left-width" value="1mm"/> <text>bottom</text> </bottom> </right>
Common region properties
Following are the region properties supported by all the above region elements.
- Common border, padding, and background properties:
background-color
,background-image
,background-repeat
,background-position-horizontal
,background-position-vertical
,border-before-color
,border-before-style
,border-before-width, border-after-color, border-after-style, border-after-width, border-start-color, border-start-style, border-start-width, border-end-color, border-end-style, border-end-width, border-top-color, border-top-style, border-top-width, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width, padding-before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding-right
. - Other:
display-align, extent, overflow, reference-orientation, writing-mode
.
Block elements
Block elements are all defined by the attribute name on the tag element. The styling of the following block elements can be defined:
<blockxref>
<code>
<section-title>
<toc> (table of contents)
<cell>
<hcell>
<heading>
<heading-prefix>
<para>
<para-prefix>
<list>
<nlist>
<list-item>
Block properties
- Common border, padding, and background properties:
background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical, border-before-color, border-before-style, border-before-width, border-after-color, border-after-style, border-after-width, border-start-color, border-start-style, border-start-width, border-end-color, border-end-style, border-end-width, border-top-color, border-top-style, border-top-width, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width, padding-before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding-right
. - Common font properties:
font-family, font-size, font-stretch, font-size-adjust, font-style, font-variant, font-weight
. - Common hyphenation properties:
country, language, hyphenate, hyphenation-character, hyphenation-push-character-count, hyphenation-remain-character-count
. - Common margin properties - block:
margin-top, margin-bottom, margin-left, margin-right, space-before, space-after, start-indent, end-indent
. - Other:
break-after, break-before, color, hyphenation-ladder-count, keep-together, keep-with-next, keep-with-previous, last-line-end-indent, linefeed-treatment, line-height, line-height-shift-adjustment, line-stacking-strategy, orphans, white-space-treatment, text-align, text-align-last, text-indent, white-space-collapse, widows, wrap-option
. - Specific: The
width
property can be used for<para>
and<heading>
to adjust the width when they have@prefix
and it usesstart-indent
other than0
as they won’t have the correct page width. Usingwidth
requires pso-pdf v0.4.6 or higher (included in PageSeeder v5.98 or higher).
The @level
is allowed on <element name="heading">
and <element name="para">
. It corresponds to the level of the heading and the indent of the para. In the example below, headings with level 1 would be 20pt
, paras with indent 1 would be indented 1cm
and paras with indent 2 would be indented 2cm
. Otherwise, indented paras inherit the properties from the <element name="para">
with no @level
. Use of @level
requires pso-pdf v0.4.0 or higher (included in PageSeeder v5.98 or higher). In earlier versions <element name="heading1">
must be used but from v0.4.0 @level
must always be specified for heading.
Example:
<element name="heading" level="1"> <property name="font-weight" value="bold"/> <property name="font-size" value="20pt"/> <property name="space-before.optimum" value="12pt"/> <property name="space-after.optimum" value="12pt"/> <property name="width" value="19cm"/> </element> <element name="para"> <property name="margin-top" value="0pt"/> <property name="margin-bottom" value="18pt"/> <property name="text-align" value="justify"/> <property name="hyphenate" value="false"/> <property name="orphans" value="3"/> <property name="widows" value="2"/> </element> <element name="para" level="1"> <property name="start-indent" value="1cm"/> <property name="width" value="18cm"/> </element> <element name="para" level="2"> <property name="start-indent" value="2cm"/> </element>
Document title is no longer supported, but section/title
(not shown) is.
<element name="section-title" /> ... </element>
Heading level 1, “Overview”
<element name="heading" level="1"> ... </element>
A paragraph, “This file...”
<element name="para"> ... </element>
Heading level 2, “Page”
<element name="heading" level="2"> ... </element>
An unordered list with three items
<element name="list"> ... </element> <element name="list-item"> ... </element>
A container for code text
<element name="code"> ... </element>
Inline elements
Inline elements are all defined by the attribute name on the tag element. The styling of the following inline elements can be defined:
<bold>
<graphic>
<inlineLabel>
<italic>
<link>
<monospace>
<sub>
<sup>
<underline>
<xref>
Inline properties
- Common border, padding, and background properties:
background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical, border-before-color, border-before-style, border-before-width, border-after-color, border-after-style, border-after-width, border-start-color, border-start-style, border-start-width, border-end-color, border-end-style, border-end-width, border-top-color, border-top-style, border-top-width, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width, padding-before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding-right
. - Common font properties:
font-family, font-size, font-stretch, font-size-adjust, font-style, font-variant, font-weight
. - Other:
alignment-adjust, alignment-baseline, baseline-shift, block-progression-dimension, dominant-baseline, height, inline-progression-dimension, line-height, text-decoration, width, color, keep-together, keep-with-next, keep-with-previous, wrap-option.
Role attribute
The @role
is supported on the following element
/@name
values: preformat, list, last-label, nlist, nlist-label, link, xref, blockxref, table, table-col, table-row, table-cell, table-hcell, cell, hcell
. It allows formatting to be customized for the corresponding PSML element with the same @role
value (or in the case of <xref>
and <blockxref>
a matching @config
value). Requires pso-pdf v0.4.5 or higher (included in PageSeeder v5.98 or higher).
For example, the following config:
<element name="preformat" role="lang-java"> <property name="color" value="red"/> </element> <element name="xref" role="endnote"> <property name="font-size" value="6pt"/> <property name="vertical-align" value="super"/> </element>
Would apply the formatting specified to the following PSML elements:
<preformat role="lang-java"> int i = 10; </preformat> <xref href="#123-2" config="endnote" ...>2</xref>
The difference between table-cell, table-hcell
and cell, hcell
is that the former applies properties to the <fo:table-cell>
while the latter applies them to the <fo:block>
inside it.
Special elements
heading-prefix
Used to format PSML @prefix
on <heading>
as a hanging indent. The start-indent
property defines the left edge of the prefix relative to the page margin and text-indent
defines the indent of the heading text relative to that left edge. All other properties for the prefix are inherited from the heading with the same @level
but can be overridden. The default for text-align
is right
unless it has been defined for the heading. Requires pso-pdf v0.4.0 or higher (included in PageSeeder v5.98 or higher).
Examples:
<element name="heading-prefix" level="1"> <property name="start-indent" value="-2cm"/> <property name="text-indent" value="2cm"/> <property name="margin-right" value="0.1cm"/> <property name="color" value="#0077ee"/> </element> <element name="heading-prefix" level="2"> <property name="start-indent" value="-2cm"/> <property name="text-indent" value="2cm"/> <property name="margin-right" value="0.1cm"/> <property name="color" value="#0077ee"/> </element>
para-prefix
Used to format PSML @prefix
on <para>
as a hanging indent. The start-indent
property defines the left edge of the prefix relative to the page margin and text-indent
defines the indent of the paragraph text relative to that left edge. All other properties for the prefix are inherited from the <element name="para">
with no @level
but can be overridden. The default for text-align
is justify
unless it has been defined for para. Requires pso-pdf v0.4.0 or higher (included in PageSeeder v5.98 or higher).
Examples:
<element name="para-prefix" level="1"> <property name="start-indent" value="-2cm"/> <property name="text-indent" value="3cm"/> <property name="margin-right" value="0.1cm"/> <property name="text-align" value="right"/> </element> <element name="para-prefix" level="2"> <property name="start-indent" value="-2cm"/> <property name="text-indent" value="4cm"/> <property name="margin-right" value="0.1cm"/> <property name="text-align" value="right"/> </element>
In pso-pdf v1.0.3 or higher <element name="para-prefix">
(with no @indent
) can be used to format PSML <para>
with @prefix
but no @indent
. For example:
<element name="para-prefix"> <property name="start-indent" value="-2cm"/> <property name="text-indent" value="2cm"/> </element>
list-label, nlist-label
Used to define bullet and numbering types for lists at different levels. Any FO block properties are allowed, plus ps-type
which can have the following values:
list-label
:none
,disc
,circle
,square
or any custom characters.nlist-label
:arabic
,loweralpha
,lowerroman
,upperalpha
,upperroman
.
Any configured ps-type
value is overridden by @type
in the PSML. Requires pso-pdf v0.4.6 or higher (included in PageSeeder v5.98 or higher).
Examples:
<element name="list-label" level="2"> <property name="ps-type" value="circle"/> </element> <element name="list-label" level="3"> <property name="ps-type" value="square"/> </element> <element name="list-label" level="4"> <property name="color" value="red"/> <property name="margin-top" value="-1pt" /> <property name="font-size" value="12pt" /> <property name="font-family" value="ZapfDingbats" /> <property name="ps-type" value="➢"/> <!-- Three-D Top-Lighted Rightwards Arrowhead --> </element> <element name="nlist-label" level="1"> <property name="color" value="green"/> <property name="ps-type" value="loweralpha"/> </element> <element name="nlist-label" level="2"> <property name="color" value="green"/> <property name="ps-type" value="lowerroman"/> </element> <element name="nlist-label" level="3"> <property name="color" value="green"/> <property name="ps-type" value="upperalpha"/> </element>
table-cell, table-hcell
Used to define table cells. A table-cell
with a @role
attribute specializes <cell>
and <hcell>
elements that have the same @role
attribute.
Examples:
<element name="table-hcell"> <property name="background-color" value="#1f4f76"/> </element> <element name="table-cell"> <property name="background-color" value="#e7f1ff"/> </element> <element name="table-cell" role="warning"> <property name="background-color" value="red"/> </element> <element name="cell" role="warning"> <property name="font-size" value="10pt"/> </element>
The following properties are supported:
- Common border, padding, and background properties:
background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical, border-before-color, border-before-style, border-before-width, border-after-color, border-after-style, border-after-width, border-start-color, border-start-style, border-start-width, border-end-color, border-end-style, border-end-width, border-top-color, border-top-style, border-top-width, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width, padding-before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding-right
. - Other:
block-progression-dimension, inline-progression-dimension, height, width
.
table-row
Used to define table rows. A table-row
with a @role
attribute specializes <row>
elements that have the same @role
attribute.
Examples:
<element name="table-row"> <property name="background-color" value="#1f4f76"/> </element> <element name="table-row" role="warning"> <property name="background-color" value="red"/> </element>
The following properties are supported:
- Common border, padding, and background properties:
background-attachment, background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical
. - Other:
border-after-precedence, border-before-precedence, border-end-precedence, border-start-precedence, break-after, break-before, height, keep-together, keep-with-next, keep-with-previous, visibility
.
table-col
Used to define table columns. A table-col
with a @role
attribute specializes <col>
elements that have the same @role
attribute.
Examples:
<element name="table-col"> <property name="background-color" value="#1f4f76"/> </element> <element name="table-col" role="warning"> <property name="background-color" value="red"/> </element>
The following properties are supported:
- Common border, padding, and background properties:
background-attachment, background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical
. - Other:
border-after-precedence, border-before-precedence, border-end-precedence, border-start-precedence, visibility
.
table-caption
Used to define table caption properties. It can have a @role
attribute which adds specific properties to <table>
elements that have the same @role
attribute. Requires pso-pdf v1.0.3 or higher (included in PageSeeder v6.0008 or higher).
Examples:
<element name="table-caption"> <property name="color" value="red"/> <property name="text-align" value="center" /> </element> <element name="table-caption" role="special"> <property name="ps-hide" value="true"/> </element>
Any of the FO block properties can be used.
The special PageSeeder property ps-hide=true
stops the caption from appearing.
table
Used to define table level properties. It can have a @role
attribute which adds specific properties to <table>
elements that have the same @role
attribute.
Examples:
<element name="table"> <property name="space-before.optimum" value="12pt"/> <property name="space-after.optimum" value="12pt"/> </element <element name="table" role="warning"> <property name="border-color" value="red"/> </element>
In addition to the table-cell properties above, the following properties are also supported:
- Common Margin Properties - Block –
margin-top, margin-bottom, margin-left, margin-right, space-before, space-after, start-indent, end-indent
. - Other –
border-collapse, border-separation, break-after, break-before, keep-together, keep-with-next, keep-with-previous, table-omit-footer-at-break, table-omit-header-at-break
.
property
Used to define the table rows for displaying PSML <property>
.
Examples:
<element name="property"> <property name="height" value="1.4cm"/> </element> <element name="property"> <property name="background-color" value="red"/> </element>
Supports the same properties as table-row.
property-title-cell, property-value-cell
Used to define the table cells for displaying PSML <property>
title and value.
Examples:
<element name="property-title-cell"> <property name="background-color" value="purple"/> </element> <element name="property-value-cell"> <property name="background-color" value="yellow"/> </element>
Supports the same properties as table-cell.
property-title, property-value
Used to define the blocks for displaying PSML <property>
title and value.
Examples:
<element name="property-title"> <property name="color" value="pink"/> </element> <element name="property-value"> <property name="color" value="black"/> </element>
Supports any block properties.
Block label
Used to define custom block content label.
Default properties are as follows:
<element name="block"> <property name="space-before.optimum" value="4pt"/> <property name="space-after.optimum" value="8pt"/> <property name="text-align" value="justify"/> <property name="hyphenate" value="false"/> <property name="border-top-style" value="dotted"/> <property name="border-bottom-style" value="dotted"/> <property name="border-left-style" value="solid"/> <property name="border-right-style" value="solid"/> <property name="border-width" value="0.2mm"/> <property name="border-color" value="#79bbe1"/> <property name="padding" value="4px"/> </element> <element name="blockName"> <property name="text-align" value="justify"/> <property name="hyphenate" value="false"/> <property name="color" value="#79bbe1"/> <property name="font-weight" value="bold"/> </element>
For each custom block label, new properties can be specified to overwrite the default properties in FOConfig.xml
. Create a new element name ="block-[customname]"
and blockName-[customname]
accordingly with the wanted property.
Example:
<element name="block-warning"> <property name="color" value="red"/> <property name="border-top-style" value=""/> <property name="border-bottom-style" value=""/> <property name="border-left-style" value=""/> <property name="border-right-style" value=""/> <property name="border-width" value=""/> <property name="border-color" value=""/> </element> <element name="blockName-warning"> <property name="ps-hide" value="true"/> </element>
The above definition removes the standard label border and display, in red, the block label named ‘warning’.
The special PageSeeder property ps-hide=true
stops the label name from appearing.
Inline label
Used to define custom inline content label.
Default properties are as follows:
<element name="inline"> <property name="hyphenate" value="false"/> <property name="padding-right" value="2px"/> <property name="background-color" value="#DD9999"/> </element> <element name="inlineName"> <property name="text-align" value="justify"/> <property name="hyphenate" value="false"/> <property name="color" value="#AA4444"/> <property name="font-weight" value="bold"/> <property name="background-color" value="#DD9999"/> <property name="padding-left" value="2px"/> <property name="padding-right" value="2px"/> <property name="margin-right" value="2px"/> </element>
For each custom inline label, new properties can be specified to overwrite the default properties in FOConfig.xml
. Create a new element name ="inline-[customname]"
and inlineName-[customname]
and insert the customized properties.
Example:
<element name="inline-drug"> <property name="font-style" value="italic"/> <property name="padding-right" value=""/> <property name="background-color" value=""/> </element> <element name="inlineName-drug"> <property name="ps-hide" value="true"/> </element>
The above definition removes the standard label border and display, in italic, the inline label named ‘drug’.
The special PageSeeder property ps-hide=true
stops the label name from appearing.
Fragment kind and type
Used to define body type styles for fragments of different kinds and types. There are no properties defined by default. Any of the FO block properties can be used, plus span
with values all
or none
, for spanning multiple columns. Using span
requires pso-pdf v0.4.6 or higher (included in PageSeeder v5.98 or higher).
For each fragment type specified in your document, properties can be specified. Create a new <element name="fragment-[type]">
. The following other fragment elements are also supported in pso-pdf v1.0.3 or higher: xref-fragment
, media-fragment
, properties-fragment
.
To define default properties for a fragment element, remove the -[type]
e.g. <element name="fragment">
Example:
<element name="fragment-chapter"> <property name="break-before" value="page"/> </element>
The above definition puts a page break before fragments with <fragment
type="chapter">
Table of contents elements
Elements from the table of contents can be formatted in the final document by using specific names. Each line in the table of contents is defined by a level and it is the name used for the element (that is: toc-level1, toc-level2
...).
The other element name used is toc
which applies to the <toc>
element.
The special property called ps-hide
(which can be used for labels, see above) can be used here to not display certain levels. For example, to have no page break before the toc, make level 4 red and hide levels 5 and 6 in the table of contents, the following needs to be added to the configuration file:
<element name="toc"> <property name="break-before" value=""/> <property name="break-after" value="page"/> </element> <element name="toc-level4"> <property name="margin-left" value="80px"/> <property name="text-align-last" value="justify"/> <property name="color" value="red"/> </element> <element name="toc-level5"> <property name="ps-hide" value="true"/> </element> <element name="toc-level6"> <property name="ps-hide" value="true"/> </element>
Date pattern
The <date>
element is used to specify that the current date is to be inserted at a special location in a header or footer. The attribute @pattern
can be used to describe what the output date should look like. Its format uses the square brackets ([]) to insert a specific part of the date (month, day, year...) and the following key letters:
Letter | Meaning |
---|---|
year | |
M | month in year |
D | day in month |
d | day in year |
F | day of week |
W | week in year |
w | week in month |
o | ordinal form |
n, N or Nn | use name (lower-case, upper-case, title-case) |
Here are some examples of date formats and the corresponding pattern:
Date format | Pattern |
---|---|
2002-12-31 | [Y0001]-[M01]-[D01] |
12-31-2002 | [M]-[D]-[Y] |
31/12/2002 | [D]/[M]/[Y] |
31st December, 2002 | [D1o] [MNn], [Y] |
31 DEC 2002 | [D01] [MN,*-3] [Y0001] |
December 31, 2002 | [MNn] [D], [Y] |
The default pattern used (if none is specified) is [MNn] [D], [Y].
Example
<?xml version="1.0"?> <styles> <!-- ===============GENERAL PROPERTIES================ --> <page> <property name="page-height" value="29.7cm"/> <property name="page-width" value="21cm"/> <property name="margin-top" value="2cm"/> <property name="margin-bottom" value="2cm"/> <property name="margin-left" value="2cm"/> <property name="margin-right" value="2cm"/> </page> <body> <property name="margin-top" value="1cm"/> <property name="margin-bottom" value="2cm"/> <property name="font-family" value="Times Roman"/> </body> <header> <property name="extent" value="1cm" /> <property name="line-height" value="12pt"/> <property name="font-size" value="10pt"/> <property name="border-bottom-style" value="solid"/> <property name="border-bottom-width" value="0.2mm"/> <left><filename /></left> <right><date pattern="[D1o] [MNn], [Y]" /></right> </header> <footer> <property name="extent" value="1cm" /> <property name="font-size" value="10pt"/> <center> <text>Page <page-number/> of <total-pages/></text> </center> </footer> <!-- ===============ELEMENTS PROPERTIES=============== --> <element name="section-title"> <property name="font-weight" value="bold"/> <property name="font-size" value="20pt"/> </element> <element name="toc"> <property name="space-before.optimum" value="10pt"/> <property name="space-after.optimum" value="10pt"/> </element> <element name="toc-title"> <property name="font-weight" value="20pt"/> <property name="space-before.optimum" value="12pt"/> <property name="space-after.optimum" value="12pt"/> </element> <element name="table"> <property name="space-before.optimum" value="12pt"/> <property name="space-after.optimum" value="12pt"/> </element> <element name="heading1"> <property name="font-weight" value="bold"/> <property name="font-size" value="22pt"/> <property name="space-before.optimum" value="12pt"/> <property name="space-after.optimum" value="12pt"/> </element> <element name="heading2"> <property name="font-size" value="20pt"/> </element> <element name="heading3"> <property name="font-weight" value="bold"/> <property name="font-size" value="18pt"/> </element> <element name="para"> <property name="space-before.optimum" value="5pt"/> <property name="space-after.optimum" value="5pt"/> <property name="text-align" value="justify"/> </element> <element name="link"> <property name="color" value="orange"/> </element> </styles>