Copy code code as follows:
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = gbk">
<TITLE> JSPDF </Title>
<script type = "text/javascript" src = "jspdf.js"> </script>
<script type = "text/javascript">
window.onload = function () {
var doc = new jspdf ();
// var doc = new jspdf ('landscape'); // horizontal row
DOC.SETPROPERTIES ({// Set the document attribute
Title: 'Title',
subject: 'this is the subject',
Author: 'Dragon',
Keywords: 'javascript, web 2.0, ajax',
Creator: 'Meee'
});
doc.setTextColor (0,255,0);
doc.setfontsize (22);
doc.setfont ("times");
doc.setfonttype ("italic");
doc.text (20, 20, 'hello world!'); // Add text
doc.setTextColor (255,0,0);
doc.setfontsize (16);
doc.setfont ("Helvetica");
doc.setfonttype ("bold");
DOC.Text (20, 30, 'this is client-size javascript, pumping out a pdf.');
doc.addpage (); // Add page
doc.setLineWidth (1); // Set the width of the line
DOC.SETDRAWCOLOR (0,255,0); // Set the color of the brush
doc.setFillcolor (255,0,0); // Set the fill color
DOC.LINE (60, 20, 115, 60); // Drawing line, two coordinates
DOC.RECT (100, 50, 20, 30); // Draw the rectangle, the upper left corner coordinates, width, height, only the border
Doc.ellipse (20, 20, 20, 10, 'f'); // Draw an ellipse, center point coordinates, width, height, only edges
doc.circle (120, 20, 20, 'fd'); // Drawing circles, center point coordinates, radius, borders and filling are all available
doc.triangle (100, 100, 110, 100, 120, 130, 'fd');
//doc.output ('datauri') ;// directly output to the new web page
document.GetelementByid ("iframe123").
}
</script>
</head>
<body>
<iframe ID = "iframe123" Frameborder = "0"> </iframe>
</body>
</html>