I am using Puppeteer in node.js to convert an html string to a pdf file. Styles inside the head are working but those linked from local .css files with absolute path are not. Here is the code:
createPDF: async (html, file) => {
const browser = await puppeteer.launch({
headless: true
})
const page = await browser.newPage()
await page.setContent(html, {
waitUntil: 'domcontentloaded'
})
await page.pdf({
format: 'A4',
path: file,
printBackground: true
})
await browser.close()
}
The head of the html looks like this:
<link href="C:\dev\project\src\views\tailwind.min.css" rel="stylesheet">
<style>
.maindiv{
padding-top:15pt;
}
</style>
I also tried using a url instead but nothing changed.