Salin kode kode sebagai berikut:
<Html>
<head>
<meta http-equiv = "konten tipe" content = "text/html; charset = gbk">
<title> jspdf </title>
<script type = "text/javascript" src = "jspdf.js"> </ptript>
<type skrip = "Teks/JavaScript">
window.onload = function () {
var doc = jspdf baru ();
// var doc = jspdf baru ('lansekap'); // baris horizontal
Doc.setProperties ({// Atur atribut dokumen
Judul: 'Judul',
Subjek: 'Ini adalah subjek',
Penulis: 'Naga',
Kata kunci: 'JavaScript, Web 2.0, Ajax',
Pencipta: 'Meee'
});
doc.setTextColor (0,255,0);
doc.setfontsize (22);
doc.setfont ("Times");
doc.setFontType ("Italic");
doc.text (20, 20, 'halo dunia!');
doc.setTextColor (255,0,0);
doc.setfontsize (16);
doc.setfont ("helvetica");
doc.setFontType ("BOLD");
Doc.text (20, 30, 'Ini adalah javascript ukuran klien, memompa pdf.');
doc.addpage ();
doc.setlinewidth (1);
Doc.setdrawcolor (0,255,0);
doc.setfillcolor (255,0,0);
Doc.line (60, 20, 115, 60);
Doc.rect (100, 50, 20, 30);
Doc.ellipse (20, 20, 20, 10, 'f');
Doc.Circle (120, 20, 20, 'FD');
doc.triangle (100, 100, 110, 100, 120, 130, 'fd');
//doc.output ('datauri'); // output langsung ke halaman web baru
document.geteLementById ("iframe123").
}
</script>
</head>
<body>
<iframe id = "iframe123" frameborder = "0"> </iframe>
</body>
</html>