The following placeholders are used in the custom pdf-template.vm file:
- $pbk-title: the title of the document.
- $description: the string "Personal book export: " followed by the value of $pbk-title.
- $author-display-name: the user's display name.
- $author-email: the user's email.
- $metadata: a dictionary of metadata. The keys of the dictionary are the metadata keys of the document, and their values.
For example: {ft:editorialType=book, FT_Version=Latest, Category=Technical Notes, ft:prettyUrl=Integrate-the-Fluid-Topics-API}. - $outline: the table of contents of the document.
- $tenant-title: the name of the tenant.
- $topics: the document's topics.
Each topic block contains:
- The topic's title, annotated with a CSS class indicating the depth level of the topic in the book structure (.pdf-header-lvl{$depth}).
- The topic's content, wrapped in a container annotated with a CSS class carrying the language of the content (.content-locale-{$locale}).
- The topic's source indicating from where the topic was collected (or information about the writing date if it is a personal topic).
- All possible children topics.
Variables for date and time are available in Configure date formats.
- The metadata placeholder is not available for personal books.
- When a single template is used multiple times, it is necessary to use the #if Velocity directive to apply the metadata placeholder correctly.
Examples
Using the $outline placeholder generates a DOM like the following lines:
<ol>
<li class="outline-entry-1">Fluid Topics Installation
<ol>
<li class="outline-entry-2">Prerequisites
<ol>
<li class="outline-entry-3">Hardware Prerequisites</li>
<li class="outline-entry-3">Software Prerequisites</li>
<li class="outline-entry-3">Installation Types</li>
</ol>
</li>
<li class="outline-entry-2">Architecture Examples</li>
</ol>
</li>
</ol>
Each tree level is annotated with a CSS class indicating the topic depth in this structure (.outline-entry-{depth}).
Using the $topics placeholder generates a DOM like the following lines:
<div class="pdf-topic">
<h1 class="pdf-header-lvl1">
<a name="topic-W610MFkIZPtNWMAV0RWcug">Fluid Topics Installation</a>
</h1>
<div>
<div class="content-locale-en">
<!-- Original topic content -->
</div>
</div>
<div class="topic-source">From : Fluid Topics v2 - Installation and Integration Guide</div>
<div class="pdf-topic">
<h2 class="pdf-header-lvl2">
<a name="topic-yfH5zl4dttxRzaNE3zYATg">Prerequisites</a>
</h2>
<div>
<div class="content-locale-en">
<!-- Original topic content -->
</div>
</div>
<div class="topic-source">From : <!-- Original topic location breadcrumb --></div>
<div class="pdf-topic">
<h3 class="pdf-header-lvl3">
<a name="topic-iWyRdxbvgo4U79pKiL~8QA">Hardware Prerequisites</a>
</h3>
<div>
<div class="content-locale-en">
<!-- Original topic content -->
</div>
</div>
<div class="topic-source">From : <!-- Original topic location breadcrumb --></div>
</div>
<div class="pdf-topic">
<h3 class="pdf-header-lvl3">
<a name="topic-XPrfLHxaUj0JnCTNas0BYg">Software Prerequisites</a>
</h3>
<div>
<div class="content-locale-en">
<!-- Original topic content -->
</div>
</div>
<div class="topic-source">From : <!-- Original topic location breadcrumb --></div>
</div>
<div class="pdf-topic">
<h3 class="pdf-header-lvl3">
<a name="topic-dqXwgTd5_PWC4ARWYl67sg">Installation Types</a>
</h3>
<div>
<div class="content-locale-en">
<!-- Original topic content -->
</div>
</div>
<div class="topic-source">From : <!-- Original topic location breadcrumb --></div>
</div>
</div>
<div class="pdf-topic">
<h2 class="pdf-header-lvl2">
<a name="topic-1Lf2GmoewmF5HJgdj3J~Kw">Architecture Examples</a>
</h2>
<div>
<div class="content-locale-en">
<!-- Original topic content -->
</div>
</div>
<div class="topic-source">From : <!-- Original topic location breadcrumb --></div>
</div>
</div>
The following lines show an example of how to use the $metadata placeholder in the pdf-template.vm file:
<table>
<tr>
<td><strong>Audience</strong></td>
<td>
#if($metadata["audience"])
$metadata["audience"]
#else
Not defined
#end
</td>
</tr>
<tr>
<td><strong>Version</strong></td>
<td><strong>$metadata["version"]</strong></td>
</tr>
</table>
The preceding example provides the following result in the case when the audience metadata is defined:
When the audience metadata is undefined, the result is as follows: