@mlightcad/cad-pdf-core 1.8.0-preview.3 → 1.8.0-preview.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/dist/cad-pdf-core.js +38 -35
- package/dist/cad-pdf-core.umd.cjs +1 -1
- package/lib/AcExPdfDatabaseExport.d.ts +1 -1
- package/lib/AcExPdfDatabaseExport.d.ts.map +1 -1
- package/lib/AcExPdfDatabaseExport.js +3 -2
- package/lib/AcExPdfDatabaseExport.js.map +1 -1
- package/lib/AcExPdfExportOptions.d.ts +7 -0
- package/lib/AcExPdfExportOptions.d.ts.map +1 -1
- package/lib/AcExPdfExportOptions.js +2 -0
- package/lib/AcExPdfExportOptions.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
package/dist/cad-pdf-core.js
CHANGED
|
@@ -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
|
|
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
|
|
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 } =
|
|
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
|
|
52
|
+
const x = await C.getInstance().asyncRenderShape(
|
|
51
53
|
r,
|
|
52
54
|
a ?? {}
|
|
53
|
-
), { primitives: m, box: h } =
|
|
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
|
|
80
|
-
var
|
|
81
|
-
(
|
|
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,
|
|
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
|
|
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:
|
|
104
|
+
rgb: y
|
|
103
105
|
}), c.set(
|
|
104
|
-
|
|
105
|
-
(c.get(
|
|
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: (
|
|
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:
|
|
119
|
+
rgb: y
|
|
118
120
|
});
|
|
119
121
|
const l = i ? Math.floor(s.count / 2) * 5 : s.count * 2 + 1;
|
|
120
|
-
p.set(
|
|
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,
|
|
141
|
-
const i =
|
|
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 =
|
|
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
|
|
152
|
-
for (let i = 0; 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,
|
|
155
|
-
o.triangles[o.triOffset++] = M, o.triangles[o.triOffset++] =
|
|
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
|
|
159
|
-
for (let i = 0; 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++] =
|
|
168
|
-
for (let
|
|
169
|
-
const i = v(
|
|
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,
|
|
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,
|
|
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
|
|
184
|
-
let
|
|
185
|
+
const T = new Float32Array(S), A = new Float32Array(L);
|
|
186
|
+
let E = 0, I = 0;
|
|
185
187
|
for (const t of w)
|
|
186
|
-
|
|
187
|
-
const
|
|
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:
|
|
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
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import type { AcDbDatabase, AcGiFontMapping } from '@mlightcad/data-model';
|
|
2
2
|
import { type AcPdfExportOptions, type AcPdfGlyphProvider, type AcPdfTextFontResolver } from '@mlightcad/pdf-renderer';
|
|
3
|
-
import { type AcExPdfExportOptions } from './AcExPdfExportOptions';
|
|
3
|
+
import { type AcExPdfExportOptions } from './AcExPdfExportOptions.js';
|
|
4
4
|
/** Axis-aligned WCS box used to frame a model-space page. */
|
|
5
5
|
export interface AcExPdfFitBox {
|
|
6
6
|
min: {
|
|
@@ -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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CAAC,UAAU,CAAC,CAErB"}
|
|
@@ -35,8 +35,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import { exportDatabaseToPdf } from '@mlightcad/pdf-renderer';
|
|
38
|
-
import { acexPdfResolveExportOptions } from './AcExPdfExportOptions';
|
|
39
|
-
import { acexPdfCreateGlyphProvider } from './AcExPdfGlyphProvider';
|
|
38
|
+
import { acexPdfResolveExportOptions } from './AcExPdfExportOptions.js';
|
|
39
|
+
import { acexPdfCreateGlyphProvider } from './AcExPdfGlyphProvider.js';
|
|
40
40
|
/**
|
|
41
41
|
* Builds the low-level `pdf-renderer` options for a drawing.
|
|
42
42
|
*
|
|
@@ -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,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"AcExPdfDatabaseExport.js","sourceRoot":"","sources":["../src/AcExPdfDatabaseExport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAIL,mBAAmB,EACpB,MAAM,yBA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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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gB,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":"
|
|
1
|
+
{"version":3,"file":"AcExPdfExportOptions.js","sourceRoot":"","sources":["../src/AcExPdfExportOptions.ts"],"names":[],"mappings":"AA6DA,kCAAkC;AAClC,MAAM,CAAC,IAAM,8BAA8B,GAEvC,MAAM,CAAC,MAAM,CAAC;IAChB,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,KAAK;IACzB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,OAAO;CACnB,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAkC;IAAlC,wBAAA,EAAA,YAAkC;IAElC,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QAC1E,aAAa,EAAE,OAAO,CAAC,aAAa,KAAK,KAAK;QAC9C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,KAAK,IAAI;QACvD,QAAQ,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/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
export { acexPdfBuildRendererOptions, type AcExPdfDatabaseExportOptions, acexPdfExportDatabase, type AcExPdfFitBox } from './AcExPdfDatabaseExport';
|
|
9
|
-
export { type AcExPdfColorMode, ACEXPDF_DEFAULT_EXPORT_OPTIONS, type AcExPdfExportOptions, type AcExPdfModelSpaceFit, acexPdfResolveExportOptions, type AcExPdfTextMode } from './AcExPdfExportOptions';
|
|
10
|
-
export { acexPdfCreateGlyphProvider } from './AcExPdfGlyphProvider';
|
|
8
|
+
export { acexPdfBuildRendererOptions, type AcExPdfDatabaseExportOptions, acexPdfExportDatabase, type AcExPdfFitBox } from './AcExPdfDatabaseExport.js';
|
|
9
|
+
export { type AcExPdfColorMode, ACEXPDF_DEFAULT_EXPORT_OPTIONS, type AcExPdfExportOptions, type AcExPdfModelSpaceFit, acexPdfResolveExportOptions, type AcExPdfTextMode } from './AcExPdfExportOptions.js';
|
|
10
|
+
export { acexPdfCreateGlyphProvider } from './AcExPdfGlyphProvider.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,KAAK,aAAa,EACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,KAAK,gBAAgB,EACrB,8BAA8B,EAC9B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,2BAA2B,EAC3B,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
export { acexPdfBuildRendererOptions, acexPdfExportDatabase } from './AcExPdfDatabaseExport';
|
|
9
|
-
export { ACEXPDF_DEFAULT_EXPORT_OPTIONS, acexPdfResolveExportOptions } from './AcExPdfExportOptions';
|
|
10
|
-
export { acexPdfCreateGlyphProvider } from './AcExPdfGlyphProvider';
|
|
8
|
+
export { acexPdfBuildRendererOptions, acexPdfExportDatabase } from './AcExPdfDatabaseExport.js';
|
|
9
|
+
export { ACEXPDF_DEFAULT_EXPORT_OPTIONS, acexPdfResolveExportOptions } from './AcExPdfExportOptions.js';
|
|
10
|
+
export { acexPdfCreateGlyphProvider } from './AcExPdfGlyphProvider.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,2BAA2B,EAE3B,qBAAqB,EAEtB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,2BAA2B,EAE3B,qBAAqB,EAEtB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAEL,8BAA8B,EAG9B,2BAA2B,EAE5B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlightcad/cad-pdf-core",
|
|
3
|
-
"version": "1.8.0-preview.
|
|
3
|
+
"version": "1.8.0-preview.5",
|
|
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.
|
|
28
|
+
"@mlightcad/data-model": "1.15.30",
|
|
29
29
|
"@mlightcad/mtext-parser": "1.5.7",
|
|
30
|
-
"@mlightcad/pdf-renderer": "1.8.0-preview.
|
|
31
|
-
"@mlightcad/three-renderer": "1.8.0-preview.
|
|
30
|
+
"@mlightcad/pdf-renderer": "1.8.0-preview.5",
|
|
31
|
+
"@mlightcad/three-renderer": "1.8.0-preview.5"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@mlightcad/data-model": "1.15.
|
|
34
|
+
"@mlightcad/data-model": "1.15.30",
|
|
35
35
|
"@mlightcad/mtext-parser": "1.5.7",
|
|
36
|
-
"@mlightcad/pdf-renderer": "^1.8.0-preview.
|
|
37
|
-
"@mlightcad/three-renderer": "^1.8.0-preview.
|
|
36
|
+
"@mlightcad/pdf-renderer": "^1.8.0-preview.5",
|
|
37
|
+
"@mlightcad/three-renderer": "^1.8.0-preview.5"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"clean": "rimraf dist lib tsconfig.tsbuildinfo",
|