Download using jsPDF on a mobile devices

后端 未结 3 1434
青春惊慌失措
青春惊慌失措 2020-12-20 04:50

I have a page that includes a download button using jsPDF. On desktop machines it downloads the page as it should. However, pdf.save() does not work on my table

3条回答
  •  天命终不由人
    2020-12-20 05:34

    Here is the solution of download on mobile with jspdf

    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
    {
         var blob = pdf.output();
         window.open(URL.createObjectURL(blob));
    }
    else
    {
         pdf.save('filename.pdf');
    }
    

提交回复
热议问题