Jspdf to show instances on a Web page after PDF generation

Source: Internet
Author: User

  This article describes how the following jspdf generated PDF in the Web page to show, there is a good example, you can refer to the following

The code is 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     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 (; ) Doc.setfont ("Times");  Doc.setfonttype ("italic");  doc.text ("Hello world!"); /Add text     Doc.settextcolor (255,0,0);  doc.setfontsize;  doc.setfont ("Helvetica");  Doc.setfonttype ("bold");  Doc.text ("This is client-side Javascript, pumping out a PDF.");     Doc.addpage ()//Add page &NBSp   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 lines, two coordinates   DOC.RECT (100, 50, 20, 30); Draw Rectangle, upper left corner coordinates, width, height, only border   Doc.ellipse (M, M, ' F ');/Draw ellipse, center point coordinate, width, height, only edge   doc.circle (=,, ' FD ') ;//Draw Circle, center point coordinates, RADIUS, border and fill all have   doc.triangle (M,,,, 130, ' FD ');   //doc.output (' Datauri '); Direct output to new Web page   document.getElementById ("iframe123"). src = doc.output (' datauristring ');//show   in IFRAME   </script>  </head>  <body>  <iframe id= "iframe123" frameborder= "0" width= " "Height=" ></iframe>  </body>  </html> 

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.