Skip to main content

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.

  1. Install the package with your package manager (npm, yarn, or pnpm). i.e. pnpm i @html-to-pdf.io/sdk-javascript

  2. Use in your script

import { Configuration, HTMLToPDFApi } from "@html-to-pdf.io/sdk-javascript"

const htmlToPDF = new HTMLToPDFApi(
new Configuration({
apiKey: "<your-api-key>",
})
)

try {
const { pdfData } = await htmlToPDF.htmlPost({
body: JSON.stringify({
html: "<html><body> ... </body></html>",
}),
})

// You can now do something with `pdfData`, which is a base64 encoded string of the generated PDF.
} catch (error) {
console.error(error)
}
  1. Fetch your API Key from the Dashboard - Your API Key

Python

Coming soon!