Template Design - Best Practices

When thinking to design a template you must take into account the following important points that will help you to obtain a well formatted and easy to use template:

  1. Data Source
  2. Pagination
  3. Dynamic Behavior
  4. Formatting and Styling Elements 

Data Source

The structure of your data source is very important because the way your data will be extracted and displayed in your output depends on the input structure. 

Firstly, you have to understand you data source to further be able to recognize where a node is located and how it can be used in your template. Here is what you need to know: 

  • where certain values are located within your data
  • which elements are repeated and which occur only once
  • where specific flag elements are located
  • which elements are affected by these flag elements and in what way

Pagination

After you have a good understanding of the Data Source structure, you may start with the template designing. Pagination is exposed, in detail, in the Pagination section of the documentation.

The pagination stage consists of the following:

  • Setting the dimensions of the page (Page Layouts)
  • Choosing the orientation  of the document output. If it changes from a page to the next one, you would have to create a different Layout.
  • Headers and footers. If you want to customize them you will have to ask yourself if they change from a page to the next one and in this case you should use complex Page Sets with multiple Page Layouts.
  •  Customized left or right side regions.
  • You can take a look at the Pagination-RegionDiagram.png file for a more detailed explanation on how margins and extents should be set.

Here is an example for what we explained above:

Attached you will find a PDF file that simulates this phase (Pagination-PageLayouts.pdf), with the following explanations:

  • Page dimensions & orientation:
    • All Pages have the same size and orientation
    • For the PDF page size, you can either measure them, or check the Properties (Ctrl+D -> Description -> Page Size)
    • In this case, the page is 8.50 x 11.00 in
  • Page Layouts:
    • Page 1 is different than all other pages (region sizes) – This means one layout: FirstPageLayout
      • Header: 2.56in
      • Footer: 2.63in
      • Left Side: 0.62in
      • Right Side: 0.69in
      • Body Region will have the margins to match the side regions: margin-top=”2.56in”, margin-right=”0.69in”, margin-bottom=”2.63in”, margin-left=”0.62in”
    • Page 5 is different than all other pages (region sizes) – This means another layout: LastPageLayout
    • Pages 2-4 look the same – This is the third Page Layout – AllOtherPagesLayout
  • Dynamic Pages:
    • Take a look at pages 2 and 4, in the header – notice that the text on gray background changes from “Domestic” to “Roaming”, while the rest of the layout stays the same. This means that you have the same set of pages for different data in the XML, which results in a Dynamic Page Set to repeat for each set of nodes (associated to “domestic” services and to “roaming” services)
    • If you had only one Repeating Page set, then the first page (with the service summary) and the last page (with the form) would repeat for each set of data displayed: once for “domestic” and once for “roaming”. Since you do not want that, your final document will have 3 Page Sets:
      • Page Set 1 – Simple, for the first page (with the summary)
      • Page Set 2 – Complex, dynamic for the display of services, depending on the type
      • Page Set 3 – Simple, for the last page (the form)

 The next step is to consider any dynamic behavior for the actual content and design your template in accordance to the needed rules.

Dynamic Behavior

Once you reached this point, you must know that an important part of the design process is done. At this step you should know that your data may be inserted in the template as a static content or as a dynamic content. 

  1. Static content - the data inserted in the template will be displayed as it is in the output;
  2. Dynamic content - this content is inserted in your template from your data source like this:
    • display data directly from the source
    • conditionally show static and dynamic elements;
    • repeat for every element present in your data source(depending on the data source)

Example

Attached you will find a PDF file (DynamicContent.pdf) which simulates the Dynamic Behavior phase, with the following explanations:

  • Page 1: 
    • Contains both static (“Invoice” text, the logo) and dynamic data (customer  information, invoice number etc.)
    • Contains conditional formatting rules (for next section, though :) - but you need to think about it now, since it depends on the data source):
      • Customer address – space needs to be collapsed if no data is available
      • Total Amount in footer – needs to be colored red if the value in a field does not match the calculated amount
    • Contains conditional sections:
      • “Sale” commercial – needs to be displayed only if a condition is met (/invoice/commercial/@display="true")
  • Page 2:
    • Contains both static and dynamic data
    • Contains a repeating section (repeating table): the details for each call take on received by the customer (/invoice/details/services[@type='Domestic Usage']/service-detail[@type='call'])
  • Page 5:
    • Contains a form, with both static and dynamic data

Formatting & Style Elements

This is the part of the process that when your template "comes to life".

By using formatting and styling elements, the content is highlighted and so is more easier for the reader to obtain the needed information.

The questions that you want to ask yourself when designing a template are the following:

  • Is my font always from the same Family? What about the size, weight, style and color? Does it vary from static content to dynamic one?
  • What will the tables look like? Do they have the same design?
  • Does the style for an element (static or dynamic) change, depending on the data source?
  • What sizes will the images have?

 Example

See the attached FormattingandStyles.pdf for more details.

Have more questions? Submit a request

Comments

Powered by Zendesk