1function generatePDF(elid, filename = "report") { 2 // Choose the element that our invoice is rendered in. 3 const element = document.getElementById(elid) 4 // // Choose the element and save the PDF for our user. 5 // html2pdf().from(element).save() 6 7 // var opt = { 8 // margin: 1, 9 // filename: "myfile.pdf", 10 // image: { type: "jpeg", quality: 0.98 }, 11 // html2canvas: { dpi: 192, letterRendering: true }, 12 // jsPDF: { unit: "in", format: "letter", orientation: "portrait" }, 13 // } 14 15 var opt = { 16 margin: 1, 17 filename: filename + ".pdf", 18 image: { type: "jpg", quality: 0.98 }, 19 html2canvas: { scale: 3, y: 0, scrollY: 0 }, 20 // jsPDF: { format: "A4" }, 21 jsPDF: { format: "letter", orientation: "portrait" }, 22 } 23 24 // Choose the element and save the PDF for our user. 25 html2pdf(element, opt) 26} 27 28function getOuterHtml(tableID) { 29 var tableSelect = document.getElementById(tableID) 30 var tableHTML = tableSelect.outerHTML.replace(/ /g, "%20") 31 return tableHTML 32} 33 34function exportTableToExcel(tableID, tableHTML = "", filename = "") { 35 var downloadLink 36 var dataType = "application/vnd.ms-excel" 37 if (tableHTML == "") { 38 // var tableSelect = document.getElementById(tableID) 39 // tableHTML = tableSelect.outerHTML.replace(/ /g, "%20") 40 tableHTML = getOuterHtml(tableID) 41 } 42 43 // Specify file name 44 filename = filename ? filename + ".xlsx" : "excel_data.xlsx" 45 46 // Create download link element 47 downloadLink = document.createElement("a") 48 49 document.body.appendChild(downloadLink) 50 51 if (navigator.msSaveOrOpenBlob) { 52 var blob = new Blob(["\ufeff", tableHTML], { 53 type: dataType, 54 }) 55 navigator.msSaveOrOpenBlob(blob, filename) 56 } else { 57 // Create a link to the file 58 downloadLink.href = "data:" + dataType + ", " + tableHTML 59 60 // Setting the file name 61 downloadLink.download = filename 62 63 //triggering the function 64 downloadLink.click() 65 } 66}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.