HTML Conversion API

PDF generation API is available at /api/generate-pdf

Image generation API is available at /api/generate-image

API documentation is available at /api/docs

Quick Examples

Generate PDF

fetch('/api/generate-pdf', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    html: '<html><body><h1>Hello World</h1></body></html>'
  })
})
.then(response => response.blob())
.then(blob => {
  // Create a link to download the PDF
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'document.pdf';
  a.click();
})

Generate High-Quality Image

fetch('/api/generate-image', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    html: '<html><body><h1>Hello World</h1></body></html>',
    width: 800,
    height: 600,
    type: 'png',
    deviceScaleFactor: 4,
    omitBackground: true
  })
})
.then(response => response.blob())
.then(blob => {
  // Create a link to download the image
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'image.png';
  a.click();
})