DOMException: Failed to set the 'adoptedStyleSheets' code example

Example: DOMException: Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot': Sharing constructed stylesheets in multiple documents is not allowed at addStyle

// Angular8 has new changes that cause html2canvas to not work properly. 
// Try use the dom-to-image property instead by first installing: npm install dom-to-image 
// Then see below for code execution in the .ts file:

import * as jspdf from 'jspdf';
import domtoimage from 'dom-to-image';

public convertToPDF()
{
    const div = document.getElementById('contentToConvert');
    const options = { background: 'white', height: 845, width: 595 };
    domtoimage.toPng(div, options).then(
      (dataUrl) => 
    {
        //Initialize JSPDF
        const doc = new jspdf.jsPDF('p', 'mm', 'a4');
        doc.addImage(dataUrl, 'PNG', 0, 0, 250, 250);//change values to your preference
        doc.save('invoice.pdf');
    })  
}