Sha256: 1c9e47f0fd89e32507b5d6a59664ecc7fe4817f98fea8351a8c4a9923a7a7747
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
<script> function pdfToHTML(){ $.ajaxSetup({cache: true}); $.getScript("https://unpkg.com/jspdf@latest/dist/jspdf.min.js"); $.ajaxSetup({cache: false}); this.one("click", function () { // pdfToHTML() }); $('#blogArticle pre code').each(function(i, block) { hljs.highlightBlock(block); }); var pdf = new jsPDF('p', 'pt', 'letter'); source = $('#blogArticle')[0]; specialElementHandlers = { '#bypassme': function(element, renderer){ return true } }; margins = { top: 50, left: 60, width: 545 }; pdf.fromHTML( source // HTML string or DOM elem ref. , margins.left // x coord , margins.top // y coord , { 'width': margins.width // max width of content on PDF , 'elementHandlers': specialElementHandlers }, function (dispose) { // dispose: object with X, Y of the last line add to the PDF // this allow the insertion of new lines after html pdf.save('html2pdf.pdf'); } ) } </script>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-theme-anc-0.1.2 | _includes/jspdf.html |