External CSS are not getting Applied on exported PDF Using jspdf's .html() method

490 Views Asked by At

My Goal is to Export All Pages in the PDF, For Exporting PDF I'm using jsPDF.HTML() method, Here is my code

const exportToPdf = () => {
    const doc = new jsPDF("p", "pt", "a4");
   
    doc.html(page1 + page2 + page3 + page4 + page5, {
      callback: function (pdf) {
        pdf.save("multipage.pdf");
        window.open(pdf.output("bloburl"));
      },
      dompurify: dompurify,
      margin: 50,
    });

Here page1, page2, page3 are HTML strings For that specific page. I'm rendering those pages using Tabs! styling for All those pages are given by external CSS file. while exporting from the localhost it is working fine & CSS changes from the external file also applies, but when we export it from the Hosted Site only CSS given with the inline styling are applying not from the external file

This is the log I'm getting in console: Failed to load resource: the server responded with a status of 403 (Forbidden) whether it is possible that Azure is creating the issue ?

I don't know what's the issue behind that, Your suggestion will be very helpful, Thanks!!

0

There are 0 best solutions below