vg-print 1.0.376 → 1.0.377
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 +17 -3
- package/dist/{chunk-3VYIPD3A-CcpfRFLk.js → chunk-3VYIPD3A-g7DHlmKH.js} +1 -1
- package/dist/{chunk-ANSXOGKI-Bup1FQWY.js → chunk-ANSXOGKI-C__0TCZi.js} +1 -1
- package/dist/{chunk-T4JIPPZO-CltW68To.js → chunk-T4JIPPZO-CveXSBih.js} +1 -1
- package/dist/{download-BTF-cFI0.js → download-DR_0rclo.js} +2 -2
- package/dist/{index-Bmi0stXR.js → index-CqfNvZfh.js} +1819 -1743
- package/dist/rasterize-JS5G2XHH-DoWh-sX2.js +4 -0
- package/dist/toBlob-Bx0pib-r.js +4 -0
- package/dist/toCanvas-BBJ4P34A.js +4 -0
- package/dist/{toImg-Cosv_sJA.js → toImg-J19J9Eje.js} +2 -2
- package/dist/vg-print.es.js +16 -15
- package/dist/vg-print.umd.js +72 -72
- package/package.json +1 -1
- package/dist/rasterize-JS5G2XHH-2x8kZ6eF.js +0 -4
- package/dist/toBlob-CfZrBP-m.js +0 -4
- package/dist/toCanvas-pYhkVaz7.js +0 -4
package/README.md
CHANGED
|
@@ -11,10 +11,14 @@ npm搜索vg-print.
|
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
更多信息与下载:
|
|
15
|
+
```
|
|
16
|
+
<https://gitee.com/gao111/electron-vg-print>
|
|
17
|
+
```
|
|
15
18
|
客户端工具下载:
|
|
19
|
+
```
|
|
16
20
|
https://download.csdn.net/download/github_38400706/92538739
|
|
17
|
-
|
|
21
|
+
```
|
|
18
22
|
## 特性
|
|
19
23
|
|
|
20
24
|
- 全功能页面组件 `FullDesigner`,直接使用,无需拼装子组件
|
|
@@ -577,7 +581,8 @@ import {
|
|
|
577
581
|
getPrinterList,
|
|
578
582
|
setHiwebSocket,
|
|
579
583
|
connect,
|
|
580
|
-
disconnect
|
|
584
|
+
disconnect,
|
|
585
|
+
clientGenerate
|
|
581
586
|
} from 'vg-print'
|
|
582
587
|
|
|
583
588
|
// 1) 创建模板实例(可复用)
|
|
@@ -673,6 +678,15 @@ const list = getPrinterList()
|
|
|
673
678
|
// 使用模板对象直接发起直连打印
|
|
674
679
|
tpl.print2(printData, { printer: printers?.[0]?.name || '' })
|
|
675
680
|
|
|
681
|
+
// 7) 客户端生成(返回客户端保存路径,便于上传到服务器)
|
|
682
|
+
const { pdfPath, imgPath } = await clientGenerate(tpl, printData, {
|
|
683
|
+
pdfName: 'reportPdf', // 不带后缀,内部自动生成 .pdf
|
|
684
|
+
imgName: 'reportJpg', // 不带后缀,内部自动生成 .jpg
|
|
685
|
+
timeout: 60000
|
|
686
|
+
})
|
|
687
|
+
// 例如:上传到后端
|
|
688
|
+
// await api.upload({ pdfPath, imgPath })
|
|
689
|
+
|
|
676
690
|
// 7) 断开连接
|
|
677
691
|
disconnect()
|
|
678
692
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as a } from "./chunk-3VYIPD3A-
|
|
1
|
+
import { W as a } from "./chunk-3VYIPD3A-g7DHlmKH.js";
|
|
2
2
|
async function o(r, t) {
|
|
3
3
|
let i = await a(r, t), e = new Image();
|
|
4
4
|
return e.src = i.toDataURL(`image/${t.format}`, t.quality), await e.decode(), e.style.width = `${i.width / t.dpr}px`, e.style.height = `${i.height / t.dpr}px`, e;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as f } from "./chunk-T4JIPPZO-
|
|
2
|
-
import { W as t } from "./chunk-3VYIPD3A-
|
|
1
|
+
import { m as f } from "./chunk-T4JIPPZO-CveXSBih.js";
|
|
2
|
+
import { W as t } from "./chunk-3VYIPD3A-g7DHlmKH.js";
|
|
3
3
|
async function w(n, e) {
|
|
4
4
|
let c = ((e == null ? void 0 : e.format) || (e == null ? void 0 : e.type) || "").toLowerCase(), a = c === "jpg" ? "jpeg" : c || "png", i = (e == null ? void 0 : e.filename) || `snapdom.${a}`, o = { ...e || {}, format: a, type: a };
|
|
5
5
|
if (o.dpr = 1, a === "svg") {
|