import fs from'fs'import Anvil from'@anvilco/anvil'const exampleData ={title:'Example HTML to PDF',type:'html',data:{html:`
<h1 class='header-one'>What is Lorem Ipsum?</h1>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text
ever since the <strong>1500s</strong>, when an unknown printer took
a galley of type and scrambled it to make a type specimen book.
</p>
`,css:`
body { font-size: 14px; color: #171717; }
.header-one { text-decoration: underline; }
`,},}const{ statusCode, data, errors }=await anvilClient.generatePDF(exampleData)
console.log('Finished! Status code:', statusCode)// => 200, 400, 404, etcconst outputFilepath = path.join(__dirname,'..','output','generate-html-output.pdf')
fs.writeFileSync(outputFilepath, data,{encoding:null})
console.log('Generated PDF saved to:', outputFilepath)