script type=text/JavaScript // https://w。二十行代码实现JavaScript在本地生成pdf文件。" />

二十行代码实现JavaScript在本地生成pdf文件

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello world</title>
</head>
<body>
<h1>Hello world</h1>
<script type="text/JAVAscript" src=https://www.isolves.com/it/cxkf/yy/js/2019-07-01/"jspdf.debug.js">
<script type="text/JavaScript">
// https://www.sitepoint.com/generating-pdfs-from-web-pages-on-the-fly-with-jspdf/
var pdf = new jsPDF();
pdf.text(30, 30, 'Hello world!');
pdf.text(40, 40, 'Another line!');
pdf.save('hello_world.pdf');
</script>
</body>
</html>
将后缀重命名成.js
[jspdf.debug.pdf](https://github.com/i042416/KnowlegeRepository/files/967487/jspdf.debug.pdf) 【二十行代码实现JavaScript在本地生成pdf文件】pdf.js下载:

二十行代码实现JavaScript在本地生成pdf文件

文章插图




    推荐阅读