Use an SDK
We maintain up-to-date SDKs for various languages so you don't have to! Choose an SDK solution below, or you can also write your own REST Client.
SDKs
Typescript / JavaScript (Browser & Node JS)
You can use our SDK in the browser (through a package manager) and in a Node JS application - the process is the same.
-
Install the package with your package manager (npm, yarn, or pnpm). i.e.
pnpm i @html-to-pdf.io/sdk-javascript -
Use in your script
import { htmlToPdf } from "@html-to-pdf.io/sdk-javascript"
const { pdfData } = await htmlToPdf({
apiKey: "<your-api-key>",
html: "<html><body> ... </body></html>",
})
// Now download or render `pdfData`,
// which is a base64 encoded string of the generated PDF.
- Fetch your API Key from the Dashboard - Your API Key