locked
Export into pdf from HTML is not working IE, But working in Chrome RRS feed

  • Question

  • User-1355965324 posted
    I am using jsPdf to create the pdf file from its html page . But the pdf is not being created in IE. But it is working in chrome. Any idea how can it work in IE . Is there any other update or any other method to bring the html content to pdf
     
    Here is the code
    $.getScript('https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js', function () {
            $.getScript('https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/2.3.5/jspdf.plugin.autotable.js', function () {
                var doc = new jsPDF('p', 'pt', 'a4');
                var Company = "My Company";
                var totalPagesExp = "{total_pages_count_string}";
                var ReportHeader = 'Employee Details';
                var res = doc.autoTableHtmlToJson(document.getElementById("tbl"));
                doc.autoTable(res.columns, res.data, {
                    startY: 50,
                    theme: 'grid',
                    headerRows: 1,
                    styles: {
                        overflow: 'linebreak',
                        halign: 'center', // left, center, right
                        valign: 'middle', // top, middle, bottom
                        header: {
                            fontSize: 15,
                            bold: true,
                            margin: [0, 0, 0, 5]
                        },
                    },
                    addPageContent: function (data) {
                        doc.setFontSize(12);
                        doc.text(Company, 255, 30);
                        //doc.text(ReportHeader, 160, 45);
    
                        doc.setFontSize(8);
                        var ypos = 90;
                        var yposDiff = 20;
    
                        //1st Row
                        doc.text("Depot", 40, ypos);
                        doc.text(":      " + $("#dropdownDepot option:selected").text(), 120, ypos);
                        doc.text("Department", 255, ypos);
                        doc.text(":    " + $("#dropdownDepartment option:selected").text(), 340, ypos);
    
    
                        //2nd Row
                        ypos = ypos + yposDiff;
                        doc.text("Employee", 40, ypos);
                        doc.text(":    " + $("#dropdownEmployee option:selected").text(), 120, ypos);
                        doc.text("Designation", 255, ypos);
                        doc.text(":    " + $("#Designation option:selected").text(), 340, ypos);
    
                        //3rd Row
                        ypos = ypos + yposDiff;
                        doc.text("Title", 40, ypos);
                        doc.text(":    " + $("#Title option:selected").text(), 120, ypos);
                        doc.text("Sex", 255, ypos);
                        doc.text(":    " + $("#Sex option:selected").text(), 340, ypos);
    
                        //4th Row
                        ypos = ypos + yposDiff;
                        doc.text("First Name", 40, ypos);
                        doc.text(":    " + $("#txtFirstName").val(), 120, ypos);
                        doc.text("Last Name", 255, ypos);
                        doc.text(":    " + $("#txtLastName").val(), 340, ypos);

    Friday, November 20, 2020 4:00 PM

Answers

  • User-1355965324 posted

    It is fixed, There is one line as given below and it is not working in IE but will work in chrome

    var out = doc.output('dataurlnewwindow');

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 27, 2020 2:46 PM

All replies

  • User-474980206 posted

     Which promise pollyfil did you use?

    Friday, November 20, 2020 4:16 PM
  • User-1355965324 posted

    How can I find Which promise pollyfil are using ?

    Friday, November 20, 2020 4:38 PM
  • User-1355965324 posted

    It is fixed, There is one line as given below and it is not working in IE but will work in chrome

    var out = doc.output('dataurlnewwindow');

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 27, 2020 2:46 PM