eKoopmans / html2pdf.js

Client-side HTML-to-PDF rendering using pure JS.
MIT License
4.05k stars 1.37k forks source link

DOMException #401

Open johnshields opened 3 years ago

johnshields commented 3 years ago

Hello, I am currently getting this Error when using html2pdf with Angular and Ionic.

DOMException: Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot': Sharing constructed stylesheets in multiple documents is not allowed
onExportPDF() {
        const options = {
            filename: 'job_report.pdf',
            image: {type: 'jpeg', quality: 0.98},
            html2canvas: {scale: 2, logging: true, dpi: 192, letterRendering: true},
            jsPDF: {unit: 'mm', format: 'a4', orientation: 'portrait'}
        };
        const content: Element = document.getElementById('job-report');

        html2pdf()
            .from(content)
            .set(options)
            .save();
 }

Anyone have a know the issue to stop the DOMException? It works fine. The PDF comes out nice, but it's a nasty error to have in the console, and it makes my hamburger button for my side menu disappear.

dennybiasiolli commented 3 years ago

Same problem here