Jspdf _javascript tips for displaying instances in a Web page after PDF generation

Source: Internet
Author: User
Copy Code code as follows:

<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

Doc.setproperties ({//Set document properties
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, ' Hello world! '; /Add text

Doc.settextcolor (255,0,0);
Doc.setfontsize (16);
Doc.setfont ("Helvetica");
Doc.setfonttype ("bold");
Doc.text, ' This are client-side Javascript, pumping out a PDF. '

Doc.addpage ()//Add page

Doc.setlinewidth (1);//Set line width
Doc.setdrawcolor (0,255,0);//Set Brush color
Doc.setfillcolor (255,0,0);//Set Fill Color
Doc.line (60, 20, 115, 60);//Draw line, two coordinates
Doc.rect (100, 50, 20, 30); Draw Rectangle, upper left corner coordinate, width, height, only border
Doc.ellipse (A, N, ' F '); draw ellipse, center point coordinate, width, height, only edge
Doc.circle (+, ' FD '); Circle, center-point coordinates, radius, border and padding are
Doc.triangle (M, N, a, 130, "FD");

Doc.output (' Datauri ');//Direct output to new Web page
document.getElementById ("iframe123"). src = doc.output (' datauristring ');//Show in IFRAME
}
</script>
<body>
<iframe id= "iframe123" frameborder= "0" width= "height=" ></iframe>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.