当前位置:网站首页>富文本编辑器导出内容为pdf或docx
富文本编辑器导出内容为pdf或docx
2022-04-22 18:03:00 【哈哈哈185】
富文本内容导出为 pdf
安装依赖
npm install vue-html2pdf --save
使用说明
//引入组件
import VueHtml2pdf from "vue-html2pdf";
//使用组件
<vue-html2pdf
:show-layout="false"
:float-layout="true"
:enable-download="true"
:preview-modal="false"
:paginate-elements-by-height="1400"
:filename="tempFileName"
:pdf-quality="2"
:manual-pagination="false"
pdf-format="a4"
pdf-orientation="landscape"
pdf-content-width="800px"
@progress="onProgress($event)"
@hasStartedGeneration="hasStartedGeneration()"
@hasGenerated="hasGenerated($event)"
ref="html2Pdf"
>
<section slot="pdf-content">
<!-- PDF Content Here -->
<span id="report" v-html="content"></span>
</section>
</vue-html2pdf>
// 导出
// tempFileName 导出的文件名
handleSaveToPdf() {
this.$refs.html2Pdf.generatePdf();
}
富文本内容导出为 word
安装依赖
npm install file-saver --save
npm install html-docx-js --save
使用说明
//引入
import {
saveAs} from 'file-saver';
import htmlDocx from 'html-docx-js/dist/html-docx';
handleSaveToWord() {
// this.content 富文本内容
// this.tempFileName 导出的文件名
var converted = htmlDocx.asBlob(this.content);
saveAs(converted, this.tempFileName);
},
版权声明
本文为[哈哈哈185]所创,转载请带上原文链接,感谢
https://blog.csdn.net/SUE_DONG/article/details/124299361
边栏推荐
- Soft test high item notes | typical life cycle model of information system project
- uniapp处理强制刷新问题
- spaCy教程学习
- Spacy first routine (automatic annotation of Chinese text)
- Dpdk captures traffic from a given port / queue
- In 2022, it is said on the Internet that Apple's upcoming new models iPhone 14 pro and iPhone 14 Pro Max will be a new screen shape, not a banged screen. Do you expect the iPhone 14 with a new screen
- National information exchange model (NIEM) operation manual
- Why has Sony always dominated the smartphone sensor market
- How to quickly switch and display different software interfaces on the computer
- 数字化靶场的未来方向
猜你喜欢
随机推荐
因索引合并导致的MySQL死锁分析与解决实战!
dpdk从环形队列ring获取解析数据包,并使用hashtable统计
Activiti 挂起与激活任务
An idea plug-in that doesn't work, but can install X
一文了解进程及其通信方法
National Information Exchange Model(NIEM)操作手册
软考高项笔记 | 项目的特点
Dynamic programming: multiple knapsack problem
filter执行原理深度剖析(bitset机制与caching机制)
Characteristics of soft test high item notes | items
DOM的综合应用的例子--点击加一和减一
S7-1500 specific methods and steps of data exchange between CPU and OPC UA server through OPC UA client
Fastjson 2 is coming, the performance continues to improve, and it can fight for another ten years
Pikachu File Inclusion (File Inclusion Vulnerability)
Soft test high item notes | contents of project proposal
Continuously effective risk indicator: turbulence index
数字化靶场的未来方向
接口协议之抓包分析 TCP 协议
学习文档。
CISP 考试资源分享








