Skip to main content

handlebars_partials

Handlebars partials incl. a Markdown partial and a nested one.

Browse this template in the repository →

The PDFs below are rendered live by PDF Server from the shipped examples.

example_1

Your browser can’t display this PDF inline — use the download link below.

Download PDF — handlebars_partials / example_1

Inputs

Render data

example_1

examples/example_1.json

{
"value": "$123 456",
"items": [
"First item",
"Second item",
"Third item"
],
"isEnabled": true
}

PDF parameters

params.json

{
"pdf": {
}
}

Template

header.handlebars

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font-size: 10pt;
padding: 0 2em;
}
</style>
</head>
<body>
<p>Number: {{ value }}</p>
</body>
</html>

template.handlebars

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
</head>
<body>
<article>
<h1>Handlebars example</h1>
</article>
<article>
{{#if isEnabled}}
{{> content . }}
{{/if}}

{{> inner/inner . }}
</article>
</body>
</html>

Partials

partials/content.handlebars.md

Document number: {{ value }}

{{#each items }}
1. {{ this }}
{{/each }}

partials/inner/inner.handlebars

<p>Inner template</p>