html2pdf-dbs
v1.0.14
Published
html2pdf
Downloads
76
Readme
html2pdf
Convert HTML to PDF.
Install
npm i html2pdf-dbs -S
Usage
<script lang="ts" setup>
import { htmlToPdf } from "html2pdf-dbs";
</script>
<el-button @click="htmlToPdf('elementId', 'fileNme', {isSetWatermark: true, userName: '张三'})" type="primary">
下载
</el-button>
Params
| Name | Type | Default | Description |
|----------------------|-----------|--------------|--------------------------------------------------------------------|
| elementId | String
| ""
| 需要转换的html父元素ID |
| fileNme | String
| ""
| 下载到本地的文件名称 |
| isSetWatermark | Boolean
| false
| 下载到本地的文件是否加水印 |
| userName | String
| 获取localStorage下userInfo.name
| 水印文案(userName yyyy-MM-dd)|