Overview

Pdfnow offers an powerful template mechanism to create various types of documents. It offers sophisticated layout features, including page layout and paging, calculations (e.g. for invoices), precise location of elements, etc.).

The templates are defined in XML. They can either be uploaded as a single file, or as an ZIP-archive containing additional images or other ressources.

The data binding is defined within the template. When generating a document, you will pass the template name and the specific data (as XML-String). Within the template there are Xpath-statements to extract the relevant data fields out of the given XML-String.

There are several ways to create your templates:

  1. build them from the scratch
  2. modify our sample templates
  3. use an external XSL-FO-editor

Sample Templates

The most convenient way to get your own template is to download one of our sample templates, to modify it and to upload it in your user area. A list of sample-templates can be found here: → Documentation/SampleTemplates

Template Syntax

The layout description language is similar to HTML, but brings many layout related concepts that do not exists in HTML. An overview of the syntax can be found here: → http://www.w3schools.com/xslfo/default.asp

Images and additional resources

If you are going to embed individual artwork into your templates (e.g. your company logo), you have to create a layout-ZIP-archive, containing the layout-file and the additional ressources.

Please ensure following conventions

 

File/FolderDescription
images/ this subdirectory contains the required images
logo.jpg the images can be named arbitrary. The template.xml will reference them by name
image2.png some more images
template.xml the name of the main layout-file have to be template.xml

Within your template-file you can reference these resources as following:

	<fo:block>
		<fo:external-graphic>
			<xs:atribute name=”src”>'images/logo.jpg'</xs:attribute>
		</fo:external-graphic>
	</fo:block>