<html>
<body>
<button class="btn btn-info" onclick="downloadPdf()">Generate</button>
<div id="downloadify"></div>
<script type="text/javascript" src="js/libs/swfobject.js"></script>
<script type="text/javascript" src="js/libs/downloadify.min.js"></script>
<script type="text/javascript" src="js/jspdf/jspdf.js"></script>
<script type="text/javascript">
function downloadPdf(){
Downloadify.create("downloadify",{
filename: "Simple.pdf",
data: function()
{
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, "My First PDF");
doc.addPage();
doc.setFontSize(16);
doc.text(20, 30, "This is some normal sized text underneath.");
return doc.output();
},
onComplete: function(){ alert("Your File Has Been Saved!"); },
onCancel: function(){ alert("You have cancelled the saving of this file."); },
onError: function(){ alert("You must put something in the File Contents or there will be nothing to save!"); },
downloadImage: "images/download.png",
swf: "images/downloadify.swf",
width: 100,
height: 30,
transparent: true,
append: false
});
}
</script></body></html>