-1

I'm trying the load a pdf from a URL but I get a warning:

"[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/."

Also, when I save the PDF it is empty so I guess the pdf file was not loaded into jsPDF.

Does anyone know how this can be done?

This is the code that I've used:

add
<script>
    url = 'https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf';
    

    function loadPdf() {
       myPdf = new jsPDF();            
        myPdf.loadFile(url, false, responsePDF());            
               

    }

    function responsePDF() {
        console.log("in callback")
        myPdf.save("pdfjs.pdf");

    }


</script>
Zia ur Rehman
  • 573
  • 3
  • 15
  • Duplicate Question of https://stackoverflow.com/questions/44488002/js-deprecation-synchronous-xmlhttprequest-on-the-main-thread-is-deprecated-be – Zia ur Rehman Mar 20 '21 at 09:05

1 Answers1

0

I think you made some syntax error

url = 'https://raw.github...." should be const url = 'https://raw.github....

myPdf = new jsPDF(); should be const myPdf = new jsPDF();