vg-print 1.1.404 → 1.1.406
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -7
- package/dist/style.css +1 -1
- package/dist/vg-print.es.js +4936 -4890
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1023,16 +1023,15 @@ const preview = async () => {
|
|
|
1023
1023
|
|
|
1024
1024
|
回调签名:
|
|
1025
1025
|
|
|
1026
|
-
|
|
1026
|
+
|
|
1027
1027
|
beforeGetHtml: ({ template, html }) => html
|
|
1028
|
-
|
|
1028
|
+
|
|
1029
1029
|
|
|
1030
1030
|
- `template`:当前 `hiprint.PrintTemplate` 实例
|
|
1031
1031
|
- `html`:生成的 HTML 字符串(可返回新字符串替换;返回 `undefined/null` 则保持不变)
|
|
1032
1032
|
|
|
1033
1033
|
示例:
|
|
1034
1034
|
|
|
1035
|
-
```js
|
|
1036
1035
|
const tpl = createTemplate(tmplJson)
|
|
1037
1036
|
|
|
1038
1037
|
const html = await getHtml(tpl, printData, {
|
|
@@ -1054,13 +1053,12 @@ tpl.print2(printData, {
|
|
|
1054
1053
|
title: '打印预览pdf',
|
|
1055
1054
|
beforeGetHtml: ({ template, html }) => html
|
|
1056
1055
|
})
|
|
1057
|
-
|
|
1056
|
+
|
|
1058
1057
|
|
|
1059
1058
|
// 3) 浏览器打印(不需要客户端)
|
|
1060
1059
|
printBrowser(tpl, printData)
|
|
1061
1060
|
|
|
1062
1061
|
// 4) 导出 PDF
|
|
1063
|
-
// 原生方法
|
|
1064
1062
|
exportPdf(tpl, printData, '打印预览pdf', {
|
|
1065
1063
|
paperWidth: 210, // 纸张宽度 默认 210mm
|
|
1066
1064
|
paperHeight: 297, // 纸张高度 默认 297mm
|
|
@@ -1195,8 +1193,6 @@ exportPdf(tpl, printData, '打印预览pdf', {
|
|
|
1195
1193
|
imageQuality: 0.92, // 图片质量 0-1 默认 0.92
|
|
1196
1194
|
imageCompression: 'FAST', // 图片压缩算法 默认 FAST 支持 FAST、MEDIUM、SLOW
|
|
1197
1195
|
onProgress: (cur, total) => console.log('toPdf 进度', Math.floor((cur / total) * 100))
|
|
1198
|
-
})
|
|
1199
|
-
onProgress: (cur, total) => console.log('toPdf 进度', Math.floor((cur / total) * 100))
|
|
1200
1196
|
})
|
|
1201
1197
|
```
|
|
1202
1198
|
|