Skip to main content

embed_assets

Inlined CSS and a base64 data-URI image via embed helpers.

Browse this template in the repository →

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

default

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

Download PDF — embed_assets / default

Inputs

Render data

default

{}

Template

template.handlebars

<html>
<head>
<link rel="stylesheet" href="assets/styles.css" />
<style type="text/css">
{{ embed_text "styles.css" }}
</style>
</head>
<body>
<h1>Static template with assets</h1>
<img src="data:image/svg+xml;base64,{{ embed_base64 "image.svg" }}" />
</body>
</html>

Assets

assets/image.svg

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" stroke="red" fill="grey">
<circle cx="50" cy="50" r="40" />
</svg>

assets/styles.css

body {
background-color: yellow;
color: green;
}