Main Content

Modify Styles in PDF Templates

You can customize or add format styles in your PDF template using this workflow. For information on properties you can use in PDF style sheets, see PDF Style Sheets.

  1. In your unzipped template, navigate to TEMPLATEROOT/Stylesheet.

  2. In a text or HTML editor, edit the cascading style sheet (.css) file for the styles you want to create or modify.

    For information about editing a cascading style sheet, see documentation such as the W3Schools.com CSS tutorial.

  3. Save the style sheet.

PDF Style Sheets

Use the style sheet to define global styles, that is, the appearance of your template elements. You define PDF styles primarily using a subset of cascading style sheet (CSS) formats. You can also use XSL formatting objects (FO) to format elements in a PDF template. However, to simplify and streamline your code, use FO only for properties you cannot define using CSS.

Using a style sheet for the default formats simplifies your program. You also make fewer updates when your formatting changes. Format elements in your DOM program (for example, by using an object’s Style property) when you want to override the default format for an instance.

You can use a subset of CSS formats and this subset of selectors and selector combinators:

  • Universal selector (*)

  • Type selector (for example, p or span)

  • Class selector (for example, p.MyPara)

  • Descendant combinator (space)

  • Child combinator (>)

  • Adjacent sibling combinator (+)

  • General sibling combinator (~)

Note

You can use the generalized sibling (~) and adjacent sibling (+) selectors only when creating the report in memory. If you are using streaming mode, do not use these selectors.

These CSS formats are supported:

  • background-color

  • border

  • border-bottom

  • border-bottom-color

  • border-bottom-style

  • boder-bottom-width

  • border-color

  • border-left

  • border-left-color

  • border-left-style

  • border-left-width

  • border-right

  • border-right-color

  • border-rigtht-style

  • border-right-width

  • border-style

  • border-top

  • border-top-color

  • border-top-style

  • border-top-width

  • border-width

  • color

  • counter-increment

  • counter-reset

  • font-family

  • font-size

  • font-style

  • font-weight

  • height

  • line-height

  • list-style-type

  • margin

  • margin-bottom

  • margin-left

  • margin-right

  • margin-top

  • padding

  • padding-bottom

  • padding-left

  • padding-right

  • padding-top

  • text-align

  • text-decoration

  • text-indent

  • vertical-align

  • white-space

  • width

These custom CSS formats are supported:

  • page-border

  • page-border-color

  • page-border-width

  • page-border-style

  • page-border-margin

  • page-border-bottom

  • page-border-bottom-color

  • page-border-bottom-width

  • page-border-bottom-style

  • page-border-bottom-margin

  • page-border-left

  • page-border-left-color

  • page-border-left-width

  • page-border-left-style

  • page-border-left-margin

  • page-border-right

  • page-border-right-color

  • page-border-right-width

  • page-border-right-style

  • page-border-right-margin

  • page-border-top

  • page-border-top-color

  • page-border-top-width

  • page-border-top-style

  • page-border-top-margin

  • page-border-surround-header

  • page-border-surround-footer

  • page-margin

  • page-margin-top

  • page-margin-left

  • page-margin-bottom

  • page-margin-right

  • page-margin-header

  • page-margin-footer

  • page-margin-gutter

  • page-size

  • page-width

  • page-height

  • page-orientation

  • halign

  • valign

For information about FO, see https://www.w3.org/TR/xsl11/#fo-section.

Hyphenation Styles in PDF Templates

You can enable or disable hyphenation for paragraph and table cell styles that you define. You can also specify a hyphenation character. Alternatively, you can specify hyphenation on an instance of a <p> or <td> element.

Specify Hyphenation for PDF Styles

You can specify hyphenation when you define a paragraph or table cell style. Use the hyphenation style with the name of the hyphenation character (hyphen or space), or use none to turn hyphenation off. If your style does not specify hyphenation, hyphenation is off by default for paragraphs and on by default for table cells, using a space character. These examples show the possible values for defining hyphenation in your CSS:

  • p.Style1 { hyphenation: hyphen; }

  • td.Style2 { hyphenation: space; }

  • p.SentenceStyle { hyphenation: none; }

Specify Hyphenation in PDF Tags

You can use a hyphenation value with the style attribute of paragraph and table cell styles. Use the value in the form hyphenation:hyphenStyle;, where hyphenStyle is none, hyphen, or space. For example:

<p style="hyphenation:hyphen;">Paragraph text</p>

If you do not specify the value, or hyphenation is not specified in the CSS, the default is no hyphenation for paragraphs and table cells.

See Also

| |

Related Topics

External Websites