Learn and share. The simplest harmony.

 

jsPDF : Generating PDF Documents using JavaScript

Posted on January 20, 2010 and got 4 shouts so far

This is the first time i found PDF generations tool using JavaScript (jsPDF), this tool allow us generate PDF in server-side and client-side. They claim client-side demo works best in Safari or iPhone Safari, also working in other browsers including Firefox 3 on Windows and Opera while IE is in development to be supported. Take a look at this script :

var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');

// Output as Data URI
doc.output('datauri');

This script will generate simple PDF that contains “Hello World” text and “This is client-side Javascript, pumping out a PDF” text below the previous text. Click here to see some examples.

 

This Post Tags :

Bookmark Post :

  • great plugin, thank you very much for sharing.

  • Thank you for your comment, hope it’s useful ;)

  • hello all , how to convert 1 div to pdf file ? thank for help

  • nice tut !!… could this plug in can print or include pictures to print it in pdf???