I am trying to use
export const downloadPDF = (html, filename) => {
const style = document.createElement('style')
style.innerHTML = `
body {
position: fixed !important;
top: -99999px !important;
left: -99999px !important;
z-index: -99999 !important;
}
`
document.head.appendChild(style)
html2pdf().set(
{
jsPDF: { format: 'a4', unit: 'mm' },
image: { type: 'jpeg', quality: 1 },
margin: -0.1,
},
).from(html).save(filename).finally(() => {
style.remove()
})
}
This function prints my HTML. When I call this function, my screen shows the HTML I fixed by rendering it on the outer screen, but it's still showing a white screen before removing the style at the final callback
Does anyone have a solution to solve this problem?