DOMException: Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot' code example
Example: DOMException: Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot': Sharing constructed stylesheets in multiple documents is not allowed at addStyle
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) =>
{
const doc = new jspdf.jsPDF('p', 'mm', 'a4');
doc.addImage(dataUrl, 'PNG', 0, 0, 250, 250);
doc.save('invoice.pdf');
})
}