jsPDF is not supported in remote server for IE-11

2020-07-29 23:54发布

问题:

I created a java script for creating a PDF file using jsPDF and its working on all the latest version of browser including IE11,chrome and firefox .

below is the code

<html>
<head>
 <link rel="stylesheet" type="text/css" href="Wrs_Export_Report.css">
 <script src="html2canvas.js"></script>
 <script src="jspdf.debug.js"></script>

<script type="text/javascript">

function PDF()
{
        var vTable = '<br>';
                vTable += '<table class="wrs_export">';
                vTable += '<tr class="wrs_export">';
                vTable += '<th class = "wrs_export">Radio ID</th>';
                vTable += '<th class = "wrs_export">Description</th>';
                vTable += '<th class = "wrs_export" colspan="2">Additional Info</th>';
                vTable += '<th class = "wrs_export">Location</th>';
                vTable += '<th class = "wrs_export">Start Time</th>';
                vTable += '<th class = "wrs_export">Duration</th>';
                vTable += '<th class = "wrs_export">Result</th>';
                vTable += '<th class = "wrs_export">Failure Type</th>';
                vTable += '<th class = "wrs_export">Corrective Action</th>';
                vTable += '</tr>';

var vDiv = document.getElementById('test');
vDiv.innerHTML = vTable;

alert("vDiv is");
alert(vDiv);

var pdf = new jsPDF('p', 'pt', 'letter');
alert("pdf is");
alert(pdf);
html2canvas(vDiv, {   
        onrendered: function (canvas) 
        {   alert("html2canvas is");    
            var imgData = canvas.toDataURL('image/png',1.0);
            pdf.addImage(imgData, 'PNG', 0, 0);
            pdf.save('example.pdf');
        }
    }); 

}

</script>

  </head>

<body onload = "PDF();">
<div id="test" class="but">Some text </div>

 </body>
  </html>

But when i am putting this HTML page in a remote server then this line var pdf = new jsPDF('p', 'pt', 'letter'); does not execute for IE-11 and i am not able create the PDF. But I am able to do it with Chrome and Firefox.

My remote server is an arm board running Linux and has an IP address . Using the IP address i am accessing the HTML page from my computer and executing it .

So is it that jsPDF is not supported in remote server for IE-11 ?? [ Sorry i kept some alert messages for debugging purpose]

Please need some assistance on this

Cheers, Sid