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

  • boder-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

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;">Paragrph 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 hyphenation on, using a space character, for table cells.

See Also

| |

Related Topics

External Websites