Here is the full html file "built" by the blocks in the BuildFile procedure
<html><head><link rel="icon" type="image/png" href="https://cdn1.iconfinder.com/data/icons/appicns/513/appicns_Chrome.png"><script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script></head><body><h3>Making PDF</h3></body><script>var doc = new jsPDF()var reportTitle = "Lorem Ipsum simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";var splitTitle = doc.splitTextToSize(reportTitle, 180);doc.text(15, 20, splitTitle);doc.save('filename.pdf')</script></html>
How does this work? The BuildFile procedure creates a full html file using the inputs of the content and filename which can be provided by the user. The button click calls the newly created file with activityStarter to be opened by Chrome.
Hopefully you can figure it out from here ?
<!DOCTYPE html><html><head><link rel="icon" type="image/png" href="https://cdn1.iconfinder.com/data/icons/appicns/513/appicns_Chrome.png"><script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/2.3.2/jspdf.plugin.autotable.js"></script></head><body><h3>Making PDF Table</h3></body><script>
var doc = new jsPDF();doc.setFontSize(18);doc.setFontStyle('bold');doc.text(15, 30, "My PDF Table"); doc.setFontSize(11);doc.setFontStyle('normal');var cols = ["Apples", "Pears", "Oranges", "Cherries"];var rows = [ [50, 100, 150, 200], [250, 300, 350, 400], [450, 500, 550, 600],];doc.autoTable(cols, rows, {startY: 50, showHeader: 'firstPage'});
doc.save('table.pdf');
</script>
</html>
Enjoy :)
Credits: inspired by pdf extension from Andres Daniel Cotes