To have one single template for a number of situations you can work with Velocity syntax. Using Velocity syntax in your template, you can dynamically control the output depending on the information stored in a placeholder.

Info

Atlassian Confluence and our Scroll Exporters use Velocity 1.6. More information about Velocity can be found in the official Apache Velocity Project documentation.

Examples

Scroll PDF Exporter examples

The example is using some Scroll PDF Exporter specific sections, however the way you define the placeholders in all other exporters are the same.

Having different product logos depending on the exported variant

Using our content management add-on Scroll Versions, you can have multiple variants within the same space. Depending on the variant, you can have a different product logo in the header or footer of your exported PDF file.

To have different product logos depending on the variant:

  1. Open your template and click Page Layouts.
  2. Depending on the position where you want to insert the product logo, click Enter Custom in the drop-down list.
  3. Enter the following lines of code:

    Example: Having different product logos for different variants

    #if ($scrollVersions.Variant.Name == "PDF")
        <img src="pdf-logo.png" />
    #elseif ($scrollVersions.Variant.Name == "HTML")
        <img src="html-logo.png" />
    #else
        <img src="generic-logo.png" />
    #end
    CODE

    When you export a variant with name "PDF", an image with name "pdf-logo.png" will be displayed in the header or footer, when exporting variant "HTML", an image with name "html-logo.png" will be displayed in the header or footer, when displaying all other variants an image with name "generic-logo.png" will be displayed in the header or footer.

    Example: Having different text based on labels of the root page

    #if ($page.labels == "PDF")
        This page is valid for PDF files
    #elseif ($page.labels == "HTML")
        This page is valid for HTML files
    #else
        This page is valid for all file types
    #end
    CODE

    When you export a variant with label "PDF", the text "This page is valid for PDF files" will be displayed in the header or footer, when exporting a page with label "HTML", the text "This page is valid for HTML files" will be displayed in the header or footer, when exporting any other page, the text "This page is valid for all file types" will be displayed in the header or footer.

  4. Click Save.

Having different imprint or legal pages depending on the exported language

Using our language add-on Scroll Translations, you can have multiple languages within the same space. Depending on the language you are exporting, you can have a different imprint page (or other static pages) in your exported file.

To have a different imprint page depending on the exported language:

  1. Open your template and click Static Pages.
  2. Add a new static page.
  3. Enter the following lines of code:

    #if ($scrollVersions.Language.Key == "de")
        <h1>Impressum<h1>
    	...
    #else
        <h1>Imprint<h1>
    	...
    #end
    CODE
  4. Click Save.

When you export language German, the heading "Impressum" is displayed, whereas when you export another language, the heading "Imprint" is displayed.

Having different background images depending on the page status

Scroll Versions comes with a workflow implementation. Depending on the status of the root page (the page you start the export from) you can have different background images.

To have a different background image page depending on the status:

  1. Open your template and click Content Formatting.
  2. Enter the following lines of code:

    @page {
    	border: 1mm solid black;
    	
    	#if ($scrollVersions.State.Name == "draft")
    		background-image: url("draft.png");
    	#elseif ($scrollVersions.State.Name == "review")
    		background-image: url("review.png");
    	#else
    		## no background image for completed pages
    	#end
    	...
    }
    CODE
  3. Click Save.

When you export from a page in status "draft", the background image "draft.png" will be displayed in all exported content pages, when you export from a page in status "review", the background image "review.png" will be displayed, when the root page is in status complete, no background image will be displayed.