Jspdf export PDF Sample _javascript tips

Source: Internet
Author: User
Tags save file
Jspdf doesn't seem to support Chinese
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<title>Downloadify</title>
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" >
<style type= "text/css" media= "screen" >
Body {background: #fff; width:500px; margin:20px auto;
Input, textarea, p {font-family: XXFarEastFont-Arial, blackbody; font-size:12pt;}
Input, textarea {border:solid 1px #aaa; padding:4px; width:98%;}
</style>
<script type= "Text/javascript" src= "Js/swfobject.js" ></script>
<script type= "Text/javascript" src= "Js/downloadify.js" ></script>
<script type= "Text/javascript" src= "Js/jspdf.js" ></script>
<!--<script type= "Text/javascript" src= "Js/downloadify.min.js" ></script>-->
<script type= "Text/javascript" >
Window.load=function () {
Downloadify.create (' downloadify ', {
Filename:function () {
return document.getElementById (' filename '). Value;
},
Data:function () {
var doc = new jspdf ();
Doc.text, document.getElementById (' data '). Value);
Doc.addpage ();
Doc.text, document.getElementById (' data '). Value);
return Doc.output ();
},
Oncomplete:function () {alert (' successfully save file! ');},
Oncancel:function () {alert (' You have canceled saving file ');},
Onerror:function () {alert (' error occurred ');},
SWF: ' js/downloadify.swf ',
Downloadimage: ' Js/download.png ',
WIDTH:100,
Height:30,
Transparent:true,
Append:false
});
}
</script>
<body onload= "load ();" >
<input type= "text" name= "filename" value= "filename. pdf" id= "filename"/><br/>
<textarea cols= "rows=" name= "Data" id= "data" >it seem do not support to chinese</textarea>
<p id= "Downloadify" >you must have Flash installed to download this file.</p>
</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.