当前位置:网站首页>JS create PDF file
JS create PDF file
2022-06-30 07:05:00 【Learning makes me happy -- Yuxiang】
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Blobs</title>
<script src="http://localhost:81/0_plus-in/jspdf/jspdf.debug.js"></script>
</head>
<body>
<button id="button">Link</button>
</body>
<script>
const download = (fileName, blob) => {
const element = document.createElement('a');
const url = window.URL.createObjectURL(blob);
element.href = url;
element.download = fileName;
element.target = '_blank';
element.click();
element.remove();
}
document.addEventListener('click', async event => {
if (event.target.id === 'button') {
const doc = new jsPDF();
const fileName = 'test.pdf';
doc.text('Hello world!', 10, 10);
const blob = new Blob([doc.output()]);
download(fileName, blob);
}
});
</script>
</html>边栏推荐
- Installation du serveur linux redis
- 已解决:initialize specified but the data directory has files in it. Aborting
- [introduction to Expo application] v Expert recommendation letter template
- [semidrive source code analysis] [x9 chip startup process] 34 - RTOS side display module SDM_ display_ Init display initialization source code analysis
- Traverse map
- Determine whether the picture is in JPG picture format
- SOC项目AHB_SD_HOST控制器设计
- Records of problems solved (continuously updated)
- Cmake post makefile:32: * * * missing separator Stop.
- Four great happenings on earth
猜你喜欢

app闪退

Traverse map

Go常用命令

Google Earth Engine(GEE)——墨累全球潮汐湿地变化 v1 (1999-2019) 数据集

First line of code (Third Edition) learning notes
![[JSON tutorial] Chapter 1 learning notes](/img/ce/cf74b396a8bd4c4c7028663b8cb665.png)
[JSON tutorial] Chapter 1 learning notes

2021-07-02

经纬恒润再次荣获PACCAR集团 10PPM 质量奖

Record one time of Tencent Test Development Engineer's automation interface test practice experience

第一行代码(第三版)学习笔记
随机推荐
【每日一题】535. TinyURL 的加密与解密
Egret P2 physical engine (1) small ball falling demo
安装Go语言开发工具
免实名域名是什么意思?
What if I forget my account number after opening an account? Is it safe to open an account online?
What does the real name free domain name mean?
Browser downloads files as attachments
oracle
SQL Server2005中SUM函数内嵌套IF语句
RT thread migration to s5p4418 (IV): thread synchronization
ROS program compilation, like no compilation, refers to the execution of the old compiled executable program
Linu基础-分区规划与使用
June 29, 2022 -- take the first step with C # -- add decision logic to the code using the "if", "else" and "else if" statements in C #
sscanf 函数的使用
第一行代码(第三版)学习笔记
Go常用命令
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
Egret engine P2 physics engine (2) - Funny physical phenomenon of small balls hitting the ground
Write and run the first go language program
Go语言指针介绍