1(function renderPdfs($, Drupal) { 2 'use strict'; 3 Drupal.behaviors.renderPdfs = { 4 attach: function (context, settings) { 5 6 var downPdf = document.getElementById('renderPdf'); 7 if (downPdf) { 8 downPdf.onclick = function () { 9 html2canvas(document.body, { 10 onrendered: function (canvas) { 11 var contentWidth = canvas.width; 12 var contentHeight = canvas.height; 13 var pageHeight = contentWidth / 595.28 * 841.89; 14 var leftHeight = contentHeight; 15 var position = 0; 16 var imgWidth = 555.28; 17 var imgHeight = 555.28 / contentWidth * contentHeight; 18 var pageData = canvas.toDataURL('image/jpeg', 1.0); 19 var pdf = new jsPDF('', 'pt', 'a4'); 20 if (leftHeight < pageHeight) { 21 pdf.addImage(pageData, 'JPEG', 20, 0, imgWidth, imgHeight); 22 } 23 else { 24 while (leftHeight > 0) { 25 pdf.addImage(pageData, 'JPEG', 20, position, imgWidth, imgHeight); 26 leftHeight -= pageHeight; 27 position -= 841.89; 28 if (leftHeight > 0) { 29 pdf.addPage(); 30 } 31 } 32 } 33 pdf.deletePage(5); 34 pdf.deletePage(4); 35 pdf.deletePage(3); 36 pdf.deletePage(2); 37 pdf.save(document.title + '.pdf'); 38 } 39 }); 40 }; 41 } 42 43 } 44 }; 45})(jQuery, Drupal);
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.