Skip to content

Chrome is stuck after generating a PDF #3868

Open
@fpegios

Description

@fpegios

This is the code I am using

const generatePDF = async () => {
const element = contentRef.current
const canvas = await html2canvas(element, {
useCORS: true, // For external images
allowTaint: true,
scrollX: 0,
scrollY: 0,
})

const imgData = canvas.toDataURL('image/png')
const pdf = new jsPDF('p', 'mm', 'a4')

const imgWidth = 210 // A4 width in mm
const pageHeight = 295 // A4 height in mm
const imgHeight = (canvas.height * imgWidth) / canvas.width
let position = 0

pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)

pdf.save('my-react-app.pdf')

}

The issue appeared after updating to Google Chrome 138

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions