First of all, select Make API Call module:

Now change API Endpoint Path into the following:

/v1/pdf/convert/from/html

Now in the Body section click on Add Item

And add item with Key set to templateId
and Value set to your HTML template id
you can find your HTML template id at https://app.pdf.co/template/html

we set here to default 1 which is invoice template

 

 

HTML template may look like this (use Mustache template syntax):

<!doctype html>
<html lang=”en-US”>
<head>
<title>Invoice {{invoice.id}} {{client.name}}</title>
<link rel=”stylesheet” href=”https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css” integrity=”sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn” crossorigin=”anonymous”>
</head>
<body>
{{#if paid}}
<div style=”border-width: 3px;border-style: solid; border-color: #008000;border-radius: 8px; color: #008000; opacity:0.4; position: absolute; z-index: 1; left:80%; top:3%; font-size: 60pt;transform: rotate(-20deg)”>
PAID </div>
{{/if}}

<div class=”container”>
<div class=””>
<div class=””>

<!– invoice: header begin–>
<div class=”row col-md-12″>
<div class=”col col-md-6″>
<div class=”font-weight-bold”>{{issuer.name}}</div>

<div class=””>{{issuer.company}}</div>
<div class=””>{{issuer.address}}</div>
<div class=””>{{issuer.email}}</div>
<div class=””>{{issuer.website}}</div>
</div>
….
</html>

And then add another item with Key as templateData
and set Value to the JSON string with input JSON data:

Make sure to enable these switches:
Forcely enable async mode

and
Auto-run job/check for async jobs

Run the module and it will take HTML template + JSON data = and will generate output PDF:

Final PDF:

Related Pages:

Related Samples: