@mlightcad/cad-pdf-core 1.8.0-preview.3 → 1.8.0-preview.4

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 mlightcad
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mlightcad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,57 +1,57 @@
1
- # @mlightcad/cad-pdf-core
2
-
3
- Shared PDF export logic for MLightCAD: the export option model, the
4
- MTEXT/SHAPE glyph provider, and the drawing database → PDF pipeline built on
5
- `@mlightcad/pdf-renderer`.
6
-
7
- > **1.8.0:** This package is new. PDF export was split out of the browser plugin
8
- > so the same pipeline can run in the browser (`cad-pdf-plugin`) and in Node
9
- > without a browser (`cad-pdf-exporter`). See the
10
- > [upgrade guide](../../docs/development/upgrade-guide.md).
11
-
12
- This package has **no** dependency on `@mlightcad/cad-simple-viewer` or the
13
- DOM. Both consumers build on it:
14
-
15
- - `@mlightcad/cad-pdf-plugin` — browser `cpdf` / `-cpdf` commands
16
- - `@mlightcad/cad-pdf-exporter` — headless Node export, no browser
17
-
18
- ## Options
19
-
20
- | Option | Values | Default |
21
- | --------------- | ------------------------- | ---------- |
22
- | `modelSpaceFit` | `extents` / `display` | `extents` |
23
- | `exportLayouts` | `true` / `false` | `true` |
24
- | `textMode` | `text` / `vector` | `text` |
25
- | `colorMode` | `color` / `monochrome` | `color` |
26
-
27
- `colorMode: 'monochrome'` writes white paper with lines, hatch patterns,
28
- points and text in black. Solid and gradient fill areas become grey by
29
- luminance, so light fills stay light and linework drawn over them stays
30
- readable (pure black fills would hide it). Wipeouts still mask in white;
31
- raster images keep their pixels.
32
-
33
- ## API
34
-
35
- ```ts
36
- import {
37
- acexPdfExportDatabase,
38
- acexPdfResolveExportOptions
39
- } from '@mlightcad/cad-pdf-core'
40
-
41
- const bytes = await acexPdfExportDatabase(database, {
42
- ...acexPdfResolveExportOptions({ colorMode: 'monochrome' }),
43
- title: 'drawing',
44
- // Optional host services:
45
- // displayBox, fontMapping, glyphProvider, textFontResolver
46
- })
47
- ```
48
-
49
- The default glyph provider uses the `AcTrMTextRenderer` singleton from
50
- `@mlightcad/three-renderer`. The host must initialize it before export.
51
-
52
- ## Peers
53
-
54
- - `@mlightcad/data-model`
55
- - `@mlightcad/mtext-parser`
56
- - `@mlightcad/pdf-renderer`
57
- - `@mlightcad/three-renderer`
1
+ # @mlightcad/cad-pdf-core
2
+
3
+ Shared PDF export logic for MLightCAD: the export option model, the
4
+ MTEXT/SHAPE glyph provider, and the drawing database → PDF pipeline built on
5
+ `@mlightcad/pdf-renderer`.
6
+
7
+ > **1.8.0:** This package is new. PDF export was split out of the browser plugin
8
+ > so the same pipeline can run in the browser (`cad-pdf-plugin`) and in Node
9
+ > without a browser (`cad-pdf-exporter`). See the
10
+ > [upgrade guide](../../docs/development/upgrade-guide.md).
11
+
12
+ This package has **no** dependency on `@mlightcad/cad-simple-viewer` or the
13
+ DOM. Both consumers build on it:
14
+
15
+ - `@mlightcad/cad-pdf-plugin` — browser `cpdf` / `-cpdf` commands
16
+ - `@mlightcad/cad-pdf-exporter` — headless Node export, no browser
17
+
18
+ ## Options
19
+
20
+ | Option | Values | Default |
21
+ | --------------- | ------------------------- | ---------- |
22
+ | `modelSpaceFit` | `extents` / `display` | `extents` |
23
+ | `exportLayouts` | `true` / `false` | `true` |
24
+ | `textMode` | `text` / `vector` | `text` |
25
+ | `colorMode` | `color` / `monochrome` | `color` |
26
+
27
+ `colorMode: 'monochrome'` writes white paper with lines, hatch patterns,
28
+ points and text in black. Solid and gradient fill areas become grey by
29
+ luminance, so light fills stay light and linework drawn over them stays
30
+ readable (pure black fills would hide it). Wipeouts still mask in white;
31
+ raster images keep their pixels.
32
+
33
+ ## API
34
+
35
+ ```ts
36
+ import {
37
+ acexPdfExportDatabase,
38
+ acexPdfResolveExportOptions
39
+ } from '@mlightcad/cad-pdf-core'
40
+
41
+ const bytes = await acexPdfExportDatabase(database, {
42
+ ...acexPdfResolveExportOptions({ colorMode: 'monochrome' }),
43
+ title: 'drawing',
44
+ // Optional host services:
45
+ // displayBox, fontMapping, glyphProvider, textFontResolver
46
+ })
47
+ ```
48
+
49
+ The default glyph provider uses the `AcTrMTextRenderer` singleton from
50
+ `@mlightcad/three-renderer`. The host must initialize it before export.
51
+
52
+ ## Peers
53
+
54
+ - `@mlightcad/data-model`
55
+ - `@mlightcad/mtext-parser`
56
+ - `@mlightcad/pdf-renderer`
57
+ - `@mlightcad/three-renderer`
@@ -1,9 +1,10 @@
1
1
  import { exportDatabaseToPdf as W } from "@mlightcad/pdf-renderer";
