@mlightcad/pdf-renderer 1.7.1
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 +21 -0
- package/README.md +29 -0
- package/dist/index.js +40188 -0
- package/dist/index.umd.cjs +159 -0
- package/lib/AcPdfExport.d.ts +10 -0
- package/lib/AcPdfExport.d.ts.map +1 -0
- package/lib/AcPdfExport.js +354 -0
- package/lib/AcPdfExport.js.map +1 -0
- package/lib/AcPdfExportOptions.d.ts +105 -0
- package/lib/AcPdfExportOptions.d.ts.map +1 -0
- package/lib/AcPdfExportOptions.js +2 -0
- package/lib/AcPdfExportOptions.js.map +1 -0
- package/lib/AcPdfUnits.d.ts +17 -0
- package/lib/AcPdfUnits.d.ts.map +1 -0
- package/lib/AcPdfUnits.js +70 -0
- package/lib/AcPdfUnits.js.map +1 -0
- package/lib/hatch/AcPdfGradient.d.ts +43 -0
- package/lib/hatch/AcPdfGradient.d.ts.map +1 -0
- package/lib/hatch/AcPdfGradient.js +222 -0
- package/lib/hatch/AcPdfGradient.js.map +1 -0
- package/lib/hatch/AcPdfHatchTessellator.d.ts +24 -0
- package/lib/hatch/AcPdfHatchTessellator.d.ts.map +1 -0
- package/lib/hatch/AcPdfHatchTessellator.js +362 -0
- package/lib/hatch/AcPdfHatchTessellator.js.map +1 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/linetype/AcPdfLineTypeStroker.d.ts +36 -0
- package/lib/linetype/AcPdfLineTypeStroker.d.ts.map +1 -0
- package/lib/linetype/AcPdfLineTypeStroker.js +160 -0
- package/lib/linetype/AcPdfLineTypeStroker.js.map +1 -0
- package/lib/pdf/AcPdfContentWriter.d.ts +197 -0
- package/lib/pdf/AcPdfContentWriter.d.ts.map +1 -0
- package/lib/pdf/AcPdfContentWriter.js +977 -0
- package/lib/pdf/AcPdfContentWriter.js.map +1 -0
- package/lib/pdf/AcPdfDocumentWriter.d.ts +66 -0
- package/lib/pdf/AcPdfDocumentWriter.d.ts.map +1 -0
- package/lib/pdf/AcPdfDocumentWriter.js +360 -0
- package/lib/pdf/AcPdfDocumentWriter.js.map +1 -0
- package/lib/pdf/AcPdfEffectiveLayer.d.ts +7 -0
- package/lib/pdf/AcPdfEffectiveLayer.d.ts.map +1 -0
- package/lib/pdf/AcPdfEffectiveLayer.js +13 -0
- package/lib/pdf/AcPdfEffectiveLayer.js.map +1 -0
- package/lib/pdf/AcPdfFontManager.d.ts +95 -0
- package/lib/pdf/AcPdfFontManager.d.ts.map +1 -0
- package/lib/pdf/AcPdfFontManager.js +517 -0
- package/lib/pdf/AcPdfFontManager.js.map +1 -0
- package/lib/pdf/AcPdfMarkedContent.d.ts +14 -0
- package/lib/pdf/AcPdfMarkedContent.d.ts.map +1 -0
- package/lib/pdf/AcPdfMarkedContent.js +28 -0
- package/lib/pdf/AcPdfMarkedContent.js.map +1 -0
- package/lib/pdf/AcPdfOcgManager.d.ts +20 -0
- package/lib/pdf/AcPdfOcgManager.d.ts.map +1 -0
- package/lib/pdf/AcPdfOcgManager.js +147 -0
- package/lib/pdf/AcPdfOcgManager.js.map +1 -0
- package/lib/pdf/AcPdfPageLayout.d.ts +47 -0
- package/lib/pdf/AcPdfPageLayout.d.ts.map +1 -0
- package/lib/pdf/AcPdfPageLayout.js +79 -0
- package/lib/pdf/AcPdfPageLayout.js.map +1 -0
- package/lib/renderer/AcPdfEntity.d.ts +96 -0
- package/lib/renderer/AcPdfEntity.d.ts.map +1 -0
- package/lib/renderer/AcPdfEntity.js +661 -0
- package/lib/renderer/AcPdfEntity.js.map +1 -0
- package/lib/renderer/AcPdfGroup.d.ts +9 -0
- package/lib/renderer/AcPdfGroup.d.ts.map +1 -0
- package/lib/renderer/AcPdfGroup.js +65 -0
- package/lib/renderer/AcPdfGroup.js.map +1 -0
- package/lib/renderer/AcPdfMTextParser.d.ts +46 -0
- package/lib/renderer/AcPdfMTextParser.d.ts.map +1 -0
- package/lib/renderer/AcPdfMTextParser.js +225 -0
- package/lib/renderer/AcPdfMTextParser.js.map +1 -0
- package/lib/renderer/AcPdfMatrixUtil.d.ts +23 -0
- package/lib/renderer/AcPdfMatrixUtil.d.ts.map +1 -0
- package/lib/renderer/AcPdfMatrixUtil.js +85 -0
- package/lib/renderer/AcPdfMatrixUtil.js.map +1 -0
- package/lib/renderer/AcPdfRenderer.d.ts +139 -0
- package/lib/renderer/AcPdfRenderer.d.ts.map +1 -0
- package/lib/renderer/AcPdfRenderer.js +1188 -0
- package/lib/renderer/AcPdfRenderer.js.map +1 -0
- package/lib/renderer/AcPdfStyle.d.ts +132 -0
- package/lib/renderer/AcPdfStyle.d.ts.map +1 -0
- package/lib/renderer/AcPdfStyle.js +8 -0
- package/lib/renderer/AcPdfStyle.js.map +1 -0
- package/lib/renderer/AcPdfStyleUtil.d.ts +49 -0
- package/lib/renderer/AcPdfStyleUtil.d.ts.map +1 -0
- package/lib/renderer/AcPdfStyleUtil.js +140 -0
- package/lib/renderer/AcPdfStyleUtil.js.map +1 -0
- package/lib/renderer/AcPdfTextLayout.d.ts +103 -0
- package/lib/renderer/AcPdfTextLayout.d.ts.map +1 -0
- package/lib/renderer/AcPdfTextLayout.js +539 -0
- package/lib/renderer/AcPdfTextLayout.js.map +1 -0
- package/lib/text/AcPdfGlyphProvider.d.ts +52 -0
- package/lib/text/AcPdfGlyphProvider.d.ts.map +1 -0
- package/lib/text/AcPdfGlyphProvider.js +2 -0
- package/lib/text/AcPdfGlyphProvider.js.map +1 -0
- package/lib/viewport/AcPdfPaperSpaceExport.d.ts +28 -0
- package/lib/viewport/AcPdfPaperSpaceExport.d.ts.map +1 -0
- package/lib/viewport/AcPdfPaperSpaceExport.js +129 -0
- package/lib/viewport/AcPdfPaperSpaceExport.js.map +1 -0
- package/lib/viewport/AcPdfPaperViewport.d.ts +42 -0
- package/lib/viewport/AcPdfPaperViewport.d.ts.map +1 -0
- package/lib/viewport/AcPdfPaperViewport.js +80 -0
- package/lib/viewport/AcPdfPaperViewport.js.map +1 -0
- package/lib/viewport/AcPdfViewportContent.d.ts +37 -0
- package/lib/viewport/AcPdfViewportContent.d.ts.map +1 -0
- package/lib/viewport/AcPdfViewportContent.js +163 -0
- package/lib/viewport/AcPdfViewportContent.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AcDbDatabase } from '@mlightcad/data-model';
|
|
2
|
+
import type { AcPdfExportOptions } from './AcPdfExportOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a drawing database to a vector PDF.
|
|
5
|
+
*
|
|
6
|
+
* Walks the requested block (model space by default) through
|
|
7
|
+
* {@link AcPdfRenderer} and serializes the recorded drawables with pdf-lib.
|
|
8
|
+
*/
|
|
9
|
+
export declare function exportDatabaseToPdf(db: AcDbDatabase, options?: AcPdfExportOptions): Promise<Uint8Array>;
|
|
10
|
+
//# sourceMappingURL=AcPdfExport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfExport.d.ts","sourceRoot":"","sources":["../src/AcPdfExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAIb,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAc9D;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,YAAY,EAChB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CAwBrB"}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
38
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
39
|
+
if (!m) return o;
|
|
40
|
+
var i = m.call(o), r, ar = [], e;
|
|
41
|
+
try {
|
|
42
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
43
|
+
}
|
|
44
|
+
catch (error) { e = { error: error }; }
|
|
45
|
+
finally {
|
|
46
|
+
try {
|
|
47
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
48
|
+
}
|
|
49
|
+
finally { if (e) throw e.error; }
|
|
50
|
+
}
|
|
51
|
+
return ar;
|
|
52
|
+
};
|
|
53
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
54
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
55
|
+
if (ar || !(i in from)) {
|
|
56
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
57
|
+
ar[i] = from[i];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
61
|
+
};
|
|
62
|
+
var __values = (this && this.__values) || function(o) {
|
|
63
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
64
|
+
if (m) return m.call(o);
|
|
65
|
+
if (o && typeof o.length === "number") return {
|
|
66
|
+
next: function () {
|
|
67
|
+
if (o && i >= o.length) o = void 0;
|
|
68
|
+
return { value: o && o[i++], done: !o };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
72
|
+
};
|
|
73
|
+
import { accmYieldForPaint, AcDbRenderingCache, AcDbViewport, acgiIsLightBackground } from '@mlightcad/data-model';
|
|
74
|
+
import { PDFDocument } from 'pdf-lib';
|
|
75
|
+
import { createPdfFormRegistry } from './pdf/AcPdfContentWriter';
|
|
76
|
+
import { AcPdfFontManager } from './pdf/AcPdfFontManager';
|
|
77
|
+
import { AcPdfOcgManager } from './pdf/AcPdfOcgManager';
|
|
78
|
+
import { AcPdfEntity } from './renderer/AcPdfEntity';
|
|
79
|
+
import { AcPdfRenderer } from './renderer/AcPdfRenderer';
|
|
80
|
+
import { attachPdfEntityMeta, buildViewportModelContent, collectModelSpaceRoots, isPaperSpaceBlock } from './viewport/AcPdfPaperSpaceExport';
|
|
81
|
+
/**
|
|
82
|
+
* Renders a drawing database to a vector PDF.
|
|
83
|
+
*
|
|
84
|
+
* Walks the requested block (model space by default) through
|
|
85
|
+
* {@link AcPdfRenderer} and serializes the recorded drawables with pdf-lib.
|
|
86
|
+
*/
|
|
87
|
+
export function exportDatabaseToPdf(db_1) {
|
|
88
|
+
return __awaiter(this, arguments, void 0, function (db, options) {
|
|
89
|
+
var layouts, renderer, block, roots, bytes;
|
|
90
|
+
if (options === void 0) { options = {}; }
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
layouts = options.layouts === 'all' && !options.blockName && !options.blockId
|
|
95
|
+
? collectExportLayouts(db)
|
|
96
|
+
: undefined;
|
|
97
|
+
AcPdfRenderer.prepareExport();
|
|
98
|
+
renderer = createConfiguredRenderer(db, options);
|
|
99
|
+
_a.label = 1;
|
|
100
|
+
case 1:
|
|
101
|
+
_a.trys.push([1, , 6, 7]);
|
|
102
|
+
if (!layouts) return [3 /*break*/, 3];
|
|
103
|
+
return [4 /*yield*/, exportLayoutsToPdf(db, options, renderer, layouts)];
|
|
104
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
105
|
+
case 3:
|
|
106
|
+
block = resolveTargetBlock(db, options);
|
|
107
|
+
if (!block) {
|
|
108
|
+
throw new Error("Block '".concat(options.blockName, "' was not found in the drawing database"));
|
|
109
|
+
}
|
|
110
|
+
return [4 /*yield*/, collectLayoutRoots(db, renderer, block, {})];
|
|
111
|
+
case 4:
|
|
112
|
+
roots = _a.sent();
|
|
113
|
+
return [4 /*yield*/, renderer.exportAsync(roots)];
|
|
114
|
+
case 5:
|
|
115
|
+
bytes = _a.sent();
|
|
116
|
+
return [2 /*return*/, bytes];
|
|
117
|
+
case 6:
|
|
118
|
+
AcDbRenderingCache.instance.clear();
|
|
119
|
+
return [7 /*endfinally*/];
|
|
120
|
+
case 7: return [2 /*return*/];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Lists layouts ordered by tab, or `null` when the database does not expose a
|
|
127
|
+
* layout table (single-layout export then runs as before).
|
|
128
|
+
*/
|
|
129
|
+
function collectExportLayouts(db) {
|
|
130
|
+
var _a;
|
|
131
|
+
var layoutTable = (_a = db.objects) === null || _a === void 0 ? void 0 : _a.layout;
|
|
132
|
+
if (!(layoutTable === null || layoutTable === void 0 ? void 0 : layoutTable.newIterator)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
var entries = __spreadArray([], __read(layoutTable.newIterator()), false);
|
|
136
|
+
var layouts = entries
|
|
137
|
+
.filter(function (layout) { return !!layout.blockTableRecordId; })
|
|
138
|
+
.sort(function (a, b) { var _a, _b; return ((_a = a.tabOrder) !== null && _a !== void 0 ? _a : 0) - ((_b = b.tabOrder) !== null && _b !== void 0 ? _b : 0); });
|
|
139
|
+
return layouts.length > 1 ? layouts : null;
|
|
140
|
+
}
|
|
141
|
+
function createConfiguredRenderer(db, options) {
|
|
142
|
+
var _a, _b, _c, _d;
|
|
143
|
+
var renderer = new AcPdfRenderer();
|
|
144
|
+
renderer.insunits = (_a = db.insunits) !== null && _a !== void 0 ? _a : 4;
|
|
145
|
+
renderer.ltscale = (_b = options.ltscale) !== null && _b !== void 0 ? _b : db.ltscale;
|
|
146
|
+
renderer.celtscale = (_c = options.celtscale) !== null && _c !== void 0 ? _c : db.celtscale;
|
|
147
|
+
renderer.showLineWeight = (_d = options.showLineWeight) !== null && _d !== void 0 ? _d : !!db.lwdisplay;
|
|
148
|
+
renderer.configureExport(options);
|
|
149
|
+
if (options.textMode === 'text' && options.textFontResolver) {
|
|
150
|
+
renderer.textFontManager = new AcPdfFontManager(options.textFontResolver);
|
|
151
|
+
}
|
|
152
|
+
var background = options.background === 'none' || options.background == null
|
|
153
|
+
? 0xffffff
|
|
154
|
+
: options.background;
|
|
155
|
+
renderer.currentBackgroundColor = background;
|
|
156
|
+
renderer.changeForeground(acgiIsLightBackground(background) ? 0x000000 : 0xffffff);
|
|
157
|
+
renderer.context.database = db;
|
|
158
|
+
return renderer;
|
|
159
|
+
}
|
|
160
|
+
function resolveTargetBlock(db, options) {
|
|
161
|
+
var _a;
|
|
162
|
+
if (options.blockId) {
|
|
163
|
+
return db.tables.blockTable.getIdAt(options.blockId);
|
|
164
|
+
}
|
|
165
|
+
if (options.blockName) {
|
|
166
|
+
return db.tables.blockTable.getAt(options.blockName);
|
|
167
|
+
}
|
|
168
|
+
return ((_a = db.tables.blockTable.getIdAt(db.currentSpaceId)) !== null && _a !== void 0 ? _a : db.tables.blockTable.modelSpace);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Resolves a layout entry's block table record.
|
|
172
|
+
*
|
|
173
|
+
* Some DWG databases never register the model-space block record handle in
|
|
174
|
+
* the database handle registry, so `getIdAt` fails for the Model layout even
|
|
175
|
+
* though the record itself is reachable via `blockTable.modelSpace`. Match on
|
|
176
|
+
* the model-space object id first, then fall back to the registry lookup.
|
|
177
|
+
*/
|
|
178
|
+
function resolveLayoutBlock(db, layout) {
|
|
179
|
+
if (layout.blockTableRecordId === db.tables.blockTable.modelSpace.objectId) {
|
|
180
|
+
return db.tables.blockTable.modelSpace;
|
|
181
|
+
}
|
|
182
|
+
return db.tables.blockTable.getIdAt(layout.blockTableRecordId);
|
|
183
|
+
}
|
|
184
|
+
function getModelRoots(db, renderer, cache) {
|
|
185
|
+
if (!cache.roots) {
|
|
186
|
+
cache.roots = collectModelSpaceRoots(db, renderer);
|
|
187
|
+
}
|
|
188
|
+
return cache.roots;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Walks one layout block and returns its page roots.
|
|
192
|
+
*
|
|
193
|
+
* Model space is traversed at most once per export: the same drawable tree
|
|
194
|
+
* backs the model page and every paper-space viewport (see
|
|
195
|
+
* {@link AcPdfViewportContent}), avoiding both repeated tessellation and
|
|
196
|
+
* per-viewport geometry clones.
|
|
197
|
+
*/
|
|
198
|
+
function collectLayoutRoots(db, renderer, block, modelCache) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
200
|
+
var viewportEntities, paperRoots, _a, _b, entity, typeName, drawable, viewportContents, viewportEntities_1, viewportEntities_1_1, viewport, built;
|
|
201
|
+
var e_1, _c, e_2, _d;
|
|
202
|
+
var _e, _f;
|
|
203
|
+
return __generator(this, function (_g) {
|
|
204
|
+
if (!isPaperSpaceBlock(db, block)) {
|
|
205
|
+
return [2 /*return*/, getModelRoots(db, renderer, modelCache)];
|
|
206
|
+
}
|
|
207
|
+
viewportEntities = [];
|
|
208
|
+
paperRoots = [];
|
|
209
|
+
try {
|
|
210
|
+
for (_a = __values(block.newIterator()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
211
|
+
entity = _b.value;
|
|
212
|
+
typeName = String((_f = (_e = entity.type) !== null && _e !== void 0 ? _e : entity.dxfTypeName) !== null && _f !== void 0 ? _f : '');
|
|
213
|
+
if (entity instanceof AcDbViewport) {
|
|
214
|
+
viewportEntities.push(entity);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
drawable = entity.worldDraw(renderer);
|
|
218
|
+
if (drawable instanceof AcPdfEntity) {
|
|
219
|
+
attachPdfEntityMeta(drawable, entity, typeName);
|
|
220
|
+
paperRoots.push(drawable);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
225
|
+
finally {
|
|
226
|
+
try {
|
|
227
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
228
|
+
}
|
|
229
|
+
finally { if (e_1) throw e_1.error; }
|
|
230
|
+
}
|
|
231
|
+
viewportContents = [];
|
|
232
|
+
if (viewportEntities.length > 0) {
|
|
233
|
+
try {
|
|
234
|
+
for (viewportEntities_1 = __values(viewportEntities), viewportEntities_1_1 = viewportEntities_1.next(); !viewportEntities_1_1.done; viewportEntities_1_1 = viewportEntities_1.next()) {
|
|
235
|
+
viewport = viewportEntities_1_1.value;
|
|
236
|
+
built = buildViewportModelContent(viewport, function () { return getModelRoots(db, renderer, modelCache); }, renderer);
|
|
237
|
+
if (built) {
|
|
238
|
+
viewportContents.push(built.content);
|
|
239
|
+
if (built.border) {
|
|
240
|
+
paperRoots.push(built.border);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
246
|
+
finally {
|
|
247
|
+
try {
|
|
248
|
+
if (viewportEntities_1_1 && !viewportEntities_1_1.done && (_d = viewportEntities_1.return)) _d.call(viewportEntities_1);
|
|
249
|
+
}
|
|
250
|
+
finally { if (e_2) throw e_2.error; }
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Viewport model content sits under paper-space annotations / borders.
|
|
254
|
+
return [2 /*return*/, __spreadArray(__spreadArray([], __read(viewportContents), false), __read(paperRoots), false)];
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Paints every layout into one PDF document.
|
|
260
|
+
*
|
|
261
|
+
* Pages share the pdf-lib document, the OCG manager (one OCG per CAD layer
|
|
262
|
+
* across pages) and the embedded-image cache. Compared with rendering one
|
|
263
|
+
* PDF per layout and merging via `load`/`copyPages`, this keeps neither
|
|
264
|
+
* finished page bytes nor parsed source documents in memory while later
|
|
265
|
+
* pages are still being built.
|
|
266
|
+
*/
|
|
267
|
+
function exportLayoutsToPdf(db, options, renderer, layouts) {
|
|
268
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
269
|
+
var doc, ocg, imageCache, formRegistry, modelCache, modelSpaceId, layouts_1, layouts_1_1, layout, block, isModel, roots, e_3_1, bytes;
|
|
270
|
+
var e_3, _a;
|
|
271
|
+
var _b;
|
|
272
|
+
return __generator(this, function (_c) {
|
|
273
|
+
switch (_c.label) {
|
|
274
|
+
case 0: return [4 /*yield*/, PDFDocument.create()];
|
|
275
|
+
case 1:
|
|
276
|
+
doc = _c.sent();
|
|
277
|
+
doc.setProducer('MLightCAD pdf-renderer');
|
|
278
|
+
doc.setCreator('MLightCAD');
|
|
279
|
+
if (options.title) {
|
|
280
|
+
doc.setTitle(options.title);
|
|
281
|
+
}
|
|
282
|
+
ocg = new AcPdfOcgManager(doc);
|
|
283
|
+
imageCache = new Map();
|
|
284
|
+
formRegistry = createPdfFormRegistry();
|
|
285
|
+
modelCache = {};
|
|
286
|
+
modelSpaceId = db.tables.blockTable.modelSpace.objectId;
|
|
287
|
+
_c.label = 2;
|
|
288
|
+
case 2:
|
|
289
|
+
_c.trys.push([2, 9, 10, 11]);
|
|
290
|
+
layouts_1 = __values(layouts), layouts_1_1 = layouts_1.next();
|
|
291
|
+
_c.label = 3;
|
|
292
|
+
case 3:
|
|
293
|
+
if (!!layouts_1_1.done) return [3 /*break*/, 8];
|
|
294
|
+
layout = layouts_1_1.value;
|
|
295
|
+
block = resolveLayoutBlock(db, layout);
|
|
296
|
+
if (!block) {
|
|
297
|
+
return [3 /*break*/, 7];
|
|
298
|
+
}
|
|
299
|
+
isModel = layout.blockTableRecordId === modelSpaceId;
|
|
300
|
+
return [4 /*yield*/, collectLayoutRoots(db, renderer, block, modelCache)];
|
|
301
|
+
case 4:
|
|
302
|
+
roots = _c.sent();
|
|
303
|
+
return [4 /*yield*/, renderer.renderToDocument(doc, roots, {
|
|
304
|
+
ocg: ocg,
|
|
305
|
+
imageCache: imageCache,
|
|
306
|
+
formRegistry: formRegistry,
|
|
307
|
+
// Model-space “Display” framing must not clip paper-space pages.
|
|
308
|
+
fitBox: isModel ? options.fitBox : undefined
|
|
309
|
+
})
|
|
310
|
+
// Explicit roots were handed to the page; release renderer-side
|
|
311
|
+
// drawables so only the page's pdf-lib objects stay resident.
|
|
312
|
+
];
|
|
313
|
+
case 5:
|
|
314
|
+
_c.sent();
|
|
315
|
+
// Explicit roots were handed to the page; release renderer-side
|
|
316
|
+
// drawables so only the page's pdf-lib objects stay resident.
|
|
317
|
+
renderer.resetCollected();
|
|
318
|
+
// Keep the host busy spinner animating between layout pages.
|
|
319
|
+
return [4 /*yield*/, accmYieldForPaint()];
|
|
320
|
+
case 6:
|
|
321
|
+
// Keep the host busy spinner animating between layout pages.
|
|
322
|
+
_c.sent();
|
|
323
|
+
_c.label = 7;
|
|
324
|
+
case 7:
|
|
325
|
+
layouts_1_1 = layouts_1.next();
|
|
326
|
+
return [3 /*break*/, 3];
|
|
327
|
+
case 8: return [3 /*break*/, 11];
|
|
328
|
+
case 9:
|
|
329
|
+
e_3_1 = _c.sent();
|
|
330
|
+
e_3 = { error: e_3_1 };
|
|
331
|
+
return [3 /*break*/, 11];
|
|
332
|
+
case 10:
|
|
333
|
+
try {
|
|
334
|
+
if (layouts_1_1 && !layouts_1_1.done && (_a = layouts_1.return)) _a.call(layouts_1);
|
|
335
|
+
}
|
|
336
|
+
finally { if (e_3) throw e_3.error; }
|
|
337
|
+
return [7 /*endfinally*/];
|
|
338
|
+
case 11:
|
|
339
|
+
// Flush deferred font embeds and repair their font programs (see
|
|
340
|
+
// AcPdfFontManager.finalize) before serialization.
|
|
341
|
+
return [4 /*yield*/, ((_b = renderer.textFontManager) === null || _b === void 0 ? void 0 : _b.finalize())];
|
|
342
|
+
case 12:
|
|
343
|
+
// Flush deferred font embeds and repair their font programs (see
|
|
344
|
+
// AcPdfFontManager.finalize) before serialization.
|
|
345
|
+
_c.sent();
|
|
346
|
+
return [4 /*yield*/, doc.save({ useObjectStreams: true })];
|
|
347
|
+
case 13:
|
|
348
|
+
bytes = _c.sent();
|
|
349
|
+
return [2 /*return*/, bytes];
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=AcPdfExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfExport.js","sourceRoot":"","sources":["../src/AcPdfExport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,iBAAiB,EAGjB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAY,MAAM,SAAS,CAAA;AAG/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,kCAAkC,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,UAAgB,mBAAmB;wDACvC,EAAgB,EAChB,OAAgC;;QAAhC,wBAAA,EAAA,YAAgC;;;;oBAE1B,OAAO,GACX,OAAO,CAAC,OAAO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K,OAAO,GAAG,MAAM,CAAC,kBAAkB,KAAK,YAAY,CAAA;oBAC5C,qBAAM,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,EAAA;;oBAAjE,KAAK,GAAG,SAAyD;oBACvE,qBAAM,QAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE;4BAC1C,GAAG,KAAA;4BACH,UAAU,YAAA;4BACV,YAAY,cAAA;4BACZ,iEAAiE;4BACjE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;yBAC7C,CAAC;wBACF,gEAAgE;wBAChE,8DAA8D;sBAF5D;;oBANF,SAME,CAAA;oBACF,gEAAgE;oBAChE,8DAA8D;oBAC9D,QAAQ,CAAC,cAAc,EAAE,CAAA;oBACzB,6DAA6D;oBAC7D,qBAAM,iBAAiB,EAAE,EAAA;;oBADzB,6DAA6D;oBAC7D,SAAyB,CAAA;;;;;;;;;;;;;;;;;gBAG3B,iEAAiE;gBACjE,mDAAmD;gBACnD,qBAAM,CAAA,MAAA,QAAQ,CAAC,eAAe,0CAAE,QAAQ,EAAE,CAAA,EAAA;;oBAF1C,iEAAiE;oBACjE,mDAAmD;oBACnD,SAA0C,CAAA;oBAC5B,qBAAM,GAAG,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,EAAA;;oBAAlD,KAAK,GAAG,SAA0C;oBACxD,sBAAO,KAAK,EAAA;;;;CACb"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { AcGiFontMapping } from '@mlightcad/data-model';
|
|
2
|
+
import type { AcPdfTextFontResolver } from './pdf/AcPdfFontManager';
|
|
3
|
+
import type { AcPdfGlyphProvider } from './text/AcPdfGlyphProvider';
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link exportDatabaseToPdf}.
|
|
6
|
+
*
|
|
7
|
+
* Viewer-specific types such as `AcApContext` are intentionally absent so this
|
|
8
|
+
* package can run without `@mlightcad/cad-simple-viewer`.
|
|
9
|
+
*/
|
|
10
|
+
export interface AcPdfExportOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Block table record name to export. Defaults to model space.
|
|
13
|
+
*/
|
|
14
|
+
blockName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Page size. `'extents'` fits the drawing bounding box (default).
|
|
17
|
+
*/
|
|
18
|
+
paper?: 'extents' | {
|
|
19
|
+
widthMm: number;
|
|
20
|
+
heightMm: number;
|
|
21
|
+
};
|
|
22
|
+
/** Margin around extents, in millimetres. Defaults to 0 (2% padding is still applied). */
|
|
23
|
+
marginMm?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Page background. `'none'` leaves white paper (default). A 24-bit RGB
|
|
26
|
+
* paints a full-page rectangle first.
|
|
27
|
+
*/
|
|
28
|
+
background?: 'none' | number;
|
|
29
|
+
/** Mirrors LWDISPLAY. Defaults to the database `lwdisplay` flag when omitted. */
|
|
30
|
+
showLineWeight?: boolean;
|
|
31
|
+
/** Global linetype scale. Defaults to the database `ltscale`. */
|
|
32
|
+
ltscale?: number;
|
|
33
|
+
/** Entity linetype scale. Defaults to the database `celtscale`. */
|
|
34
|
+
celtscale?: number;
|
|
35
|
+
/** Font name substitutions passed to the glyph provider. */
|
|
36
|
+
fontMapping?: AcGiFontMapping;
|
|
37
|
+
/**
|
|
38
|
+
* When true, frozen/off layers are still walked if the database policy
|
|
39
|
+
* allows it. Defaults to false.
|
|
40
|
+
*/
|
|
41
|
+
includeHiddenLayers?: boolean;
|
|
42
|
+
/** Wrap exploded text with PDF `/ActualText`. Defaults to true. */
|
|
43
|
+
embedTextActualText?: boolean;
|
|
44
|
+
/** Overlay invisible PDF text for search. Defaults to false. */
|
|
45
|
+
embedInvisibleText?: boolean;
|
|
46
|
+
/** Embed a CAD JSON sidecar. Defaults to false. */
|
|
47
|
+
embedCadJson?: boolean;
|
|
48
|
+
/** PDF document title. */
|
|
49
|
+
title?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional WCS box used to size and frame the page. When omitted, the
|
|
52
|
+
* exporter unions the primary drawable cluster (HTML export “Extents”).
|
|
53
|
+
* Pass the live camera box for HTML export “Current”.
|
|
54
|
+
*/
|
|
55
|
+
fitBox?: {
|
|
56
|
+
min: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
max: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Page framing. `'extents'` fits drawable geometry (default, HTML “范围”).
|
|
67
|
+
* `'current'` keeps the on-screen view (HTML “当前”).
|
|
68
|
+
*/
|
|
69
|
+
fit?: 'extents' | 'current';
|
|
70
|
+
/**
|
|
71
|
+
* When `'all'`, every layout (model + paper space) is exported as its
|
|
72
|
+
* own PDF page. Defaults to the current space only.
|
|
73
|
+
*/
|
|
74
|
+
layouts?: 'current' | 'all';
|
|
75
|
+
/**
|
|
76
|
+
* Optional glyph engine for MTEXT / SHAPE. When omitted, text entities
|
|
77
|
+
* produce no visible geometry (ActualText may still be reserved later).
|
|
78
|
+
*/
|
|
79
|
+
glyphProvider?: AcPdfGlyphProvider;
|
|
80
|
+
/**
|
|
81
|
+
* How MTEXT/TEXT are painted.
|
|
82
|
+
*
|
|
83
|
+
* - `'vector'` (default): glyphs are tessellated into line/fill geometry
|
|
84
|
+
* through {@link glyphProvider}. Self-contained but heavy — dense text
|
|
85
|
+
* dominates the PDF size.
|
|
86
|
+
* - `'text'`: laid-out text lines are painted as real PDF text objects
|
|
87
|
+
* through fonts embedded (subset) via {@link textFontResolver}. Keeps
|
|
88
|
+
* text selectable/searchable and shrinks the file dramatically; text
|
|
89
|
+
* whose font cannot be resolved/embedded, or that the font does not
|
|
90
|
+
* cover, silently falls back to `'vector'`.
|
|
91
|
+
*/
|
|
92
|
+
textMode?: 'vector' | 'text';
|
|
93
|
+
/**
|
|
94
|
+
* Resolves embeddable font programs (TTF/OTF/WOFF bytes) by CAD font name
|
|
95
|
+
* for {@link textMode} `'text'`. Return `undefined` for fonts without an
|
|
96
|
+
* embeddable program (SHX shapes).
|
|
97
|
+
*/
|
|
98
|
+
textFontResolver?: AcPdfTextFontResolver;
|
|
99
|
+
/**
|
|
100
|
+
* Block table record object id to export. Overrides {@link blockName}
|
|
101
|
+
* and the current space when set.
|
|
102
|
+
*/
|
|
103
|
+
blockId?: string;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=AcPdfExportOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfExportOptions.d.ts","sourceRoot":"","sources":["../src/AcPdfExportOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACzD,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,iFAAiF;IACjF,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,mEAAmE;IACnE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,GAAG,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QAC7B,GAAG,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAC9B,CAAA;IACD;;;OAGG;IACH,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,KAAK,CAAA;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAA;IAClC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;IACxC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfExportOptions.js","sourceRoot":"","sources":["../src/AcPdfExportOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** PDF user units are points (1/72 inch). */
|
|
2
|
+
export declare const PDF_POINTS_PER_MM: number;
|
|
3
|
+
/** Adobe's practical MediaBox limit in user units. */
|
|
4
|
+
export declare const PDF_MAX_PAGE_SIZE = 14400;
|
|
5
|
+
export declare function mmPerDrawingUnit(insunits: number): number;
|
|
6
|
+
/**
|
|
7
|
+
* Scale that maps one drawing unit into PDF points, honouring INSUNITS.
|
|
8
|
+
*/
|
|
9
|
+
export declare function drawingUnitsToPdfPoints(insunits: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Converts an AutoCAD lineweight (0.01 mm) into drawing units so a CTM that
|
|
12
|
+
* maps drawing units → points yields a physically correct stroke.
|
|
13
|
+
*/
|
|
14
|
+
export declare function lineWeightToDrawingUnits(lineWeight: number, insunits: number): number;
|
|
15
|
+
export declare function mmToPdfPoints(mm: number): number;
|
|
16
|
+
export declare function clampPageSize(size: number): number;
|
|
17
|
+
//# sourceMappingURL=AcPdfUnits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfUnits.d.ts","sourceRoot":"","sources":["../src/AcPdfUnits.ts"],"names":[],"mappings":"AAgCA,6CAA6C;AAC7C,eAAO,MAAM,iBAAiB,QAAY,CAAA;AAE1C,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAOR;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKlD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INSUNITS → millimetres. Unitless (0) is treated as millimetres so FitExtents
|
|
3
|
+
* pages stay printable. Matches AutoCAD's common default for metric drawings.
|
|
4
|
+
*/
|
|
5
|
+
var ACAD_UNIT_TO_MM = {
|
|
6
|
+
0: 1,
|
|
7
|
+
1: 25.4,
|
|
8
|
+
2: 304.8,
|
|
9
|
+
3: 1609344,
|
|
10
|
+
4: 1,
|
|
11
|
+
5: 10,
|
|
12
|
+
6: 1000,
|
|
13
|
+
7: 1000000,
|
|
14
|
+
8: 0.0000254,
|
|
15
|
+
9: 0.0254,
|
|
16
|
+
10: 914.4,
|
|
17
|
+
11: 0.0000001,
|
|
18
|
+
12: 0.000001,
|
|
19
|
+
13: 0.001,
|
|
20
|
+
14: 100,
|
|
21
|
+
15: 10000,
|
|
22
|
+
16: 100000,
|
|
23
|
+
17: 1000000000000,
|
|
24
|
+
18: 149597870700000,
|
|
25
|
+
19: 9.4607304725808e18,
|
|
26
|
+
20: 3.085677581491367e19,
|
|
27
|
+
21: 304.80060960121926,
|
|
28
|
+
22: 25.400050800101603,
|
|
29
|
+
23: 914.4018288036576,
|
|
30
|
+
24: 1609347.2186944375
|
|
31
|
+
};
|
|
32
|
+
/** PDF user units are points (1/72 inch). */
|
|
33
|
+
export var PDF_POINTS_PER_MM = 72 / 25.4;
|
|
34
|
+
/** Adobe's practical MediaBox limit in user units. */
|
|
35
|
+
export var PDF_MAX_PAGE_SIZE = 14400;
|
|
36
|
+
export function mmPerDrawingUnit(insunits) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (!Number.isFinite(insunits)) {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
return (_a = ACAD_UNIT_TO_MM[Math.trunc(insunits)]) !== null && _a !== void 0 ? _a : 1;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Scale that maps one drawing unit into PDF points, honouring INSUNITS.
|
|
45
|
+
*/
|
|
46
|
+
export function drawingUnitsToPdfPoints(insunits) {
|
|
47
|
+
return mmPerDrawingUnit(insunits) * PDF_POINTS_PER_MM;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Converts an AutoCAD lineweight (0.01 mm) into drawing units so a CTM that
|
|
51
|
+
* maps drawing units → points yields a physically correct stroke.
|
|
52
|
+
*/
|
|
53
|
+
export function lineWeightToDrawingUnits(lineWeight, insunits) {
|
|
54
|
+
var mm = Math.max(0.01, lineWeight / 100);
|
|
55
|
+
var perUnit = mmPerDrawingUnit(insunits);
|
|
56
|
+
if (perUnit <= 0) {
|
|
57
|
+
return mm;
|
|
58
|
+
}
|
|
59
|
+
return mm / perUnit;
|
|
60
|
+
}
|
|
61
|
+
export function mmToPdfPoints(mm) {
|
|
62
|
+
return mm * PDF_POINTS_PER_MM;
|
|
63
|
+
}
|
|
64
|
+
export function clampPageSize(size) {
|
|
65
|
+
if (!Number.isFinite(size) || size <= 0) {
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
return Math.min(size, PDF_MAX_PAGE_SIZE);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=AcPdfUnits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfUnits.js","sourceRoot":"","sources":["../src/AcPdfUnits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,IAAM,eAAe,GAAqC;IACxD,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,MAAM;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,iBAAiB;IACrB,EAAE,EAAE,kBAAkB;CACvB,CAAA;AAED,6CAA6C;AAC7C,MAAM,CAA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cPdfStyle';
|
|
2
|
+
/** CAD gradient fill (subset of AcGi hatch gradient). */
|
|
3
|
+
export interface AcPdfGradientFill {
|
|
4
|
+
name?: string;
|
|
5
|
+
angle?: number;
|
|
6
|
+
shift?: number;
|
|
7
|
+
oneColorMode?: boolean;
|
|
8
|
+
shadeTintValue?: number;
|
|
9
|
+
startColor?: number;
|
|
10
|
+
endColor?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Solid strip used when a pattern cannot be expressed as one Type 2/3 shading. */
|
|
13
|
+
export interface AcPdfGradientStrip {
|
|
14
|
+
points: AcPdfPoint[];
|
|
15
|
+
rgb: AcPdfRgb;
|
|
16
|
+
}
|
|
17
|
+
export interface AcPdfShadingSpec {
|
|
18
|
+
/** PDF shading type: 2 axial, 3 radial. */
|
|
19
|
+
shadingType: 2 | 3;
|
|
20
|
+
coords: number[];
|
|
21
|
+
c0: AcPdfRgb;
|
|
22
|
+
c1: AcPdfRgb;
|
|
23
|
+
/**
|
|
24
|
+
* When set, paint these clipped solid strips instead of a PDF shading.
|
|
25
|
+
* Used for CYLINDER (center peak) which Type 2/3 cannot express alone.
|
|
26
|
+
*/
|
|
27
|
+
strips?: AcPdfGradientStrip[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Matches {@link AcTrGradientHatchShaders} `getGradientFactor` in local
|
|
31
|
+
* normalized coordinates (≈[-1,1]² after angle rotation).
|
|
32
|
+
*/
|
|
33
|
+
export declare function gradientFactor(name: string, localX: number, localY: number, shift?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Builds a PDF shading (or clipped solid strips) for a CAD gradient hatch.
|
|
36
|
+
*
|
|
37
|
+
* Factor curves match the Three.js viewer shader. Patterns that map cleanly
|
|
38
|
+
* to Type 2/3 use a linear FunctionType 2 with the correct C0/C1 order.
|
|
39
|
+
* CYLINDER / INVCYLINDER use solid strips (a single axial shading cannot peak
|
|
40
|
+
* in the middle).
|
|
41
|
+
*/
|
|
42
|
+
export declare function shadingFromGradient(gradient: AcPdfGradientFill, loops: AcPdfPoint[][], fallbackPacked: number): AcPdfShadingSpec;
|
|
43
|
+
//# sourceMappingURL=AcPdfGradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcPdfGradient.d.ts","sourceRoot":"","sources":["../../src/hatch/AcPdfGradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAElE,yDAAyD;AACzD,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,GAAG,EAAE,QAAQ,CAAA;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,WAAW,EAAE,CAAC,GAAG,CAAC,CAAA;IAClB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,EAAE,EAAE,QAAQ,CAAA;IACZ,EAAE,EAAE,QAAQ,CAAA;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AA8BD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,SAAI,GACR,MAAM,CA2BR;AAmFD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,UAAU,EAAE,EAAE,EACrB,cAAc,EAAE,MAAM,GACrB,gBAAgB,CAkElB"}
|