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 CHANGED
@@ -11,10 +11,14 @@ npm搜索vg-print.
11
11
 
12
12
  ![静默打印客户端工具](https://gitee.com/gao111/electron-vg-print/raw/master/electron-hiprint.png)
13
13
 
14
- 更多信息与下载:<https://gitee.com/gao111/electron-vg-print>
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 { l as b } from "./index-Bmi0stXR.js";
1
+ import { l as b } from "./index-CqfNvZfh.js";
2
2
  function M(e) {
3
3
  return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { W as a } from "./chunk-3VYIPD3A-CcpfRFLk.js";
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,4 +1,4 @@
1
- import { W as m } from "./chunk-3VYIPD3A-CcpfRFLk.js";
1
+ import { W as m } from "./chunk-3VYIPD3A-g7DHlmKH.js";
2
2
  async function a(n, e) {
3
3
  let o = e.type;
4
4
  if (o === "svg") {
@@ -1,5 +1,5 @@
1
- import { m as f } from "./chunk-T4JIPPZO-CltW68To.js";
2
- import { W as t } from "./chunk-3VYIPD3A-CcpfRFLk.js";
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") {