2
2
  import { MTextColor as X } from "@mlightcad/mtext-parser";
3
- import { AcTrMTextRenderer as R } from "@mlightcad/three-renderer";
3
+ import { AcTrMTextRenderer as C } from "@mlightcad/three-renderer";
4
4
  const Y = Object.freeze({
5
5
  modelSpaceFit: "extents",
6
6
  exportLayouts: !0,
7
+ exportEmptyLayouts: !1,
7
8
  textMode: "text",
8
9
  colorMode: "color"
9
10
  });
@@ -11,6 +12,7 @@ function j(e = {}) {
11
12
  return {
12
13
  modelSpaceFit: e.modelSpaceFit === "display" ? "display" : "extents",
13
14
  exportLayouts: e.exportLayouts !== !1,
15
+ exportEmptyLayouts: e.exportEmptyLayouts === !0,
14
16
  textMode: e.textMode === "vector" ? "vector" : "text",
15
17
  colorMode: e.colorMode === "monochrome" ? "monochrome" : "color"
16
18
  };
@@ -24,13 +26,13 @@ function D() {
24
26
  async renderMText(r, a, c) {
25
27
  var p, d;
26
28
  try {
27
- const m = await R.getInstance().asyncRenderMText(
29
+ const m = await C.getInstance().asyncRenderMText(
28
30
  // AcGi and mtext-renderer attachment enums are structurally compatible
29
31
  // at runtime but diverge in the TypeScript type graph.
30
32
  { ...r, meshGlyphOutputMode: "merge" },
31
33
  a,
32
34
  _(c)
33
- ), h = r.contents || r.text || "", { primitives: b, colorGroups: F, box: O } = k(
35
+ ), h = r.contents || r.text || "", { primitives: b, colorGroups: F, box: O } = R(
34
36
  m,
35
37
  ((p = r.position) == null ? void 0 : p.x) ?? 0,
36
38
  ((d = r.position) == null ? void 0 : d.y) ?? 0
@@ -47,10 +49,10 @@ function D() {
47
49
  async renderShape(r, a) {
48
50
  var c, p;
49
51
  try {
50
- const x = await R.getInstance().asyncRenderShape(
52
+ const x = await C.getInstance().asyncRenderShape(
51
53
  r,
52
54
  a ?? {}
53
- ), { primitives: m, box: h } = k(
55
+ ), { primitives: m, box: h } = R(
54
56
  x,
55
57
  ((c = r.position) == null ? void 0 : c.x) ?? 0,
56
58
  ((p = r.position) == null ? void 0 : p.y) ?? 0
@@ -76,19 +78,19 @@ function _(e) {
76
78
  layer: e.layer
77
79
  };
78
80
  }
79
- function k(e, n, r) {
80
- var B;
81
- (B = e.updateMatrixWorld) == null || B.call(e, !0);
81
+ function R(e, n, r) {
82
+ var P;
83
+ (P = e.updateMatrixWorld) == null || P.call(e, !0);
82
84
  const a = [], c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
83
85
  e.traverse((t) => {
84
- var v, y;
86
+ var v, f;
85
87
  const o = t.geometry;
86
88
  if (!o)
87
89
  return;
88
90
  const s = o.getAttribute("position");
89
91
  if (!s || s.count < 1)
90
92
  return;
91
- const f = z(t) ?? 16777215;
93
+ const y = z(t) ?? 16777215;
92
94
  if (t.isMesh) {
93
95
  const i = o.getIndex(), l = i ? i.count / 3 : Math.floor(s.count / 3);
94
96
  if (l < 1)
@@ -99,25 +101,25 @@ function k(e, n, r) {
99
101
  index: i,
100
102
  isMesh: !0,
101
103
  isSegments: !1,
102
- rgb: f
104
+ rgb: y
103
105
  }), c.set(
104
- f,
105
- (c.get(f) ?? 0) + l * 6
106
+ y,
107
+ (c.get(y) ?? 0) + l * 6
106
108
  );
107
109
  return;
108
110
  }
109
111
  if (t.isLine) {
110
112
  const i = !!t.isLineSegments;
111
113
  a.push({
112
- elements: (y = t.matrixWorld) == null ? void 0 : y.elements,
114
+ elements: (f = t.matrixWorld) == null ? void 0 : f.elements,
113
115
  pos: s,
114
116
  index: null,
115
117
  isMesh: !1,
116
118
  isSegments: i,
117
- rgb: f
119
+ rgb: y
118
120
  });
119
121
  const l = i ? Math.floor(s.count / 2) * 5 : s.count * 2 + 1;
120
- p.set(f, (p.get(f) ?? 0) + l);
122
+ p.set(y, (p.get(y) ?? 0) + l);
121
123
  }
122
124
  });
123
125
  const d = [
@@ -137,26 +139,26 @@ function k(e, n, r) {
137
139
  for (const t of a) {
138
140
  const o = x.get(t.rgb);
139
141
  if (!o) continue;
140
- const s = t.elements, f = t.pos, v = (y) => {
141
- const i = f.getX(y), l = f.getY(y);
142
+ const s = t.elements, y = t.pos, v = (f) => {
143
+ const i = y.getX(f), l = y.getY(f);
142
144
  if (!s)
143
145
  return { x: i, y: l };
144
- const u = f.getZ(y), g = s[3] * i + s[7] * l + s[11] * u + s[15], M = g === 0 ? 1 : 1 / g;
146
+ const u = y.getZ(f), g = s[3] * i + s[7] * l + s[11] * u + s[15], M = g === 0 ? 1 : 1 / g;
145
147
  return {
146
148
  x: (s[0] * i + s[4] * l + s[8] * u + s[12]) * M,
147
149
  y: (s[1] * i + s[5] * l + s[9] * u + s[13]) * M
148
150
  };
149
151
  };
150
152
  if (t.isMesh) {
151
- const y = t.index ? t.index.count / 3 : Math.floor(f.count / 3);
152
- for (let i = 0; i < y; i++)
153
+ const f = t.index ? t.index.count / 3 : Math.floor(y.count / 3);
154
+ for (let i = 0; i < f; i++)
153
155
  for (let l = 0; l < 3; l++) {
154
- const u = t.index ? t.index.getX(i * 3 + l) : i * 3 + l, g = v(u), M = g.x - n, C = g.y - r;
155
- o.triangles[o.triOffset++] = M, o.triangles[o.triOffset++] = C, O(M, C);
156
+ const u = t.index ? t.index.getX(i * 3 + l) : i * 3 + l, g = v(u), M = g.x - n, B = g.y - r;
157
+ o.triangles[o.triOffset++] = M, o.triangles[o.triOffset++] = B, O(M, B);
156
158
  }
157
159
  } else if (t.isSegments) {
158
- const y = Math.floor(f.count / 2);
159
- for (let i = 0; i < y; i++) {
160
+ const f = Math.floor(y.count / 2);
161
+ for (let i = 0; i < f; i++) {
160
162
  o.polylines[o.lineOffset++] = 2;
161
163
  for (let l = 0; l < 2; l++) {
162
164
  const u = v(i * 2 + l), g = u.x - n, M = u.y - r;
@@ -164,29 +166,29 @@ function k(e, n, r) {
164
166
  }
165
167
  }
166
168
  } else {
167
- o.polylines[o.lineOffset++] = f.count;
168
- for (let y = 0; y < f.count; y++) {
169
- const i = v(y), l = i.x - n, u = i.y - r;
169
+ o.polylines[o.lineOffset++] = y.count;
170
+ for (let f = 0; f < y.count; f++) {
171
+ const i = v(f), l = i.x - n, u = i.y - r;
170
172
  o.polylines[o.lineOffset++] = l, o.polylines[o.lineOffset++] = u, O(l, u);
171
173
  }
172
174
  }
173
175
  }
174
176
  const w = [];
175
- let S = 0, T = 0;
177
+ let S = 0, L = 0;
176
178
  for (const [t, o] of x) {
177
179
  const s = {
178
180
  triangles: o.triangles,
179
181
  polylines: o.polylines
180
182
  };
181
- (s.triangles.length >= 6 || s.polylines.length >= 2) && w.push({ rgb: t, primitives: s }), S += o.triangles.length, T += o.polylines.length;
183
+ (s.triangles.length >= 6 || s.polylines.length >= 2) && w.push({ rgb: t, primitives: s }), S += o.triangles.length, L += o.polylines.length;
182
184
  }
183
- const A = new Float32Array(S), I = new Float32Array(T);
184
- let L = 0, P = 0;
185
+ const T = new Float32Array(S), A = new Float32Array(L);
186
+ let E = 0, I = 0;
185
187
  for (const t of w)
186
- A.set(t.primitives.triangles, L), L += t.primitives.triangles.length, I.set(t.primitives.polylines, P), P += t.primitives.polylines.length;
187
- const E = { triangles: A, polylines: I }, G = Number.isFinite(m) ? { min: { x: m, y: h }, max: { x: b, y: F } } : { min: { x: 0, y: 0 }, max: { x: 0, y: 0 } };
188
+ T.set(t.primitives.triangles, E), E += t.primitives.triangles.length, A.set(t.primitives.polylines, I), I += t.primitives.polylines.length;
189
+ const k = { triangles: T, polylines: A }, G = Number.isFinite(m) ? { min: { x: m, y: h }, max: { x: b, y: F } } : { min: { x: 0, y: 0 }, max: { x: 0, y: 0 } };
188
190
  return {
189
- primitives: E,
191
+ primitives: k,
190
192
  // Always surface groups when present so a lone `\C256` green run is not
191
193
  // painted with the entity fill (often ACI 7 white).
192
194
  colorGroups: w.length > 0 ? w : void 0,
@@ -211,6 +213,7 @@ function H(e, n = {}) {
211
213
  background: "none",
212
214
  fit: r.modelSpaceFit === "display" ? "current" : "extents",
213
215
  layouts: r.exportLayouts ? "all" : "current",
216
+ exportEmptyLayouts: r.exportEmptyLayouts,
214
217
  glyphProvider: n.glyphProvider ?? D(),
215
218
  textMode: r.textMode,
216
219
  colorMode: r.colorMode
@@ -1 +1 @@
1
- (function(y,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("@mlightcad/pdf-renderer"),require("@mlightcad/mtext-parser"),require("@mlightcad/three-renderer")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/pdf-renderer","@mlightcad/mtext-parser","@mlightcad/three-renderer"],O):(y=typeof globalThis<"u"?globalThis:y||self,O(y["cad-pdf-core"]={},y.pdfRenderer,y.mtextParser,y.threeRenderer))})(this,(function(y,O,_,w){"use strict";const W=Object.freeze({modelSpaceFit:"extents",exportLayouts:!0,textMode:"text",colorMode:"color"});function A(e={}){return{modelSpaceFit:e.modelSpaceFit==="display"?"display":"extents",exportLayouts:e.exportLayouts!==!1,textMode:e.textMode==="vector"?"vector":"text",colorMode:e.colorMode==="monochrome"?"monochrome":"color"}}function R(){const e={triangles:new Float32Array(0),polylines:new Float32Array(0)},n={min:{x:0,y:0},max:{x:0,y:0}};return{async renderMText(r,a,c){var d,g;try{const m=await w.AcTrMTextRenderer.getInstance().asyncRenderMText({...r,meshGlyphOutputMode:"merge"},a,q(c)),v=r.contents||r.text||"",{primitives:T,colorGroups:P,box:F}=C(m,((d=r.position)==null?void 0:d.x)??0,((g=r.position)==null?void 0:g.y)??0);return{primitives:T,colorGroups:P,actualText:v,box:F}}catch(x){const m=r.contents||r.text||"";return console.warn("[cad-pdf-core] MTEXT glyph render failed; vector geometry omitted",x instanceof Error?x.message:x),{primitives:e,actualText:m,box:n}}},async renderShape(r,a){var c,d;try{const x=await w.AcTrMTextRenderer.getInstance().asyncRenderShape(r,a??{}),{primitives:m,box:v}=C(x,((c=r.position)==null?void 0:c.x)??0,((d=r.position)==null?void 0:d.y)??0);return{primitives:m,box:v}}catch(g){return console.warn("[cad-pdf-core] SHAPE glyph render failed; vector geometry omitted",g instanceof Error?g.message:g),{primitives:e,box:n}}}}}function q(e){if(!e)return;const n=new _.MTextColor;return e.entityIsByLayer?n.aci=256:e.entityIsByBlock?n.aci=0:e.entityIsForeground?n.aci=7:typeof e.entityAci=="number"?n.aci=e.entityAci:typeof e.entityRgb=="number"?n.rgbValue=e.entityRgb:n.aci=7,{color:n,byLayerColor:e.byLayerColor,byBlockColor:e.byBlockColor,layer:e.layer}}function C(e,n,r){var X;(X=e.updateMatrixWorld)==null||X.call(e,!0);const a=[],c=new Map,d=new Map;e.traverse(t=>{var b,p;const o=t.geometry;if(!o)return;const i=o.getAttribute("position");if(!i||i.count<1)return;const f=N(t)??16777215;if(t.isMesh){const s=o.getIndex(),l=s?s.count/3:Math.floor(i.count/3);if(l<1)return;a.push({elements:(b=t.matrixWorld)==null?void 0:b.elements,pos:i,index:s,isMesh:!0,isSegments:!1,rgb:f}),c.set(f,(c.get(f)??0)+l*6);return}if(t.isLine){const s=!!t.isLineSegments;a.push({elements:(p=t.matrixWorld)==null?void 0:p.elements,pos:i,index:null,isMesh:!1,isSegments:s,rgb:f});const l=s?Math.floor(i.count/2)*5:i.count*2+1;d.set(f,(d.get(f)??0)+l)}});const g=[...new Set([...c.keys(),...d.keys()])],x=new Map;for(const t of g)x.set(t,{triangles:new Float32Array(c.get(t)??0),polylines:new Float32Array(d.get(t)??0),triOffset:0,lineOffset:0});let m=1/0,v=1/0,T=-1/0,P=-1/0;const F=(t,o)=>{t<m&&(m=t),o<v&&(v=o),t>T&&(T=t),o>P&&(P=o)};for(const t of a){const o=x.get(t.rgb);if(!o)continue;const i=t.elements,f=t.pos,b=p=>{const s=f.getX(p),l=f.getY(p);if(!i)return{x:s,y:l};const u=f.getZ(p),h=i[3]*s+i[7]*l+i[11]*u+i[15],M=h===0?1:1/h;return{x:(i[0]*s+i[4]*l+i[8]*u+i[12])*M,y:(i[1]*s+i[5]*l+i[9]*u+i[13])*M}};if(t.isMesh){const p=t.index?t.index.count/3:Math.floor(f.count/3);for(let s=0;s<p;s++)for(let l=0;l<3;l++){const u=t.index?t.index.getX(s*3+l):s*3+l,h=b(u),M=h.x-n,j=h.y-r;o.triangles[o.triOffset++]=M,o.triangles[o.triOffset++]=j,F(M,j)}}else if(t.isSegments){const p=Math.floor(f.count/2);for(let s=0;s<p;s++){o.polylines[o.lineOffset++]=2;for(let l=0;l<2;l++){const u=b(s*2+l),h=u.x-n,M=u.y-r;o.polylines[o.lineOffset++]=h,o.polylines[o.lineOffset++]=M,F(h,M)}}}else{o.polylines[o.lineOffset++]=f.count;for(let p=0;p<f.count;p++){const s=b(p),l=s.x-n,u=s.y-r;o.polylines[o.lineOffset++]=l,o.polylines[o.lineOffset++]=u,F(l,u)}}}const S=[];let I=0,L=0;for(const[t,o]of x){const i={triangles:o.triangles,polylines:o.polylines};(i.triangles.length>=6||i.polylines.length>=2)&&S.push({rgb:t,primitives:i}),I+=o.triangles.length,L+=o.polylines.length}const B=new Float32Array(I),k=new Float32Array(L);let D=0,G=0;for(const t of S)B.set(t.primitives.triangles,D),D+=t.primitives.triangles.length,k.set(t.primitives.polylines,G),G+=t.primitives.polylines.length;const H={triangles:B,polylines:k},U=Number.isFinite(m)?{min:{x:m,y:v},max:{x:T,y:P}}:{min:{x:0,y:0},max:{x:0,y:0}};return{primitives:H,colorGroups:S.length>0?S:void 0,box:U}}function N(e){var c,d;const n=e.material;if(!n)return;const r=Array.isArray(n)?n[0]:n,a=(d=(c=r==null?void 0:r.color)==null?void 0:c.getHex)==null?void 0:d.call(c);return typeof a=="number"?a:void 0}function E(e,n={}){const r=A(n),a={title:n.title,ltscale:e.ltscale,celtscale:e.celtscale,showLineWeight:!!e.lwdisplay,fontMapping:n.fontMapping,background:"none",fit:r.modelSpaceFit==="display"?"current":"extents",layouts:r.exportLayouts?"all":"current",glyphProvider:n.glyphProvider??R(),textMode:r.textMode,colorMode:r.colorMode};return r.textMode==="text"&&n.textFontResolver&&(a.textFontResolver=n.textFontResolver),r.modelSpaceFit==="display"&&n.displayBox&&(e.currentSpaceId===e.tables.blockTable.modelSpace.objectId||!r.exportLayouts)&&(a.fitBox=n.displayBox),a}async function z(e,n={}){return O.exportDatabaseToPdf(e,E(e,n))}y.ACEXPDF_DEFAULT_EXPORT_OPTIONS=W,y.acexPdfBuildRendererOptions=E,y.acexPdfCreateGlyphProvider=R,y.acexPdfExportDatabase=z,y.acexPdfResolveExportOptions=A,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(y,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("@mlightcad/pdf-renderer"),require("@mlightcad/mtext-parser"),require("@mlightcad/three-renderer")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/pdf-renderer","@mlightcad/mtext-parser","@mlightcad/three-renderer"],O):(y=typeof globalThis<"u"?globalThis:y||self,O(y["cad-pdf-core"]={},y.pdfRenderer,y.mtextParser,y.threeRenderer))})(this,(function(y,O,_,w){"use strict";const W=Object.freeze({modelSpaceFit:"extents",exportLayouts:!0,exportEmptyLayouts:!1,textMode:"text",colorMode:"color"});function E(e={}){return{modelSpaceFit:e.modelSpaceFit==="display"?"display":"extents",exportLayouts:e.exportLayouts!==!1,exportEmptyLayouts:e.exportEmptyLayouts===!0,textMode:e.textMode==="vector"?"vector":"text",colorMode:e.colorMode==="monochrome"?"monochrome":"color"}}function L(){const e={triangles:new Float32Array(0),polylines:new Float32Array(0)},r={min:{x:0,y:0},max:{x:0,y:0}};return{async renderMText(n,a,c){var d,g;try{const m=await w.AcTrMTextRenderer.getInstance().asyncRenderMText({...n,meshGlyphOutputMode:"merge"},a,q(c)),v=n.contents||n.text||"",{primitives:T,colorGroups:P,box:F}=A(m,((d=n.position)==null?void 0:d.x)??0,((g=n.position)==null?void 0:g.y)??0);return{primitives:T,colorGroups:P,actualText:v,box:F}}catch(x){const m=n.contents||n.text||"";return console.warn("[cad-pdf-core] MTEXT glyph render failed; vector geometry omitted",x instanceof Error?x.message:x),{primitives:e,actualText:m,box:r}}},async renderShape(n,a){var c,d;try{const x=await w.AcTrMTextRenderer.getInstance().asyncRenderShape(n,a??{}),{primitives:m,box:v}=A(x,((c=n.position)==null?void 0:c.x)??0,((d=n.position)==null?void 0:d.y)??0);return{primitives:m,box:v}}catch(g){return console.warn("[cad-pdf-core] SHAPE glyph render failed; vector geometry omitted",g instanceof Error?g.message:g),{primitives:e,box:r}}}}}function q(e){if(!e)return;const r=new _.MTextColor;return e.entityIsByLayer?r.aci=256:e.entityIsByBlock?r.aci=0:e.entityIsForeground?r.aci=7:typeof e.entityAci=="number"?r.aci=e.entityAci:typeof e.entityRgb=="number"?r.rgbValue=e.entityRgb:r.aci=7,{color:r,byLayerColor:e.byLayerColor,byBlockColor:e.byBlockColor,layer:e.layer}}function A(e,r,n){var X;(X=e.updateMatrixWorld)==null||X.call(e,!0);const a=[],c=new Map,d=new Map;e.traverse(t=>{var b,p;const o=t.geometry;if(!o)return;const s=o.getAttribute("position");if(!s||s.count<1)return;const f=N(t)??16777215;if(t.isMesh){const i=o.getIndex(),l=i?i.count/3:Math.floor(s.count/3);if(l<1)return;a.push({elements:(b=t.matrixWorld)==null?void 0:b.elements,pos:s,index:i,isMesh:!0,isSegments:!1,rgb:f}),c.set(f,(c.get(f)??0)+l*6);return}if(t.isLine){const i=!!t.isLineSegments;a.push({elements:(p=t.matrixWorld)==null?void 0:p.elements,pos:s,index:null,isMesh:!1,isSegments:i,rgb:f});const l=i?Math.floor(s.count/2)*5:s.count*2+1;d.set(f,(d.get(f)??0)+l)}});const g=[...new Set([...c.keys(),...d.keys()])],x=new Map;for(const t of g)x.set(t,{triangles:new Float32Array(c.get(t)??0),polylines:new Float32Array(d.get(t)??0),triOffset:0,lineOffset:0});let m=1/0,v=1/0,T=-1/0,P=-1/0;const F=(t,o)=>{t<m&&(m=t),o<v&&(v=o),t>T&&(T=t),o>P&&(P=o)};for(const t of a){const o=x.get(t.rgb);if(!o)continue;const s=t.elements,f=t.pos,b=p=>{const i=f.getX(p),l=f.getY(p);if(!s)return{x:i,y:l};const u=f.getZ(p),h=s[3]*i+s[7]*l+s[11]*u+s[15],M=h===0?1:1/h;return{x:(s[0]*i+s[4]*l+s[8]*u+s[12])*M,y:(s[1]*i+s[5]*l+s[9]*u+s[13])*M}};if(t.isMesh){const p=t.index?t.index.count/3:Math.floor(f.count/3);for(let i=0;i<p;i++)for(let l=0;l<3;l++){const u=t.index?t.index.getX(i*3+l):i*3+l,h=b(u),M=h.x-r,j=h.y-n;o.triangles[o.triOffset++]=M,o.triangles[o.triOffset++]=j,F(M,j)}}else if(t.isSegments){const p=Math.floor(f.count/2);for(let i=0;i<p;i++){o.polylines[o.lineOffset++]=2;for(let l=0;l<2;l++){const u=b(i*2+l),h=u.x-r,M=u.y-n;o.polylines[o.lineOffset++]=h,o.polylines[o.lineOffset++]=M,F(h,M)}}}else{o.polylines[o.lineOffset++]=f.count;for(let p=0;p<f.count;p++){const i=b(p),l=i.x-r,u=i.y-n;o.polylines[o.lineOffset++]=l,o.polylines[o.lineOffset++]=u,F(l,u)}}}const S=[];let C=0,I=0;for(const[t,o]of x){const s={triangles:o.triangles,polylines:o.polylines};(s.triangles.length>=6||s.polylines.length>=2)&&S.push({rgb:t,primitives:s}),C+=o.triangles.length,I+=o.polylines.length}const B=new Float32Array(C),k=new Float32Array(I);let D=0,G=0;for(const t of S)B.set(t.primitives.triangles,D),D+=t.primitives.triangles.length,k.set(t.primitives.polylines,G),G+=t.primitives.polylines.length;const H={triangles:B,polylines:k},U=Number.isFinite(m)?{min:{x:m,y:v},max:{x:T,y:P}}:{min:{x:0,y:0},max:{x:0,y:0}};return{primitives:H,colorGroups:S.length>0?S:void 0,box:U}}function N(e){var c,d;const r=e.material;if(!r)return;const n=Array.isArray(r)?r[0]:r,a=(d=(c=n==null?void 0:n.color)==null?void 0:c.getHex)==null?void 0:d.call(c);return typeof a=="number"?a:void 0}function R(e,r={}){const n=E(r),a={title:r.title,ltscale:e.ltscale,celtscale:e.celtscale,showLineWeight:!!e.lwdisplay,fontMapping:r.fontMapping,background:"none",fit:n.modelSpaceFit==="display"?"current":"extents",layouts:n.exportLayouts?"all":"current",exportEmptyLayouts:n.exportEmptyLayouts,glyphProvider:r.glyphProvider??L(),textMode:n.textMode,colorMode:n.colorMode};return n.textMode==="text"&&r.textFontResolver&&(a.textFontResolver=r.textFontResolver),n.modelSpaceFit==="display"&&r.displayBox&&(e.currentSpaceId===e.tables.blockTable.modelSpace.objectId||!n.exportLayouts)&&(a.fitBox=r.displayBox),a}async function z(e,r={}){return O.exportDatabaseToPdf(e,R(e,r))}y.ACEXPDF_DEFAULT_EXPORT_OPTIONS=W,y.acexPdfBuildRendererOptions=R,y.acexPdfCreateGlyphProvider=L,y.acexPdfExportDatabase=z,y.acexPdfResolveExportOptions=E,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- {"version":3,"file":"AcExPdfDatabaseExport.d.ts","sourceRoot":"","sources":["../src/AcExPdfDatabaseExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE3B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,wB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C,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7B,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAA;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;CACzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,YAAY,EAChB,OAAO,GAAE,4BAAiC,GACzC,kBAAkB,CAiCpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,YAAY,EAChB,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,UAAU,CAAC,CAErB"}
@@ -61,6 +61,7 @@ export function acexPdfBuildRendererOptions(db, options) {
61
61
  background: 'none',
62
62
  fit: resolved.modelSpaceFit === 'display' ? 'current' : 'extents',
63
63
  layouts: resolved.exportLayouts ? 'all' : 'current',
64
+ exportEmptyLayouts: resolved.exportEmptyLayouts,
64
65
  glyphProvider: (_a = options.glyphProvider) !== null && _a !== void 0 ? _a : acexPdfCreateGlyphProvider(),
65
66
  textMode: resolved.textMode,
66
67
  colorMode: resolved.colorMode
@@ -1 +1 @@
1
- {"version":3,"file":"AcExPdfDatabaseExport.js","sourceRoot":"","sources":["../src/AcExPdfDatabaseExport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAIL,mBAAmB,EACpB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAEL,2BAA2B,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AC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QACnD,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,aAAa,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,0BAA0B,EAAE;QACpE,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAA;IACD,IAAI,QAAQ,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7D,UAAU,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAA;IACxD,CAAC;IAED,IAAI,QAAQ,CAAC,aAAa,KAAK,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QAC/D,oEAAoE;QACpE,uEAAuE;QACvE,wEAAwE;QACxE,oEAAoE;QACpE,qEAAqE;QACrE,IAAM,YAAY,GAChB,EAAE,CAAC,cAAc,KAAK,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAA;QAChE,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC5C,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAA;QACxC,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAgB,qBAAqB;wDACzC,EAAgB,EAChB,OAA0C;QAA1C,wBAAA,EAAA,YAA0C;;YAE1C,sBAAO,mBAAmB,CAAC,EAAE,EAAE,2BAA2B,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAA;;;CACzE"}
@@ -38,6 +38,13 @@ export interface AcExPdfExportOptions {
38
38
  * When `false`, only the current space is exported. Defaults to `true`.
39
39
  */
40
40
  exportLayouts?: boolean;
41
+ /**
42
+ * When `true`, empty paper-space layouts (no entities other than the
43
+ * default `*Paper_Space` viewport) are still exported as blank pages.
44
+ * When `false` (default), those layouts are skipped. Model space is
45
+ * always kept when {@link AcExPdfExportOptions.exportLayouts} is `true`.
46
+ */
47
+ exportEmptyLayouts?: boolean;
41
48
  /** How MTEXT/TEXT are painted. Defaults to `'text'`. */
42
49
  textMode?: AcExPdfTextMode;
43
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AcExPdfExportOptions.d.ts","sourceRoot":"","sources":["../src/AcExPdfExportOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,CAAA;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAA;AAE7C;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAED,kCAAkC;AAClC,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACnD,QAAQ,CAAC,oBAAoB,CAAC,CAM9B,CAAA;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,oBAAyB,GACjC,QAAQ,CAAC,oBAAoB,CAAC,CAOhC"}
1
+ {"version":3,"file":"AcExPdfExportOptions.d.ts","sourceRoot":"","sources":["../src/AcExPdfExportOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,CAAA;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAA;AAE7C;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAED,kCAAkC;AAClC,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACnD,QAAQ,CAAC,oBAAoB,CAAC,CAO9B,CAAA;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,oBAAyB,GACjC,QAAQ,CAAC,oBAAoB,CAAC,CAQhC"}
@@ -2,6 +2,7 @@
2
2
  export var ACEXPDF_DEFAULT_EXPORT_OPTIONS = Object.freeze({
3
3
  modelSpaceFit: 'extents',
4
4
  exportLayouts: true,
5
+ exportEmptyLayouts: false,
5
6
  textMode: 'text',
6
7
  colorMode: 'color'
7
8
  });
@@ -17,6 +18,7 @@ export function acexPdfResolveExportOptions(options) {
17
18
  return {
18
19
  modelSpaceFit: options.modelSpaceFit === 'display' ? 'display' : 'extents',
19
20
  exportLayouts: options.exportLayouts !== false,
21
+ exportEmptyLayouts: options.exportEmptyLayouts === true,
20
22
  textMode: options.textMode === 'vector' ? 'vector' : 'text',
21
23
  colorMode: options.colorMode === 'monochrome' ? 'monochrome' : 'color'
22
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AcExPdfExportOptions.js","sourceRoot":"","sources":["../src/AcExPdfExportOptions.ts"],"names":[],"mappings":"AAsDA,kCAAkC;AAClC,MAAM,CAAC,IAA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AAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;QAC3D,SAAS,EAAE,OAAO,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO;KACvE,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/cad-pdf-core",
3
- "version": "1.8.0-preview.3",
3
+ "version": "1.8.0-preview.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,16 +25,16 @@
25
25
  }
26
26
  },
27
27
  "devDependencies": {
28
- "@mlightcad/data-model": "1.15.22",
28
+ "@mlightcad/data-model": "1.15.29",
29
29
  "@mlightcad/mtext-parser": "1.5.7",
30
- "@mlightcad/pdf-renderer": "1.8.0-preview.3",
31
- "@mlightcad/three-renderer": "1.8.0-preview.3"
30
+ "@mlightcad/three-renderer": "1.8.0-preview.4",
31
+ "@mlightcad/pdf-renderer": "1.8.0-preview.4"
32
32
  },
33
33
  "peerDependencies": {
34
- "@mlightcad/data-model": "1.15.22",
34
+ "@mlightcad/data-model": "1.15.29",
35
35
  "@mlightcad/mtext-parser": "1.5.7",
36
- "@mlightcad/pdf-renderer": "^1.8.0-preview.3",
37
- "@mlightcad/three-renderer": "^1.8.0-preview.3"
36
+ "@mlightcad/pdf-renderer": "^1.8.0-preview.4",
37
+ "@mlightcad/three-renderer": "^1.8.0-preview.4"
38
38
  },
39
39
  "scripts": {
40
40
  "clean": "rimraf dist lib tsconfig.tsbuildinfo",