Free plan
HTML to PDF
Turn a web page, HTML, Markdown or text into a PDF
About this tool
HTML is the code that web pages are made of. This tool turns HTML code, a public web page, Markdown or plain text into a PDF. You choose the paper size, portrait or landscape, margins and whether backgrounds print.
For example, you turn an invoice web page into a PDF to email.
How to use it
- Choose this tool. You do not need to add a file.
- Paste your HTML, Markdown or text, or enter a public web address.
- Choose the paper size, direction and margins.
- Press Generate.
- Download the PDF.
What you get back
You get a PDF of your page. Download it.
GOOD TO KNOW
Network access from the rendered page is SSRF-protected (private/internal addresses are blocked). With `records` every document counts as one unit unless the plan says otherwise (records per unit); the answer is { results: [{ url, format, sizeBytes, record, ... }] }.
TEST IT LIVE
Try HTML to PDF in the Studio
One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Family
Render
Plan
Free
Method
POST
Endpoint
/v1/render/html-to-pdf
Tool ID
render.html-to-pdf
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Render
For developers
Use it from your code
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/render/html-to-pdf" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-H "Content-Type: application/json" \
-d '{"width":1000,"height":1500,"format":"A4"}'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.render.htmlToPdf({
"width": 1000,
"height": 1500,
"format": "A4"
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->render()->htmlToPdf([
'width' => 1000,
'height' => 1500,
'format' => 'A4',
]);
echo $result->requestId;Documentation
