How to force page break or set html per page?
Closed this issue · 2 comments
abelncm commented
Is there a way to force page break so the next page's content doesn't flow into the previous page?
abelncm commented
Use css page break attribute
tanz98 commented
i already use page-break-after: always; or break-after:page;
still not works, any idea?
here's my code function when call print
async prints(url, filename, landscape = false) {
let file = { url };
let path = Helpers.publicPath('/prints/' + filename)
await html_to_pdf.generatePdf(file, {
format: 'A4',
landscape,
printBackground: true,
margin: {
top: '20px',
right: '20px',
bottom: '20px',
left: '20px'
}
}).then(pdfBuffer => {
console.log('PDF Buffer:-');
fs.writeFileSync(path, pdfBuffer)
})
return path
}
and this the html code
<div style="page-break-after: always;">Content</div>
<table>Content</table>
here the result
https://ibb.co/849gh2h