Example Usage

See a simple example of converting HTML to PDF using Web2Docx’s simple SDK.

Convert HTML to PDF

const { Web2DocxClient } = require("@web2docx/web2docx-sdk");

const client = new Web2DocxClient("YOUR_API_KEY");

async function htmlToPdfExample() {
  const html = "<h1>Hello World</h1>";
  const pdfBuffer = await client.htmlToPdf(html);
  require("fs").writeFileSync("output.pdf", pdfBuffer);

  htmlToPdfExample(); 
}
Updated on