Skip to content

Create perfect PDF from HTML string with puppeteer

Notifications You must be signed in to change notification settings

haliloncen/html2pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm i @haliloncen/html2pdf
import { createPDF } from '@haliloncen/html2pdf'
// or const { createPDF } = require('@haliloncen/html2pdf')

const html = '<h1>2b || !2b, that is the question</h1>'
const options = {
  window: { width: '1920px', height: '1080px' },
  margin: '32px'
}

// Promise chain
createPDF(html, options)
  .then(pdfBuffer => {...})
  .catch(err => {...})

// Async-await
async function justDoIt() {
  const pdfBuffer = await createPDF(html, options)
}

About

Create perfect PDF from HTML string with puppeteer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published