3. Styles and layout

CSS Stylesheets

Custom layouting and styling of the pdf document is quite rudimentary, as only a very limited subset of html tags and especially css styles are supported.

It is possible to override some of the existing itextSharp functionality to improve on html parsing and css support, but currently the standard iTextSharp code is being used in the component.

As far as I could see from the iTextSharp sourcecode the following css styles are supported:

  • vertical-align
  • line-height
  • font-familiy
  • font-size
  • font-weight
  • font-style
  • color
  • text-decoration
  • text-align
  • padding-left


As you see, this implies that you have to be quite careful in generating your html to get your html/pdf as similar as possible.

As an example, the H1 tag of this document looks like this:

h1 {color: #606d7a; font-size:25px; line-height: 400%;}


Umbraco templates

By default the template attached to each content node will be used to render the html. However, it is possible to use an alternative template for every node converted, as you sometimes wish to make the printing-template slimmer than you normal template, excluding navigation controls, links, banners etc.

To add an alternative template to you node, add this property to your document type

PdfCreatorAltTemplateId (integer type templateid)

For every content node processed the PdfCreator will examine the node to check whether an alternative template is specified or not. In case an alternative template is specified, this will be used for rendering the node - otherwise the standard node template will be used.