@maqiuyao/dxf-viewer 0.2.4 → 0.2.5

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
@@ -104,8 +104,28 @@ viewer.enableClickHighlight = true; // 默认 false;开启后点击实体绘
104
104
  viewer.clearClickHighlight(); // 主动清除
105
105
  ```
106
106
 
107
+ ## 图纸打印
108
+
109
+ ```ts
110
+ await viewer.print({
111
+ area: "view", // "view" 当前视图(所见即所得,默认)| "extents" 全图
112
+ paperSize: "A3", // A4 | A3 | A2 | A1 | A0 | Letter(默认 A4)
113
+ orientation: "auto", // auto | landscape | portrait(auto 按图片宽高自动选)
114
+ invertColors: true, // 白底打印:深色 CAD 背景转白、墨迹保留原色相(默认 false)
115
+ margins: 10, // 页边距 mm(默认 10)
116
+ title: "站场平面图", // 打印文档标题
117
+ });
118
+ ```
119
+
120
+ 实现要点:
121
+ - 打印瞬间临时以最高分辨率(至 GPU 纹理上限)重渲染并合成叠加层,打印后自动恢复相机/渲染状态
122
+ - `extents` 全图模式自动裁剪到图纸包围盒(无空白边距),并强制显示低缩放下被隐藏的图符/文字
123
+ - `invertColors` 采用像素级处理(背景色距离判背景 + HSL 明度反转 + 墨迹膨胀加粗),线条/文字在纸上实心清晰,蓝色等彩色实体**色相不变**
124
+ - 输出经隐藏 iframe + `@page` 规则调起浏览器打印对话框,单页不溢出
125
+
107
126
  ## 优化与完善(0.2.x)
108
127
 
128
+ - 0.2.5:新增 `viewer.print()` 图纸打印 API(当前视图/全图、A4–A0 纸张、白底保色打印、高分辨率输出)
109
129
  - 0.2.4:`three-mesh-bvh` 已编译内联进产物,webpack4/Vue2(Vue CLI)项目无需再配置 `transpileDependencies` 或 alias,直接安装即可(此前会报 `Module parse failed: Unexpected token (18:9)`)
110
130
  - 修复 ATTRIB/ATTDEF 对齐组码(72/74)解析:右对齐/居中文字不再与块内图符重叠
111
131
  - 中文乱码修复:`\M+XXXX` GBK 转义码正确解码