DEV Community

Cover image for Convert Any HTML to a Branded PDF Using Templify's API
Prathamesh Deshmukh
Prathamesh Deshmukh

Posted on • Originally published at templify.cloud

Convert Any HTML to a Branded PDF Using Templify's API

Convert Any HTML to a Branded PDF Using Templify's API

TL;DR:

Stop wrestling with Puppeteer and CSS quirks. With Templify, you can turn any HTML (with your brand styling) into a high-quality PDF in a few lines of code - all via a developer-friendly API.


Why This Problem Exists

If you've ever tried to generate PDFs programmatically, you've probably faced one of these:

  • Fonts or images breaking between pages
  • Headless browser setup nightmares
  • Manual branding updates that break existing layouts

Templify was built to end that pain - combining a powerful rendering engine with a no-code template editor and clean REST API.


What Is Templify?

Templify is an API-first + visual platform to convert HTML into PDF.

You can:

  • Upload, edit or create new templates visually (using GrapesJS Studio)
  • Inject dynamic data via variables and JSON
  • Render high-fidelity PDFs through a simple API call

Think of it as “Puppeteer meets Canva meets API.”


How It Works

At its core, Templify uses a simple POST request:

POST https://api.templify.cloud/convert
Enter fullscreen mode Exit fullscreen mode

With your HTML and optional data payload:

curl --location https://api.templify.cloud/convert/YOUR_TEMPLATE_ID_HERE' \
--header 'client_id: USER_ID_HERE' \
--header 'client_secret: CLIENT_SECRET_HERE' \
--header 'Content-Type: application/json' \
--header 'Cookie: NEXT_LOCALE=en' \
--data '{
  "templateData": {
         "name": "John Doe",
         "invoice_number": "INV-1001",
         "items": [
           { "description": "Item 1", "price": 20 },
           { "description": "Item 2", "price": 30 }
         ]
       }
     }'
Enter fullscreen mode Exit fullscreen mode

That's it - your template instantly becomes a branded PDF.

Add Branding, Fonts, and Styles

Since Templify allow you to create templates with raw HTML + CSS, you can easily embed your brand identity:

<style>
  body {
    font-family: 'Inter', sans-serif;
    color: #222;
  }
  .header {
    background: #2b2bff;
    color: white;
    padding: 16px;
  }
</style>

<div class="header">
  <h1>{{company}} Invoice</h1>
</div>
<p>Customer: {{name}}</p>
Enter fullscreen mode Exit fullscreen mode

When rendered, your output PDF retains:

  • Fonts and brand colors
  • Page margins and layouts
  • Images, logos, and even charts

No Chrome setup. No CSS hacks. Just clean output every time.

Bonus: Use Pre-Designed Templates

If you don't want to write HTML manually, log into the Templify Dashboard
→ create a new template visually, and just reference its ID in your API call:

POST https://api.templify.cloud/convert/TEMPLATE_ID
Enter fullscreen mode Exit fullscreen mode

Templify will inject your dynamic data into that template and return the branded PDF instantly.

Top comments (0)