@evotecit/officeimo 0.1.19 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -10
- package/bundles/officeimo-canopyx-adapter.js +147 -65
- package/bundles/officeimo-canopyx-adapter.min.js +1 -1
- package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
- package/bundles/officeimo-canopyx-adapter.mjs +134 -53
- package/bundles/officeimo-canopyx.js +554 -234
- package/bundles/officeimo-canopyx.min.js +1 -1
- package/bundles/officeimo-canopyx.min.mjs +1 -1
- package/bundles/officeimo-canopyx.mjs +477 -158
- package/bundles/officeimo-chartforgex-adapter.js +1924 -0
- package/bundles/officeimo-chartforgex-adapter.min.js +2 -0
- package/bundles/officeimo-chartforgex-adapter.min.mjs +2 -0
- package/bundles/officeimo-chartforgex-adapter.mjs +1910 -0
- package/bundles/officeimo-chartforgex.js +13594 -0
- package/bundles/officeimo-chartforgex.min.js +2 -0
- package/bundles/officeimo-chartforgex.min.mjs +2 -0
- package/bundles/officeimo-chartforgex.mjs +13487 -0
- package/bundles/officeimo-csv.js +12 -7
- package/bundles/officeimo-csv.min.js +1 -1
- package/bundles/officeimo-csv.min.mjs +1 -1
- package/bundles/officeimo-csv.mjs +8 -3
- package/bundles/officeimo-datatables-adapter.js +11 -11
- package/bundles/officeimo-datatables-adapter.min.js +1 -1
- package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
- package/bundles/officeimo-datatables-adapter.mjs +7 -7
- package/bundles/officeimo-datatables.js +418 -180
- package/bundles/officeimo-datatables.min.js +1 -1
- package/bundles/officeimo-datatables.min.mjs +1 -1
- package/bundles/officeimo-datatables.mjs +350 -112
- package/bundles/officeimo-execution.js +14 -9
- package/bundles/officeimo-execution.min.js +1 -1
- package/bundles/officeimo-execution.min.mjs +1 -1
- package/bundles/officeimo-execution.mjs +8 -3
- package/bundles/officeimo-pdf.js +286 -120
- package/bundles/officeimo-pdf.min.js +1 -1
- package/bundles/officeimo-pdf.min.mjs +1 -1
- package/bundles/officeimo-pdf.mjs +244 -78
- package/bundles/officeimo-xlsx.js +136 -59
- package/bundles/officeimo-xlsx.min.js +1 -1
- package/bundles/officeimo-xlsx.min.mjs +1 -1
- package/bundles/officeimo-xlsx.mjs +114 -37
- package/bundles/officeimo.js +416 -178
- package/bundles/officeimo.min.js +1 -1
- package/bundles/officeimo.min.mjs +1 -1
- package/bundles/officeimo.mjs +351 -113
- package/dist/core/progress.js +7 -2
- package/dist/index.d.ts +1 -1
- package/dist/integrations/canopyx/index.js +13 -4
- package/dist/integrations/canopyx/pdf-number.js +9 -6
- package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
- package/dist/integrations/canopyx/rule-predicates.js +2 -1
- package/dist/integrations/canopyx/rules.d.ts +1 -1
- package/dist/integrations/canopyx/rules.js +11 -13
- package/dist/integrations/canopyx/source.js +57 -7
- package/dist/integrations/canopyx/tones.d.ts +10 -0
- package/dist/integrations/canopyx/tones.js +12 -0
- package/dist/integrations/canopyx/types.d.ts +8 -1
- package/dist/integrations/chartforgex/capture.d.ts +31 -0
- package/dist/integrations/chartforgex/capture.js +103 -0
- package/dist/integrations/chartforgex/index.d.ts +13 -0
- package/dist/integrations/chartforgex/index.js +88 -0
- package/dist/integrations/chartforgex/svg-drawing.d.ts +5 -0
- package/dist/integrations/chartforgex/svg-drawing.js +775 -0
- package/dist/integrations/chartforgex/svg-geometry.d.ts +23 -0
- package/dist/integrations/chartforgex/svg-geometry.js +304 -0
- package/dist/integrations/chartforgex/svg-image.d.ts +9 -0
- package/dist/integrations/chartforgex/svg-image.js +46 -0
- package/dist/integrations/chartforgex/svg-markup.d.ts +10 -0
- package/dist/integrations/chartforgex/svg-markup.js +124 -0
- package/dist/integrations/chartforgex/svg-paint.d.ts +16 -0
- package/dist/integrations/chartforgex/svg-paint.js +146 -0
- package/dist/integrations/chartforgex/types.d.ts +77 -0
- package/dist/integrations/chartforgex/types.js +1 -0
- package/dist/integrations/chartforgex/winansi.d.ts +4 -0
- package/dist/integrations/chartforgex/winansi.js +48 -0
- package/dist/integrations/chartforgex/workbook.d.ts +12 -0
- package/dist/integrations/chartforgex/workbook.js +137 -0
- package/dist/pdf/document-drawings.d.ts +1 -1
- package/dist/pdf/document-drawings.js +91 -17
- package/dist/pdf/document-images.d.ts +7 -1
- package/dist/pdf/document-images.js +59 -24
- package/dist/pdf/document-types.d.ts +3 -1
- package/dist/pdf/document.d.ts +2 -2
- package/dist/pdf/document.js +3 -1
- package/dist/pdf/drawing-types.d.ts +37 -10
- package/dist/pdf/font-resources.d.ts +1 -1
- package/dist/pdf/font-resources.js +6 -3
- package/dist/pdf/index.d.ts +1 -1
- package/dist/pdf/pages.js +15 -0
- package/dist/pdf/png.d.ts +11 -2
- package/dist/pdf/png.js +50 -23
- package/dist/pdf/session.js +3 -2
- package/dist/pdf/settings.d.ts +2 -2
- package/dist/pdf/settings.js +7 -3
- package/dist/xlsx/options.js +2 -2
- package/dist/xlsx/portable.js +1 -1
- package/dist/xlsx/styles.js +28 -18
- package/dist/xlsx/types.d.ts +13 -1
- package/dist/xlsx/workbook.js +9 -1
- package/dist/xlsx/worksheet.d.ts +13 -1
- package/dist/xlsx/worksheet.js +65 -11
- package/package.json +9 -2
package/bundles/officeimo-pdf.js
CHANGED
|
@@ -307,19 +307,24 @@ _modules.set("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b",
|
|
|
307
307
|
return _exports;
|
|
308
308
|
})();
|
|
309
309
|
|
|
310
|
-
const _m5 = _modules.get("
|
|
310
|
+
const _m5 = _modules.get("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244") ?? (() => {
|
|
311
311
|
/** @internal Notify synchronously; observe an accidental promise before rejecting its unsupported use. */
|
|
312
312
|
function notifyProgress(callback, progress) {
|
|
313
|
+
notifySynchronously("onProgress", callback, progress);
|
|
314
|
+
}
|
|
315
|
+
/** @internal Run a host notification that must finish before the export continues. A returned promise is observed,
|
|
316
|
+
* so its rejection is never unhandled, and the export fails instead of reporting success before the callback ends. */
|
|
317
|
+
function notifySynchronously(name, callback, value) {
|
|
313
318
|
if (!callback)
|
|
314
319
|
return;
|
|
315
|
-
const result = callback(
|
|
320
|
+
const result = callback(value);
|
|
316
321
|
if (result && typeof result.then === "function") {
|
|
317
322
|
void Promise.resolve(result).catch(() => { });
|
|
318
|
-
throw new TypeError("
|
|
323
|
+
throw new TypeError(name + " must be synchronous.");
|
|
319
324
|
}
|
|
320
325
|
}
|
|
321
|
-
const _exports = Object.freeze({ notifyProgress: notifyProgress });
|
|
322
|
-
_modules.set("
|
|
326
|
+
const _exports = Object.freeze({ notifyProgress: notifyProgress, notifySynchronously: notifySynchronously });
|
|
327
|
+
_modules.set("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244", _exports);
|
|
323
328
|
return _exports;
|
|
324
329
|
})();
|
|
325
330
|
|
|
@@ -819,7 +824,7 @@ _modules.set("9b33d9107e62ba8299c576072de40d24a261464f118de4ace64f23154fc78307",
|
|
|
819
824
|
return _exports;
|
|
820
825
|
})();
|
|
821
826
|
|
|
822
|
-
const _m11 = _modules.get("
|
|
827
|
+
const _m11 = _modules.get("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02") ?? (() => {
|
|
823
828
|
const { OfficeIMOError } = _m4;
|
|
824
829
|
|
|
825
830
|
const { ExportBudget } = _m12;
|
|
@@ -846,12 +851,16 @@ const sizes = {
|
|
|
846
851
|
};
|
|
847
852
|
/** @internal Shared capture schema for thin format adapters and the grouped writer. */
|
|
848
853
|
const pdfOptionFields = ["columns", "signal", "onProgress", "limits", "textShaper", "textDirection", "pageSize", "orientation", "margins", "fonts", "tagged", "fontSize",
|
|
849
|
-
"title", "messageTop", "messageBottom", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "padding",
|
|
854
|
+
"title", "metadataTitle", "messageTop", "messageBottom", "includeHeader", "headerRows", "footer", "headerPresentation", "footerPresentation", "alternateRowColor", "padding",
|
|
850
855
|
"columnWidths", "wideTable", "pageHeader", "pageFooter", "pageNumbers", "pageNumberLabels", "booleanText", "formatValue", "formatRuns", "compression", "paragraphStyles"];
|
|
851
856
|
/** @internal Complete PDF limit schema used when a host combines format and shared limits. */
|
|
852
857
|
const pdfLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxPages", "maxColumns", "maxTableBands", "maxTableWindowRows", "maxCellCharacters", "maxTextRuns", "maxGroupBlocks", "maxRowLines",
|
|
853
858
|
"maxFontBytes", "maxPageBytes", "maxHyperlinks", "maxImageBytes", "maxImagePixels", "maxImageWorkingBytes", "maxVectorCommands", "maxDrawingElements", "maxStructureElements",
|
|
854
859
|
"maxMarkedContentReferences", "maxSections", "maxBookmarks", "maxListItems", "maxParagraphStyles"];
|
|
860
|
+
/** @internal Default ceilings shared by the drawing writer and its producers. */
|
|
861
|
+
const pdfDrawingLimits = Object.freeze({ maxVectorCommands: 100000, maxDrawingElements: 100000 });
|
|
862
|
+
/** @internal Maximum number of retained drawing levels including the leaf. */
|
|
863
|
+
const pdfDrawingMaxDepth = 32;
|
|
855
864
|
/** @internal Capture supported structural properties once, including class-based options with prototype accessors. */
|
|
856
865
|
function capturePdfOptions(input) {
|
|
857
866
|
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
@@ -962,7 +971,7 @@ function settings(input, document = false) {
|
|
|
962
971
|
footerPresentation: Object.freeze({ background: "eef2f6", bold: true, ...presentation(configuration.footerPresentation) }) };
|
|
963
972
|
const budget = new ExportBudget(options.limits);
|
|
964
973
|
const limits = { maxPages: 10000, maxColumns: 1024, maxTableBands: 64, maxTableWindowRows: 256, maxCellCharacters: 1000000, maxTextRuns: 10000, maxGroupBlocks: 256, maxRowLines: 100000, maxFontBytes: 16 * 1024 * 1024, maxPageBytes: 8 * 1024 * 1024, maxHyperlinks: 100000,
|
|
965
|
-
maxImageBytes: 32 * 1024 * 1024, maxImagePixels: 16 * 1024 * 1024,
|
|
974
|
+
maxImageBytes: 32 * 1024 * 1024, maxImagePixels: 16 * 1024 * 1024, ...pdfDrawingLimits,
|
|
966
975
|
maxStructureElements: 1000000, maxMarkedContentReferences: 2000000,
|
|
967
976
|
maxListItems: 100000, maxParagraphStyles: 256, maxSections: 1000, maxBookmarks: 10000 };
|
|
968
977
|
for (const key of Object.keys(limits)) {
|
|
@@ -990,7 +999,7 @@ function settings(input, document = false) {
|
|
|
990
999
|
const fontSize = positive(options.fontSize ?? 9, "Font size", 144), padding = options.padding ?? 4;
|
|
991
1000
|
if (!Number.isFinite(padding) || padding < 0 || padding > 72)
|
|
992
1001
|
throw new RangeError("PDF padding must be from 0 through 72 points.");
|
|
993
|
-
for (const key of ["title", "messageTop", "messageBottom"])
|
|
1002
|
+
for (const key of ["title", "metadataTitle", "messageTop", "messageBottom"])
|
|
994
1003
|
if (options[key] !== undefined && typeof options[key] !== "string")
|
|
995
1004
|
throw new TypeError(key + " must be text.");
|
|
996
1005
|
for (const key of ["pageHeader", "pageFooter"])
|
|
@@ -1026,8 +1035,8 @@ function settings(input, document = false) {
|
|
|
1026
1035
|
repeatedColumns: document ? Object.freeze([]) : repeatedColumns(options.wideTable, columns),
|
|
1027
1036
|
limits: { ...limits, ...(maxImageWorkingBytes === undefined ? {} : { maxImageWorkingBytes }) }, budget };
|
|
1028
1037
|
}
|
|
1029
|
-
const _exports = Object.freeze({ positive: _m16.positive, color: _m16.color, presentation: _m16.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
|
|
1030
|
-
_modules.set("
|
|
1038
|
+
const _exports = Object.freeze({ positive: _m16.positive, color: _m16.color, presentation: _m16.presentation, pdfOptionFields: pdfOptionFields, pdfLimitFields: pdfLimitFields, pdfDrawingLimits: pdfDrawingLimits, pdfDrawingMaxDepth: pdfDrawingMaxDepth, capturePdfOptions: capturePdfOptions, capturePdfLimits: capturePdfLimits, captureWideTable: captureWideTable, settings: settings });
|
|
1039
|
+
_modules.set("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02", _exports);
|
|
1031
1040
|
return _exports;
|
|
1032
1041
|
})();
|
|
1033
1042
|
|
|
@@ -2352,7 +2361,7 @@ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070",
|
|
|
2352
2361
|
return _exports;
|
|
2353
2362
|
})();
|
|
2354
2363
|
|
|
2355
|
-
const _m21 = _modules.get("
|
|
2364
|
+
const _m21 = _modules.get("7825c87ba92a9992baf6b5c8a5e146948268985c31584ef9c8bf395359942e4f") ?? (() => {
|
|
2356
2365
|
const { NotSupportedError, OfficeIMOError } = _m4;
|
|
2357
2366
|
|
|
2358
2367
|
const { fontProgram } = _m22;
|
|
@@ -2553,7 +2562,7 @@ class PdfFontResources {
|
|
|
2553
2562
|
this.fontBytes += bytes;
|
|
2554
2563
|
this.registered.add(font);
|
|
2555
2564
|
}
|
|
2556
|
-
select(bold = false, italic = false, explicit) {
|
|
2565
|
+
select(bold = false, italic = false, explicit, standardForMissingFace = false) {
|
|
2557
2566
|
if (explicit)
|
|
2558
2567
|
this.registerFont(explicit);
|
|
2559
2568
|
let selections = this.selections;
|
|
@@ -2563,10 +2572,13 @@ class PdfFontResources {
|
|
|
2563
2572
|
if (!found)
|
|
2564
2573
|
this.explicitSelections.set(explicit, selections);
|
|
2565
2574
|
}
|
|
2566
|
-
const
|
|
2575
|
+
const fallback = standardForMissingFace && !explicit && this.fonts !== undefined &&
|
|
2576
|
+
this.fonts[bold ? italic ? "boldItalic" : "bold" : italic ? "italic" : "regular"] === undefined;
|
|
2577
|
+
const key = (bold ? 2 : 0) | (italic ? 1 : 0) | (fallback ? 4 : 0), existing = selections.get(key);
|
|
2567
2578
|
if (existing)
|
|
2568
2579
|
return existing;
|
|
2569
|
-
const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } :
|
|
2580
|
+
const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } :
|
|
2581
|
+
selectFont(fallback ? undefined : this.fonts, bold, italic);
|
|
2570
2582
|
const shared = font ? this.programs.get(font) : undefined;
|
|
2571
2583
|
const resource = new PdfFontResource(this.resources.length + 1, bold, italic, font, this.objects, syntheticBold, syntheticItalic, shared, this.signal);
|
|
2572
2584
|
if (!shared) {
|
|
@@ -2580,7 +2592,7 @@ class PdfFontResources {
|
|
|
2580
2592
|
dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
|
|
2581
2593
|
}
|
|
2582
2594
|
const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
|
|
2583
|
-
_modules.set("
|
|
2595
|
+
_modules.set("7825c87ba92a9992baf6b5c8a5e146948268985c31584ef9c8bf395359942e4f", _exports);
|
|
2584
2596
|
return _exports;
|
|
2585
2597
|
})();
|
|
2586
2598
|
|
|
@@ -2957,7 +2969,7 @@ _modules.set("8be3fb029e08d100ce8ffcf50916d5ba7f7bc00d62156cc33815fd58554a9ed6",
|
|
|
2957
2969
|
return _exports;
|
|
2958
2970
|
})();
|
|
2959
2971
|
|
|
2960
|
-
const _m31 = _modules.get("
|
|
2972
|
+
const _m31 = _modules.get("abbfad7ffb3c318822659c9fbde9126630ce2c137dc2e2b88402148424255e2d") ?? (() => {
|
|
2961
2973
|
const { NotSupportedError, OfficeIMOError } = _m4;
|
|
2962
2974
|
|
|
2963
2975
|
const { copyExportLink } = _m9;
|
|
@@ -3149,11 +3161,11 @@ async function wrapPdfText(captured, fonts, size, width, settings, wrap = true)
|
|
|
3149
3161
|
return lines;
|
|
3150
3162
|
}
|
|
3151
3163
|
const _exports = Object.freeze({ capturePdfText: capturePdfText, wrapPdfText: wrapPdfText });
|
|
3152
|
-
_modules.set("
|
|
3164
|
+
_modules.set("abbfad7ffb3c318822659c9fbde9126630ce2c137dc2e2b88402148424255e2d", _exports);
|
|
3153
3165
|
return _exports;
|
|
3154
3166
|
})();
|
|
3155
3167
|
|
|
3156
|
-
const _m33 = _modules.get("
|
|
3168
|
+
const _m33 = _modules.get("04b189837f06067364240b6731efdf86d61d81fd0848fac3666f25c5f27817b8") ?? (() => {
|
|
3157
3169
|
const { OfficeIMOError } = _m4;
|
|
3158
3170
|
|
|
3159
3171
|
const { wrapPdfText } = _m31;
|
|
@@ -3248,11 +3260,11 @@ function alignBandBlocks(bands, settings) {
|
|
|
3248
3260
|
cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
|
|
3249
3261
|
}
|
|
3250
3262
|
const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
|
|
3251
|
-
_modules.set("
|
|
3263
|
+
_modules.set("04b189837f06067364240b6731efdf86d61d81fd0848fac3666f25c5f27817b8", _exports);
|
|
3252
3264
|
return _exports;
|
|
3253
3265
|
})();
|
|
3254
3266
|
|
|
3255
|
-
const _m28 = _modules.get("
|
|
3267
|
+
const _m28 = _modules.get("6fd77694f46f8c87510a82e8a58a3c424099d6172bfb1942f92d048b39169945") ?? (() => {
|
|
3256
3268
|
const { ExportCell } = _m7;
|
|
3257
3269
|
|
|
3258
3270
|
const { copyExportLink } = _m9;
|
|
@@ -3483,7 +3495,7 @@ class PdfTableLayout {
|
|
|
3483
3495
|
}
|
|
3484
3496
|
}
|
|
3485
3497
|
const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
|
|
3486
|
-
_modules.set("
|
|
3498
|
+
_modules.set("6fd77694f46f8c87510a82e8a58a3c424099d6172bfb1942f92d048b39169945", _exports);
|
|
3487
3499
|
return _exports;
|
|
3488
3500
|
})();
|
|
3489
3501
|
|
|
@@ -3839,7 +3851,7 @@ _modules.set("c68d18d668366fb9b96d1b53c79dc6305f84cb83c05e4942fcf1cdf96ed1a73f",
|
|
|
3839
3851
|
return _exports;
|
|
3840
3852
|
})();
|
|
3841
3853
|
|
|
3842
|
-
const _m39 = _modules.get("
|
|
3854
|
+
const _m39 = _modules.get("8fc594bfca7312071f0f128ad25fb929d023d176323e66e389cddd27032a4d15") ?? (() => {
|
|
3843
3855
|
const { settings } = _m11;
|
|
3844
3856
|
|
|
3845
3857
|
/** @internal Every section derives from captured document defaults, never the preceding section. */
|
|
@@ -3854,11 +3866,11 @@ function sectionSettings(base, section) {
|
|
|
3854
3866
|
return { ...base, page: derived.page, margins: derived.margins, options };
|
|
3855
3867
|
}
|
|
3856
3868
|
const _exports = Object.freeze({ sectionSettings: sectionSettings });
|
|
3857
|
-
_modules.set("
|
|
3869
|
+
_modules.set("8fc594bfca7312071f0f128ad25fb929d023d176323e66e389cddd27032a4d15", _exports);
|
|
3858
3870
|
return _exports;
|
|
3859
3871
|
})();
|
|
3860
3872
|
|
|
3861
|
-
const _m34 = _modules.get("
|
|
3873
|
+
const _m34 = _modules.get("c16c0303d9d4be12ab9e0bab7cfdac73b252ed233c9689e3e0141cc8115aa941") ?? (() => {
|
|
3862
3874
|
const { OfficeIMOError } = _m4;
|
|
3863
3875
|
|
|
3864
3876
|
const { checkAbort } = _m3;
|
|
@@ -3919,6 +3931,7 @@ class PdfPages {
|
|
|
3919
3931
|
rectangleLefts;
|
|
3920
3932
|
rectangleColumns = [];
|
|
3921
3933
|
externalObjects = new Map();
|
|
3934
|
+
opacityStates = new Map();
|
|
3922
3935
|
bandFlow;
|
|
3923
3936
|
bandCellBudget = false;
|
|
3924
3937
|
tableElement;
|
|
@@ -4501,6 +4514,20 @@ class PdfPages {
|
|
|
4501
4514
|
}
|
|
4502
4515
|
async pageBreak() { await this.ensureStarted(); await this.finishPage(); await this.start(false); }
|
|
4503
4516
|
registerXObject(name, id) { this.externalObjects.set(name, id); }
|
|
4517
|
+
/** One shared constant-opacity graphics state per serialized alpha value. */
|
|
4518
|
+
opacityState(alpha) {
|
|
4519
|
+
const value = pdfNumber(alpha);
|
|
4520
|
+
let name = this.opacityStates.get(value);
|
|
4521
|
+
if (!name) {
|
|
4522
|
+
name = "GA" + (this.opacityStates.size + 1);
|
|
4523
|
+
this.opacityStates.set(value, name);
|
|
4524
|
+
}
|
|
4525
|
+
return name;
|
|
4526
|
+
}
|
|
4527
|
+
graphicsStates() {
|
|
4528
|
+
const entries = [...this.opacityStates].map(([alpha, name]) => "/" + name + " << /ca " + alpha + " /CA " + alpha + " >>");
|
|
4529
|
+
return entries.length ? " /ExtGState << " + entries.join(" ") + " >>" : "";
|
|
4530
|
+
}
|
|
4504
4531
|
/** Height after the existing fit-to-page graphic policy, used by heading keep constraints. */
|
|
4505
4532
|
graphicHeight(width, height) {
|
|
4506
4533
|
const { page, margins } = this.settings;
|
|
@@ -4596,7 +4623,7 @@ class PdfPages {
|
|
|
4596
4623
|
}
|
|
4597
4624
|
}
|
|
4598
4625
|
const _exports = Object.freeze({ PdfPages: PdfPages });
|
|
4599
|
-
_modules.set("
|
|
4626
|
+
_modules.set("c16c0303d9d4be12ab9e0bab7cfdac73b252ed233c9689e3e0141cc8115aa941", _exports);
|
|
4600
4627
|
return _exports;
|
|
4601
4628
|
})();
|
|
4602
4629
|
|
|
@@ -5039,7 +5066,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
|
|
|
5039
5066
|
return _exports;
|
|
5040
5067
|
})();
|
|
5041
5068
|
|
|
5042
|
-
const _m18 = _modules.get("
|
|
5069
|
+
const _m18 = _modules.get("3de6cb5a744388b84e9e2295a2e580e70ab993d44bbb4c94da5f98daba11c350") ?? (() => {
|
|
5043
5070
|
const { PdfObjects, unicodeHex } = _m19;
|
|
5044
5071
|
|
|
5045
5072
|
const { PdfFontResources } = _m21;
|
|
@@ -5091,22 +5118,23 @@ class PdfWriteSession {
|
|
|
5091
5118
|
await pages.finish();
|
|
5092
5119
|
for (const font of fonts.resources)
|
|
5093
5120
|
await font.write(objects, options.compression !== false);
|
|
5094
|
-
await objects.object(this.resources, "<< /Font " + fonts.dictionary() + pages.xobjects() + " >>");
|
|
5121
|
+
await objects.object(this.resources, "<< /Font " + fonts.dictionary() + pages.xobjects() + pages.graphicsStates() + " >>");
|
|
5095
5122
|
await objects.object(this.parent, "<< /Type /Pages /Count " + pages.references.length + " /Kids [" + pages.references.map(id => id + " 0 R").join(" ") + "] >>");
|
|
5096
5123
|
if (this.structure)
|
|
5097
5124
|
await this.structure.finish();
|
|
5098
5125
|
await this.outlines.finish();
|
|
5099
5126
|
await objects.object(this.root, "<< /Type /Catalog /Pages " + this.parent + " 0 R" + (this.structure?.catalogDictionary ?? "") + this.outlines.catalogDictionary + " >>");
|
|
5100
|
-
|
|
5127
|
+
const title = options.metadataTitle ?? options.title;
|
|
5128
|
+
await objects.object(this.info, "<< /Producer (OfficeIMO.js)" + (title === undefined ? "" : " /Title <feff" + unicodeHex(title) + ">") + " >>");
|
|
5101
5129
|
await objects.finish(this.root, this.info);
|
|
5102
5130
|
}
|
|
5103
5131
|
}
|
|
5104
5132
|
const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
|
|
5105
|
-
_modules.set("
|
|
5133
|
+
_modules.set("3de6cb5a744388b84e9e2295a2e580e70ab993d44bbb4c94da5f98daba11c350", _exports);
|
|
5106
5134
|
return _exports;
|
|
5107
5135
|
})();
|
|
5108
5136
|
|
|
5109
|
-
const _m1 = _modules.get("
|
|
5137
|
+
const _m1 = _modules.get("01ffda1779a340d72e953fd6e02429f341c89fcab28eb0fce4dc8beb65a5fd43") ?? (() => {
|
|
5110
5138
|
const { BlobByteSink, withDestination } = _m2;
|
|
5111
5139
|
|
|
5112
5140
|
const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m3;
|
|
@@ -5171,7 +5199,7 @@ async function writePdfTo(rows, destination, configuration) {
|
|
|
5171
5199
|
});
|
|
5172
5200
|
}
|
|
5173
5201
|
const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
|
|
5174
|
-
_modules.set("
|
|
5202
|
+
_modules.set("01ffda1779a340d72e953fd6e02429f341c89fcab28eb0fce4dc8beb65a5fd43", _exports);
|
|
5175
5203
|
return _exports;
|
|
5176
5204
|
})();
|
|
5177
5205
|
|
|
@@ -5464,7 +5492,7 @@ _modules.set("790c15edc51b308be3e7d8222630d407f8c79c31ab21ba0b9f92c00f44ab4021",
|
|
|
5464
5492
|
return _exports;
|
|
5465
5493
|
})();
|
|
5466
5494
|
|
|
5467
|
-
const _m47 = _modules.get("
|
|
5495
|
+
const _m47 = _modules.get("6b0244b5ec6d550c705b4e4cbb47997331f1ecd99e2bf8a06f7c646eebbffbf8") ?? (() => {
|
|
5468
5496
|
const { NotSupportedError, OfficeIMOError } = _m4;
|
|
5469
5497
|
|
|
5470
5498
|
const { checkAbort, pause, taskYieldDue, withAbort } = _m3;
|
|
@@ -5473,15 +5501,10 @@ const { Crc32 } = _m48;
|
|
|
5473
5501
|
|
|
5474
5502
|
const signature = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
5475
5503
|
const unsupportedChunks = new Set(["PLTE", "tRNS", "iCCP", "sRGB", "gAMA", "cHRM", "cICP", "mDCV", "cLLI", "sBIT", "eXIf", "acTL", "fcTL", "fdAT"]);
|
|
5476
|
-
/** Decode
|
|
5477
|
-
async function pngPixels(
|
|
5504
|
+
/** Decode an owned static unprofiled PNG without canvas or a second compression engine. */
|
|
5505
|
+
async function pngPixels(source, shape, signal) {
|
|
5478
5506
|
checkAbort(signal);
|
|
5479
|
-
const shape = pngShape(inputSource, maxPixels);
|
|
5480
5507
|
const imagePixels = shape.width * shape.height;
|
|
5481
|
-
const workingBytes = inputSource.length + imagePixels * shape.components + (shape.components === 4 ? shape.width * 8 : 0);
|
|
5482
|
-
if (maxWorkingBytes !== undefined && workingBytes > maxWorkingBytes)
|
|
5483
|
-
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageWorkingBytes exceeded by PNG source, image planes and scanlines.");
|
|
5484
|
-
const source = new Uint8Array(inputSource);
|
|
5485
5508
|
const header = await pngHeader(source, shape, signal);
|
|
5486
5509
|
checkAbort(signal);
|
|
5487
5510
|
let stream;
|
|
@@ -5495,9 +5518,6 @@ async function pngPixels(inputSource, maxPixels, signal, maxWorkingBytes) {
|
|
|
5495
5518
|
}
|
|
5496
5519
|
const { width, height, components } = header, rowBytes = width * components;
|
|
5497
5520
|
const expected = (rowBytes + 1) * height;
|
|
5498
|
-
// All dimensions and the exact filtered length are bounded before allocating decoded pixels.
|
|
5499
|
-
if (!Number.isSafeInteger(expected) || expected > 0x7fffffff)
|
|
5500
|
-
throw new OfficeIMOError("RESOURCE_LIMIT", "PNG filtered data exceeds the supported decoded byte length.");
|
|
5501
5521
|
// RGBA is reconstructed one scanline at a time directly into PDF RGB/alpha planes.
|
|
5502
5522
|
// It never retains an additional full interleaved RGBA image.
|
|
5503
5523
|
const pixels = new Uint8Array(width * height * 3), alpha = components === 4 ? new Uint8Array(imagePixels) : undefined;
|
|
@@ -5645,20 +5665,55 @@ async function verifyPngZlibEnd(source, header, expected, signal) {
|
|
|
5645
5665
|
reader.releaseLock();
|
|
5646
5666
|
}
|
|
5647
5667
|
}
|
|
5668
|
+
function pngChunk(source, view, offset) {
|
|
5669
|
+
if (offset + 12 > source.length)
|
|
5670
|
+
throw new TypeError("Truncated PNG chunk.");
|
|
5671
|
+
const length = view.getUint32(offset), end = offset + 12 + length;
|
|
5672
|
+
if (length > 0x7fffffff || end > source.length)
|
|
5673
|
+
throw new TypeError("Truncated or oversized PNG chunk.");
|
|
5674
|
+
const type = String.fromCharCode(...source.subarray(offset + 4, offset + 8));
|
|
5675
|
+
if (!/^[A-Za-z]{2}[A-Z][A-Za-z]$/.test(type))
|
|
5676
|
+
throw new TypeError("Invalid PNG chunk type.");
|
|
5677
|
+
return { length, end, type };
|
|
5678
|
+
}
|
|
5679
|
+
function checkAncillaryChunk(type) {
|
|
5680
|
+
if (unsupportedChunks.has(type))
|
|
5681
|
+
throw new NotSupportedError("PNG chunk " + type + "; normalize color, orientation, transparency or animation first");
|
|
5682
|
+
if (type.charCodeAt(0) < 97)
|
|
5683
|
+
throw new NotSupportedError("Required PNG chunk " + type);
|
|
5684
|
+
}
|
|
5685
|
+
/** Check the image profile for SVG placement without inflating pixels. Embedding still verifies CRCs and image data. */
|
|
5686
|
+
function pngEmbeddableSize(source) {
|
|
5687
|
+
const shape = pngShape(source, Infinity);
|
|
5688
|
+
const view = new DataView(source.buffer, source.byteOffset, source.byteLength);
|
|
5689
|
+
let hasData = false, dataClosed = false;
|
|
5690
|
+
for (let offset = 33; offset < source.length;) {
|
|
5691
|
+
const { length, end, type } = pngChunk(source, view, offset);
|
|
5692
|
+
if (type === "IEND") {
|
|
5693
|
+
if (length === 0 && hasData && end === source.length)
|
|
5694
|
+
return shape;
|
|
5695
|
+
break;
|
|
5696
|
+
}
|
|
5697
|
+
if (type === "IDAT") {
|
|
5698
|
+
if (dataClosed)
|
|
5699
|
+
throw new TypeError("PNG IDAT chunks must be consecutive.");
|
|
5700
|
+
hasData = true;
|
|
5701
|
+
}
|
|
5702
|
+
else {
|
|
5703
|
+
checkAncillaryChunk(type);
|
|
5704
|
+
dataClosed ||= hasData;
|
|
5705
|
+
}
|
|
5706
|
+
offset = end;
|
|
5707
|
+
}
|
|
5708
|
+
throw new TypeError("PNG requires a final empty IEND after IDAT.");
|
|
5709
|
+
}
|
|
5648
5710
|
/** Verify the complete source and critical chunk order before any decompressed image allocation. */
|
|
5649
5711
|
async function pngHeader(source, shape, signal) {
|
|
5650
5712
|
const view = new DataView(source.buffer, source.byteOffset, source.byteLength);
|
|
5651
5713
|
let firstData = 0, dataEnd = 0, lastDataByte = -1, dataClosed = false;
|
|
5652
5714
|
for (let offset = 8; offset < source.length;) {
|
|
5653
5715
|
checkAbort(signal);
|
|
5654
|
-
|
|
5655
|
-
throw new TypeError("Truncated PNG chunk.");
|
|
5656
|
-
const length = view.getUint32(offset), end = offset + 12 + length;
|
|
5657
|
-
if (length > 0x7fffffff || end > source.length)
|
|
5658
|
-
throw new TypeError("Truncated or oversized PNG chunk.");
|
|
5659
|
-
const type = String.fromCharCode(...source.subarray(offset + 4, offset + 8));
|
|
5660
|
-
if (!/^[A-Za-z]{2}[A-Z][A-Za-z]$/.test(type))
|
|
5661
|
-
throw new TypeError("Invalid PNG chunk type.");
|
|
5716
|
+
const { length, end, type } = pngChunk(source, view, offset);
|
|
5662
5717
|
const crc = new Crc32();
|
|
5663
5718
|
for (let p = offset + 4; p < end - 4; p += 65536) {
|
|
5664
5719
|
crc.update(source.subarray(p, Math.min(end - 4, p + 65536)));
|
|
@@ -5690,17 +5745,14 @@ async function pngHeader(source, shape, signal) {
|
|
|
5690
5745
|
throw new TypeError("PNG requires a final empty IEND after IDAT.");
|
|
5691
5746
|
return { ...shape, firstData, dataEnd, lastDataByte };
|
|
5692
5747
|
}
|
|
5693
|
-
|
|
5694
|
-
throw new NotSupportedError("PNG chunk " + type + "; normalize color, orientation, transparency or animation first");
|
|
5695
|
-
if ((source[offset + 4] & 32) === 0)
|
|
5696
|
-
throw new NotSupportedError("Required PNG chunk " + type);
|
|
5748
|
+
checkAncillaryChunk(type);
|
|
5697
5749
|
}
|
|
5698
5750
|
offset = end;
|
|
5699
5751
|
}
|
|
5700
5752
|
throw new TypeError("PNG requires a complete final IEND chunk.");
|
|
5701
5753
|
}
|
|
5702
5754
|
/** Check source metadata synchronously, before capturing source bytes or allocating any image plane. */
|
|
5703
|
-
function pngShape(source, maxPixels) {
|
|
5755
|
+
function pngShape(source, maxPixels, maxWorkingBytes) {
|
|
5704
5756
|
if (source.length < 33 || signature.some((value, index) => source[index] !== value))
|
|
5705
5757
|
throw new TypeError("Invalid PNG signature or truncated IHDR.");
|
|
5706
5758
|
const view = new DataView(source.buffer, source.byteOffset, source.byteLength);
|
|
@@ -5720,6 +5772,9 @@ function pngShape(source, maxPixels) {
|
|
|
5720
5772
|
const components = source[25] === 6 ? 4 : 3;
|
|
5721
5773
|
if (!Number.isSafeInteger((width * components + 1) * height) || (width * components + 1) * height > 0x7fffffff)
|
|
5722
5774
|
throw new OfficeIMOError("RESOURCE_LIMIT", "PNG filtered data exceeds the supported decoded byte length.");
|
|
5775
|
+
const workingBytes = source.length + width * height * components + (components === 4 ? width * 8 : 0);
|
|
5776
|
+
if (maxWorkingBytes !== undefined && workingBytes > maxWorkingBytes)
|
|
5777
|
+
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageWorkingBytes exceeded by PNG source, image planes and scanlines.");
|
|
5723
5778
|
return { width, height, components };
|
|
5724
5779
|
}
|
|
5725
5780
|
function paeth(left, up, upperLeft) {
|
|
@@ -5727,64 +5782,93 @@ function paeth(left, up, upperLeft) {
|
|
|
5727
5782
|
const a = Math.abs(prediction - left), b = Math.abs(prediction - up), c = Math.abs(prediction - upperLeft);
|
|
5728
5783
|
return a <= b && a <= c ? left : b <= c ? up : upperLeft;
|
|
5729
5784
|
}
|
|
5730
|
-
const _exports = Object.freeze({ pngPixels: pngPixels });
|
|
5731
|
-
_modules.set("
|
|
5785
|
+
const _exports = Object.freeze({ pngPixels: pngPixels, pngEmbeddableSize: pngEmbeddableSize, pngShape: pngShape });
|
|
5786
|
+
_modules.set("6b0244b5ec6d550c705b4e4cbb47997331f1ecd99e2bf8a06f7c646eebbffbf8", _exports);
|
|
5732
5787
|
return _exports;
|
|
5733
5788
|
})();
|
|
5734
5789
|
|
|
5735
|
-
const _m46 = _modules.get("
|
|
5790
|
+
const _m46 = _modules.get("32ca4982f963f400829c2e364b7d3479f36d91740dafb32d600f29b5cac487ec") ?? (() => {
|
|
5736
5791
|
const { NotSupportedError, OfficeIMOError } = _m4;
|
|
5737
5792
|
|
|
5738
5793
|
const { checkAbort, pause, taskYieldDue } = _m3;
|
|
5739
5794
|
|
|
5740
|
-
const { pngPixels } = _m47;
|
|
5795
|
+
const { pngPixels, pngShape } = _m47;
|
|
5741
5796
|
|
|
5742
5797
|
/** Shared document image resources; source objects are captured on first consumption. */
|
|
5743
5798
|
class PdfDocumentImages {
|
|
5744
5799
|
objects;
|
|
5745
5800
|
settings;
|
|
5746
5801
|
images = new Map();
|
|
5802
|
+
snapshots = new WeakMap();
|
|
5747
5803
|
bytes = 0;
|
|
5804
|
+
pendingBytes = 0;
|
|
5748
5805
|
constructor(objects, settings) {
|
|
5749
5806
|
this.objects = objects;
|
|
5750
5807
|
this.settings = settings;
|
|
5751
5808
|
}
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
if (
|
|
5755
|
-
return
|
|
5809
|
+
/** Own a drawing image before preparing earlier elements can yield to the caller. */
|
|
5810
|
+
snapshot(image) {
|
|
5811
|
+
if (this.images.has(image) || this.snapshots.has(image))
|
|
5812
|
+
return;
|
|
5813
|
+
const captured = this.capture(image);
|
|
5814
|
+
this.snapshots.set(image, captured);
|
|
5815
|
+
this.pendingBytes += captured.data.length;
|
|
5816
|
+
}
|
|
5817
|
+
capture(image) {
|
|
5756
5818
|
const { limits, options } = this.settings;
|
|
5819
|
+
checkAbort(options.signal);
|
|
5757
5820
|
if (!image || typeof image !== "object")
|
|
5758
5821
|
throw new TypeError("PDF images require a byte array.");
|
|
5759
|
-
const
|
|
5822
|
+
const format = image.format;
|
|
5823
|
+
// Dimension getters may change a resizable backing buffer. Read them before measuring the byte view.
|
|
5824
|
+
const raw = format === "rgb" || format === "rgba" ? image : undefined;
|
|
5825
|
+
const widthValue = raw?.width, heightValue = raw?.height;
|
|
5826
|
+
const data = image.data;
|
|
5760
5827
|
if (!(data instanceof Uint8Array))
|
|
5761
5828
|
throw new TypeError("PDF images require a byte array.");
|
|
5762
5829
|
const byteLength = data.length;
|
|
5763
|
-
if (this.bytes + byteLength > limits.maxImageBytes)
|
|
5830
|
+
if (this.bytes + this.pendingBytes + byteLength > limits.maxImageBytes)
|
|
5764
5831
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageBytes exceeded.");
|
|
5765
|
-
let width, height, components, decoded, decodedAlpha;
|
|
5766
5832
|
const maximumWorkingBytes = limits.maxImageWorkingBytes;
|
|
5767
|
-
if (format === "png")
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5833
|
+
if (format === "png") {
|
|
5834
|
+
const shape = pngShape(data, limits.maxImagePixels, maximumWorkingBytes);
|
|
5835
|
+
return { format, shape, data: new Uint8Array(data) };
|
|
5836
|
+
}
|
|
5837
|
+
let shape;
|
|
5838
|
+
if (format === "jpeg")
|
|
5839
|
+
shape = jpegSize(data);
|
|
5771
5840
|
else if (format === "rgb" || format === "rgba") {
|
|
5772
|
-
|
|
5773
|
-
components = format === "rgba" ? 4 : 3;
|
|
5841
|
+
shape = { width: widthValue, height: heightValue, components: format === "rgba" ? 4 : 3 };
|
|
5774
5842
|
}
|
|
5775
5843
|
else
|
|
5776
5844
|
throw new NotSupportedError("PDF images support unprofiled PNG/JPEG or decoded RGB/RGBA pixels.");
|
|
5845
|
+
const { width, height, components } = shape;
|
|
5777
5846
|
if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width < 1 || height < 1 ||
|
|
5778
5847
|
!Number.isSafeInteger(width * height) || width * height > limits.maxImagePixels)
|
|
5779
5848
|
throw new OfficeIMOError("RESOURCE_LIMIT", "Image dimensions must be positive integers within maxImagePixels.");
|
|
5780
|
-
if (
|
|
5849
|
+
if (format !== "jpeg" && byteLength !== width * height * components)
|
|
5781
5850
|
throw new RangeError("Raw image bytes must match width × height × channels exactly.");
|
|
5782
|
-
if (
|
|
5851
|
+
if (maximumWorkingBytes !== undefined && byteLength + (components === 4 ? width * height : 0) > maximumWorkingBytes)
|
|
5783
5852
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxImageWorkingBytes exceeded by image snapshot and alpha plane.");
|
|
5853
|
+
return { format, shape, data: new Uint8Array(data) };
|
|
5854
|
+
}
|
|
5855
|
+
async prepare(image) {
|
|
5856
|
+
const existing = this.images.get(image);
|
|
5857
|
+
if (existing)
|
|
5858
|
+
return existing;
|
|
5859
|
+
const { options } = this.settings, snapshot = this.snapshots.get(image);
|
|
5860
|
+
const source = snapshot ?? this.capture(image);
|
|
5861
|
+
if (snapshot) {
|
|
5862
|
+
this.snapshots.delete(image);
|
|
5863
|
+
this.pendingBytes -= source.data.length;
|
|
5864
|
+
}
|
|
5865
|
+
this.bytes += source.data.length;
|
|
5866
|
+
const { format } = source;
|
|
5867
|
+
const decoded = format === "png" ? await pngPixels(source.data, source.shape, options.signal) : undefined;
|
|
5868
|
+
const { width, height, components } = decoded ?? source.shape;
|
|
5784
5869
|
checkAbort(options.signal);
|
|
5785
5870
|
const id = this.objects.reserve(), name = "Image" + (this.images.size + 1);
|
|
5786
|
-
|
|
5787
|
-
const captured = decoded ?? new Uint8Array(data);
|
|
5871
|
+
const captured = decoded?.data ?? source.data, decodedAlpha = decoded?.alpha;
|
|
5788
5872
|
let pixels = captured, alpha = decodedAlpha, mask;
|
|
5789
5873
|
if (components === 4) {
|
|
5790
5874
|
// Compact the owned RGBA snapshot in place. Forward writes never overwrite unread channels.
|
|
@@ -5806,20 +5890,22 @@ class PdfDocumentImages {
|
|
|
5806
5890
|
mask = this.objects.reserve();
|
|
5807
5891
|
await this.objects.stream(mask, alpha, "/Type /XObject /Subtype /Image /Width " + width + " /Height " + height + " /ColorSpace /DeviceGray /BitsPerComponent 8", options.compression !== false, true);
|
|
5808
5892
|
}
|
|
5893
|
+
const jpegFilter = format === "jpeg" ? " /Filter /DCTDecode" +
|
|
5894
|
+
(source.shape.colorTransform === 0 ? " /DecodeParms << /ColorTransform 0 >>" : "") : "";
|
|
5809
5895
|
const dictionary = "/Type /XObject /Subtype /Image /Width " + width + " /Height " + height + " /ColorSpace /" +
|
|
5810
5896
|
(components === 1 ? "DeviceGray" : "DeviceRGB") + " /BitsPerComponent 8" + (mask ? " /SMask " + mask + " 0 R" : "") +
|
|
5811
|
-
|
|
5897
|
+
jpegFilter;
|
|
5812
5898
|
await this.objects.stream(id, pixels, dictionary, format === "jpeg" ? false : options.compression !== false, true);
|
|
5813
5899
|
const resource = { name, id, width, height };
|
|
5814
5900
|
this.images.set(image, resource);
|
|
5815
5901
|
return resource;
|
|
5816
5902
|
}
|
|
5817
5903
|
}
|
|
5818
|
-
/** Inspect bounded JPEG headers; JPEG entropy decoding remains the independent reader's job. */
|
|
5904
|
+
/** @internal Inspect bounded JPEG headers; JPEG entropy decoding remains the independent reader's job. */
|
|
5819
5905
|
function jpegSize(bytes) {
|
|
5820
5906
|
if (bytes.length < 4 || bytes[0] !== 255 || bytes[1] !== 216 || bytes[bytes.length - 2] !== 255 || bytes[bytes.length - 1] !== 217)
|
|
5821
5907
|
throw new TypeError("JPEG images need complete SOI/EOI markers.");
|
|
5822
|
-
let result;
|
|
5908
|
+
let result, rgb = false, adobe = false;
|
|
5823
5909
|
for (let p = 2; p < bytes.length;) {
|
|
5824
5910
|
if (bytes[p++] !== 255)
|
|
5825
5911
|
throw new TypeError("Invalid JPEG marker.");
|
|
@@ -5829,7 +5915,8 @@ function jpegSize(bytes) {
|
|
|
5829
5915
|
if (marker === 218) {
|
|
5830
5916
|
if (!result)
|
|
5831
5917
|
throw new TypeError("JPEG scan precedes its frame header.");
|
|
5832
|
-
|
|
5918
|
+
// PDF decoders otherwise assume a color transform for three-component JPEGs.
|
|
5919
|
+
return rgb && !adobe ? { ...result, colorTransform: 0 } : result;
|
|
5833
5920
|
}
|
|
5834
5921
|
if (marker === 217)
|
|
5835
5922
|
break;
|
|
@@ -5838,6 +5925,8 @@ function jpegSize(bytes) {
|
|
|
5838
5925
|
const length = bytes[p] * 256 + bytes[p + 1], end = p + length;
|
|
5839
5926
|
if (length < 2 || end > bytes.length)
|
|
5840
5927
|
throw new TypeError("Truncated JPEG segment.");
|
|
5928
|
+
if (marker === 238 && length >= 14 && String.fromCharCode(...bytes.subarray(p + 2, p + 7)) === "Adobe")
|
|
5929
|
+
adobe = true;
|
|
5841
5930
|
if (marker === 226 && length >= 14 && String.fromCharCode(...bytes.subarray(p + 2, p + 14)) === "ICC_PROFILE\0")
|
|
5842
5931
|
throw new NotSupportedError("Normalize ICC-profiled JPEG colors before PDF embedding.");
|
|
5843
5932
|
if (marker === 225 && length >= 8 && String.fromCharCode(...bytes.subarray(p + 2, p + 8)) === "Exif\0\0")
|
|
@@ -5850,7 +5939,8 @@ function jpegSize(bytes) {
|
|
|
5850
5939
|
throw new NotSupportedError("PDF JPEG images require grayscale or RGB components; CMYK is unsupported.");
|
|
5851
5940
|
if (components === 3) {
|
|
5852
5941
|
const ids = [bytes[p + 8], bytes[p + 11], bytes[p + 14]].join(",");
|
|
5853
|
-
|
|
5942
|
+
rgb = ids === "82,71,66";
|
|
5943
|
+
if (ids !== "1,2,3" && !rgb)
|
|
5854
5944
|
throw new NotSupportedError("Unsupported JPEG component color layout.");
|
|
5855
5945
|
}
|
|
5856
5946
|
if (result)
|
|
@@ -5861,12 +5951,12 @@ function jpegSize(bytes) {
|
|
|
5861
5951
|
}
|
|
5862
5952
|
throw new TypeError("JPEG image has no complete frame and scan.");
|
|
5863
5953
|
}
|
|
5864
|
-
const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages });
|
|
5865
|
-
_modules.set("
|
|
5954
|
+
const _exports = Object.freeze({ PdfDocumentImages: PdfDocumentImages, jpegSize: jpegSize });
|
|
5955
|
+
_modules.set("32ca4982f963f400829c2e364b7d3479f36d91740dafb32d600f29b5cac487ec", _exports);
|
|
5866
5956
|
return _exports;
|
|
5867
5957
|
})();
|
|
5868
5958
|
|
|
5869
|
-
const _m49 = _modules.get("
|
|
5959
|
+
const _m49 = _modules.get("9ba2dfd6f5c8ef9b1a51427ddee0d0971b139afdd49a175bf6525812ca7d87c8") ?? (() => {
|
|
5870
5960
|
const { OfficeIMOError } = _m4;
|
|
5871
5961
|
|
|
5872
5962
|
const { checkAbort, pause, taskYieldDue } = _m3;
|
|
@@ -5949,16 +6039,16 @@ async function vectorCommands(block, settings, used) {
|
|
|
5949
6039
|
commands.join("") + (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
|
|
5950
6040
|
}
|
|
5951
6041
|
const _exports = Object.freeze({ vectorCommands: vectorCommands });
|
|
5952
|
-
_modules.set("
|
|
6042
|
+
_modules.set("9ba2dfd6f5c8ef9b1a51427ddee0d0971b139afdd49a175bf6525812ca7d87c8", _exports);
|
|
5953
6043
|
return _exports;
|
|
5954
6044
|
})();
|
|
5955
6045
|
|
|
5956
|
-
const _m50 = _modules.get("
|
|
6046
|
+
const _m50 = _modules.get("da0657c49ac1393409d051be5e5dd70d2a0dc5221d363b422d7da31e9b940ea2") ?? (() => {
|
|
5957
6047
|
const { NotSupportedError, OfficeIMOError } = _m4;
|
|
5958
6048
|
|
|
5959
6049
|
const { checkAbort, pause, taskYieldDue } = _m3;
|
|
5960
6050
|
|
|
5961
|
-
const { color, positive } = _m11;
|
|
6051
|
+
const { color, pdfDrawingMaxDepth, positive } = _m11;
|
|
5962
6052
|
|
|
5963
6053
|
const { pdfNumber: n } = _m19;
|
|
5964
6054
|
|
|
@@ -5980,22 +6070,50 @@ function clipRectangle(value) {
|
|
|
5980
6070
|
const clip = record(value, ["x", "y", "width", "height"], "drawing clip");
|
|
5981
6071
|
return { x: coordinate(clip.x), y: coordinate(clip.y), width: positive(clip.width, "Drawing clip width", 1000000), height: positive(clip.height, "Drawing clip height", 1000000) };
|
|
5982
6072
|
}
|
|
6073
|
+
/** A PDF dash array: 1 through 16 nonnegative lengths, not all zero, and a finite phase. */
|
|
6074
|
+
function dashPattern(value, offset) {
|
|
6075
|
+
if (value === undefined) {
|
|
6076
|
+
if (offset !== undefined)
|
|
6077
|
+
throw new TypeError("Drawing dashOffset requires dash.");
|
|
6078
|
+
return "";
|
|
6079
|
+
}
|
|
6080
|
+
if (!Array.isArray(value) || !value.length || value.length > 16)
|
|
6081
|
+
throw new TypeError("Drawing dash must list 1 through 16 nonnegative lengths with at least one positive length.");
|
|
6082
|
+
const lengths = Array.from(value, item => {
|
|
6083
|
+
if (typeof item !== "number" || !Number.isFinite(item) || item < 0 || item > 14400)
|
|
6084
|
+
throw new TypeError("Drawing dash lengths must be from 0 through 14,400 points.");
|
|
6085
|
+
return n(item);
|
|
6086
|
+
});
|
|
6087
|
+
if (lengths.every(length => length === "0"))
|
|
6088
|
+
throw new TypeError("Drawing dash needs a positive length after PDF rounding.");
|
|
6089
|
+
let phase = coordinate(offset ?? 0);
|
|
6090
|
+
if (phase < 0) {
|
|
6091
|
+
// Work in serialized thousandths of a point. Odd arrays repeat twice before the paint state repeats.
|
|
6092
|
+
const period = lengths.reduce((sum, length) => sum + Math.round(Number(length) * 1000), 0) * (lengths.length % 2 ? 2 : 1);
|
|
6093
|
+
phase = ((Math.round(phase * 1000) % period + period) % period) / 1000;
|
|
6094
|
+
}
|
|
6095
|
+
return "[" + lengths.join(" ") + "] " + n(phase) + " d\n";
|
|
6096
|
+
}
|
|
5983
6097
|
async function cooperate(settings) {
|
|
5984
6098
|
if (taskYieldDue())
|
|
5985
6099
|
await pause();
|
|
5986
6100
|
checkAbort(settings.options.signal);
|
|
5987
6101
|
}
|
|
5988
6102
|
/** Take ownership of one bounded schema before any cooperative or font work can run caller code. */
|
|
5989
|
-
function captureDrawing(drawing, settings, used) {
|
|
6103
|
+
function captureDrawing(drawing, settings, used, images) {
|
|
5990
6104
|
checkAbort(settings.options.signal);
|
|
5991
|
-
const root = record(drawing, ["version", "width", "height", "elements"], "drawing");
|
|
5992
|
-
|
|
5993
|
-
|
|
6105
|
+
const root = record(drawing, ["version", "width", "height", "elements", "standardFonts"], "drawing");
|
|
6106
|
+
const standardFonts = root.standardFonts;
|
|
6107
|
+
if (standardFonts !== undefined && typeof standardFonts !== "boolean")
|
|
6108
|
+
throw new TypeError("Drawing standardFonts must be boolean.");
|
|
6109
|
+
const version = root.version;
|
|
6110
|
+
if (version !== 1 && version !== 2)
|
|
6111
|
+
throw new NotSupportedError("Only portable drawing versions 1 and 2 are supported.");
|
|
5994
6112
|
const width = positive(root.width, "Drawing width"), height = positive(root.height, "Drawing height");
|
|
5995
6113
|
let commands = used.commands, elements = used.elements;
|
|
5996
6114
|
const ancestors = new Set();
|
|
5997
6115
|
function path(value) {
|
|
5998
|
-
record(value, ["kind", "commands", "fill", "stroke", "strokeWidth", "fillRule", "lineCap", "lineJoin"], "drawing path");
|
|
6116
|
+
record(value, ["kind", "commands", "fill", "stroke", "strokeWidth", "fillRule", "lineCap", "lineJoin", "miterLimit", "dash", "dashOffset"], "drawing path");
|
|
5999
6117
|
const source = value.commands;
|
|
6000
6118
|
if (!Array.isArray(source))
|
|
6001
6119
|
throw new TypeError("Drawing path commands must be an array.");
|
|
@@ -6017,6 +6135,10 @@ function captureDrawing(drawing, settings, used) {
|
|
|
6017
6135
|
throw new TypeError("Invalid drawing lineCap.");
|
|
6018
6136
|
if (lineJoin !== undefined && !["miter", "round", "bevel"].includes(lineJoin))
|
|
6019
6137
|
throw new TypeError("Invalid drawing lineJoin.");
|
|
6138
|
+
const miterLimit = positive(value.miterLimit ?? 10, "Drawing miter limit", 1000000);
|
|
6139
|
+
if (miterLimit < 1)
|
|
6140
|
+
throw new RangeError("Drawing miter limit must be at least 1.");
|
|
6141
|
+
const dash = dashPattern(value.dash, value.dashOffset);
|
|
6020
6142
|
for (let i = 0; i < snapshot.length; i++) {
|
|
6021
6143
|
const c = snapshot[i];
|
|
6022
6144
|
if (!c || typeof c !== "object")
|
|
@@ -6049,11 +6171,12 @@ function captureDrawing(drawing, settings, used) {
|
|
|
6049
6171
|
if (!started)
|
|
6050
6172
|
throw new TypeError("A drawing path needs at least one command.");
|
|
6051
6173
|
return { kind: "path", commands: copied, style: (fill === undefined ? "" : fill + " rg\n") + (stroke === undefined ? "" : stroke + " RG\n" + n(strokeWidth) + " w\n") +
|
|
6052
|
-
String(["butt", "round", "square"].indexOf(lineCap ?? "butt")) + " J\n" + String(["miter", "round", "bevel"].indexOf(lineJoin ?? "miter")) +
|
|
6174
|
+
String(["butt", "round", "square"].indexOf(lineCap ?? "butt")) + " J\n" + String(["miter", "round", "bevel"].indexOf(lineJoin ?? "miter")) +
|
|
6175
|
+
" j\n" + n(miterLimit) + " M\n" + dash,
|
|
6053
6176
|
paint: (fill !== undefined && stroke !== undefined ? "B" : fill !== undefined ? "f" : "S") + (fill !== undefined && fillRule === "evenodd" ? "*" : "") + "\n" };
|
|
6054
6177
|
}
|
|
6055
6178
|
function text(value) {
|
|
6056
|
-
record(value, ["kind", "text", "x", "y", "font", "fontSize", "color"], "drawing text");
|
|
6179
|
+
record(value, ["kind", "text", "x", "y", "font", "fontSize", "color", "anchor", "rotation"], "drawing text");
|
|
6057
6180
|
const snapshot = value.text, slot = value.font;
|
|
6058
6181
|
if (typeof snapshot !== "string")
|
|
6059
6182
|
throw new TypeError("Drawing text must be a string.");
|
|
@@ -6064,14 +6187,33 @@ function captureDrawing(drawing, settings, used) {
|
|
|
6064
6187
|
if (!["regular", "bold", "italic", "boldItalic"].includes(slot))
|
|
6065
6188
|
throw new TypeError("Invalid drawing font slot.");
|
|
6066
6189
|
const x = coordinate(value.x), y = coordinate(value.y), size = positive(value.fontSize, "Drawing font size"), foreground = color(value.color);
|
|
6190
|
+
const anchor = value.anchor, rotation = value.rotation ?? 0;
|
|
6191
|
+
if (anchor !== undefined && !["start", "middle", "end"].includes(anchor))
|
|
6192
|
+
throw new TypeError("Invalid drawing text anchor.");
|
|
6193
|
+
if (typeof rotation !== "number" || !Number.isFinite(rotation) || Math.abs(rotation) > 360)
|
|
6194
|
+
throw new RangeError("Drawing text rotation must be finite degrees within -360 through 360.");
|
|
6067
6195
|
settings.budget.cell(snapshot);
|
|
6068
|
-
|
|
6196
|
+
// Quarter turns stay exact so upright and vertical axis labels keep integral matrices.
|
|
6197
|
+
const turn = rotation % 90 === 0 ? (((rotation / 90) % 4) + 4) % 4 : -1, radians = rotation * Math.PI / 180;
|
|
6198
|
+
const cos = turn < 0 ? Math.cos(radians) : [1, 0, -1, 0][turn], sin = turn < 0 ? Math.sin(radians) : [0, 1, 0, -1][turn];
|
|
6199
|
+
return { kind: "text", text: snapshot, x, y, size, color: foreground, font: slot, anchor: anchor === "middle" ? .5 : anchor === "end" ? 1 : 0, cos, sin };
|
|
6200
|
+
}
|
|
6201
|
+
function image(value) {
|
|
6202
|
+
record(value, ["kind", "image", "x", "y", "width", "height", "opacity"], "drawing image");
|
|
6203
|
+
const x = coordinate(value.x), y = coordinate(value.y), suppliedOpacity = value.opacity;
|
|
6204
|
+
const opacity = suppliedOpacity === undefined ? 1 : suppliedOpacity;
|
|
6205
|
+
const width = positive(value.width, "Drawing image width", 1000000), height = positive(value.height, "Drawing image height", 1000000);
|
|
6206
|
+
if (typeof opacity !== "number" || !(opacity >= 0 && opacity <= 1))
|
|
6207
|
+
throw new RangeError("Drawing image opacity must be from 0 through 1.");
|
|
6208
|
+
const source = value.image;
|
|
6209
|
+
images.snapshot(source);
|
|
6210
|
+
return { kind: "image", image: source, x, y, width, height, opacity };
|
|
6069
6211
|
}
|
|
6070
6212
|
function children(input, depth) {
|
|
6071
6213
|
if (!Array.isArray(input))
|
|
6072
6214
|
throw new TypeError("Drawing elements must be an array.");
|
|
6073
|
-
if (depth >
|
|
6074
|
-
throw new RangeError("Drawing groups support at most
|
|
6215
|
+
if (depth > pdfDrawingMaxDepth && input.length)
|
|
6216
|
+
throw new RangeError("Drawing groups support at most " + pdfDrawingMaxDepth + " element levels.");
|
|
6075
6217
|
if (elements + input.length > settings.limits.maxDrawingElements)
|
|
6076
6218
|
throw new OfficeIMOError("RESOURCE_LIMIT", "maxDrawingElements exceeded.");
|
|
6077
6219
|
checkAbort(settings.options.signal);
|
|
@@ -6089,6 +6231,8 @@ function captureDrawing(drawing, settings, used) {
|
|
|
6089
6231
|
output.push(path(value));
|
|
6090
6232
|
else if (kind === "text")
|
|
6091
6233
|
output.push(text(value));
|
|
6234
|
+
else if (kind === "image" && version === 2)
|
|
6235
|
+
output.push(image(value));
|
|
6092
6236
|
else if (kind === "group") {
|
|
6093
6237
|
record(value, ["kind", "clip", "elements"], "drawing group");
|
|
6094
6238
|
const clipValue = value.clip, clip = clipValue === undefined ? undefined : clipRectangle(clipValue);
|
|
@@ -6105,29 +6249,35 @@ function captureDrawing(drawing, settings, used) {
|
|
|
6105
6249
|
}
|
|
6106
6250
|
const plan = children(root.elements, 1);
|
|
6107
6251
|
checkAbort(settings.options.signal);
|
|
6108
|
-
return { width, height, plan, commands: commands - used.commands, elements: elements - used.elements };
|
|
6252
|
+
return { width, height, plan, commands: commands - used.commands, elements: elements - used.elements, standardFonts: standardFonts === true };
|
|
6109
6253
|
}
|
|
6110
6254
|
/** Preflight and paint owned records. The existing font owner retains glyph maps and subsets. */
|
|
6111
|
-
async function prepareDrawing(drawing, settings, fonts, used) {
|
|
6255
|
+
async function prepareDrawing(drawing, settings, fonts, used, resources) {
|
|
6112
6256
|
// A drawing's bounded capture is synchronous; yielding here would leave later caller records borrowed.
|
|
6113
|
-
const captured = captureDrawing(drawing, settings, used), drawingFonts = new Map();
|
|
6257
|
+
const { images } = resources, captured = captureDrawing(drawing, settings, used, images), drawingFonts = new Map();
|
|
6114
6258
|
function fontFor(slot) {
|
|
6115
6259
|
const existing = drawingFonts.get(slot);
|
|
6116
6260
|
if (existing)
|
|
6117
6261
|
return existing;
|
|
6118
|
-
const font = fonts.select(slot === "bold" || slot === "boldItalic", slot === "italic" || slot === "boldItalic");
|
|
6119
|
-
if (
|
|
6262
|
+
const font = fonts.select(slot === "bold" || slot === "boldItalic", slot === "italic" || slot === "boldItalic", undefined, captured.standardFonts);
|
|
6263
|
+
if (font.syntheticBold || font.syntheticItalic || !font.program && !captured.standardFonts)
|
|
6120
6264
|
throw new NotSupportedError("Drawing text without an exact embedded font face at fonts." + slot);
|
|
6121
6265
|
drawingFonts.set(slot, font);
|
|
6122
6266
|
return font;
|
|
6123
6267
|
}
|
|
6124
6268
|
// The work budget belongs to the drawing, including short runs in separate sibling groups.
|
|
6125
6269
|
let preflightCharacters = 0, preflightElements = 0;
|
|
6270
|
+
const imageNames = new Map();
|
|
6126
6271
|
async function preflight(nodes) {
|
|
6127
6272
|
for (let i = 0; i < nodes.length; i++) {
|
|
6128
6273
|
const node = nodes[i];
|
|
6129
6274
|
if (node.kind === "group")
|
|
6130
6275
|
await preflight(node.children);
|
|
6276
|
+
else if (node.kind === "image" && !imageNames.has(node.image)) {
|
|
6277
|
+
const resource = await images.prepare(node.image);
|
|
6278
|
+
resources.registerImage(resource.name, resource.id);
|
|
6279
|
+
imageNames.set(node.image, resource.name);
|
|
6280
|
+
}
|
|
6131
6281
|
else if (node.kind === "text") {
|
|
6132
6282
|
const font = fontFor(node.font);
|
|
6133
6283
|
for (const character of node.text) {
|
|
@@ -6170,9 +6320,23 @@ async function prepareDrawing(drawing, settings, fonts, used) {
|
|
|
6170
6320
|
}
|
|
6171
6321
|
add(node.paint);
|
|
6172
6322
|
}
|
|
6323
|
+
else if (node.kind === "image") {
|
|
6324
|
+
// Image space is a unit square with a bottom-left origin; the drawing's y axis points down.
|
|
6325
|
+
if (node.opacity < 1)
|
|
6326
|
+
add("/" + resources.opacity(node.opacity) + " gs\n");
|
|
6327
|
+
add([node.width, 0, 0, -node.height, node.x, node.y + node.height].map(n).join(" ") + " cm /" + imageNames.get(node.image) + " Do\n");
|
|
6328
|
+
}
|
|
6173
6329
|
else {
|
|
6174
6330
|
const font = fontFor(node.font);
|
|
6175
|
-
|
|
6331
|
+
let shift = 0;
|
|
6332
|
+
if (node.anchor) {
|
|
6333
|
+
for (const character of node.text)
|
|
6334
|
+
shift += font.width(character.codePointAt(0));
|
|
6335
|
+
shift *= node.size / 1000 * node.anchor;
|
|
6336
|
+
}
|
|
6337
|
+
// Text space is upright in the drawing's downward y axis; rotation turns the baseline clockwise about its anchor.
|
|
6338
|
+
add(node.color + " rg\nBT /" + font.name + " " + n(node.size) + " Tf 0 Tr " +
|
|
6339
|
+
[node.cos, node.sin, node.sin, -node.cos, node.x - shift * node.cos, node.y - shift * node.sin].map(n).join(" ") + " Tm <");
|
|
6176
6340
|
let chunk = "";
|
|
6177
6341
|
for (const character of node.text) {
|
|
6178
6342
|
chunk += character;
|
|
@@ -6196,11 +6360,11 @@ async function prepareDrawing(drawing, settings, fonts, used) {
|
|
|
6196
6360
|
return { width: captured.width, height: captured.height, content: fragments.join(""), commands: captured.commands, elements: captured.elements };
|
|
6197
6361
|
}
|
|
6198
6362
|
const _exports = Object.freeze({ checkDrawingBlock: checkDrawingBlock, prepareDrawing: prepareDrawing });
|
|
6199
|
-
_modules.set("
|
|
6363
|
+
_modules.set("da0657c49ac1393409d051be5e5dd70d2a0dc5221d363b422d7da31e9b940ea2", _exports);
|
|
6200
6364
|
return _exports;
|
|
6201
6365
|
})();
|
|
6202
6366
|
|
|
6203
|
-
const _m51 = _modules.get("
|
|
6367
|
+
const _m51 = _modules.get("37923737a6bcae4c342ab023bd3cb01ddeaced28543718aad078b51b54d8f31d") ?? (() => {
|
|
6204
6368
|
const { OfficeIMOError } = _m4;
|
|
6205
6369
|
|
|
6206
6370
|
const { capturePdfText, wrapPdfText } = _m31;
|
|
@@ -6280,11 +6444,11 @@ function paragraphStartHeight(paragraphs) {
|
|
|
6280
6444
|
return required;
|
|
6281
6445
|
}
|
|
6282
6446
|
const _exports = Object.freeze({ captureParagraph: captureParagraph, captureCaption: captureCaption, prepareParagraph: prepareParagraph, checkParagraphBuffer: checkParagraphBuffer, paragraphStartHeight: paragraphStartHeight });
|
|
6283
|
-
_modules.set("
|
|
6447
|
+
_modules.set("37923737a6bcae4c342ab023bd3cb01ddeaced28543718aad078b51b54d8f31d", _exports);
|
|
6284
6448
|
return _exports;
|
|
6285
6449
|
})();
|
|
6286
6450
|
|
|
6287
|
-
const _m52 = _modules.get("
|
|
6451
|
+
const _m52 = _modules.get("964206f2e7c45a34e414d4d690243bf90eb4cf99793e13d1cda834de3d386773") ?? (() => {
|
|
6288
6452
|
const { capturePdfText, wrapPdfText } = _m31;
|
|
6289
6453
|
|
|
6290
6454
|
const { captureParagraph, prepareParagraph } = _m51;
|
|
@@ -6338,11 +6502,11 @@ async function prepareListItem(item, index, options, settings, fonts) {
|
|
|
6338
6502
|
height: paragraph.height + lineHeight - first.lineHeight, firstHeight: paragraph.spaceBefore + lineHeight } };
|
|
6339
6503
|
}
|
|
6340
6504
|
const _exports = Object.freeze({ captureListOptions: captureListOptions, prepareListItem: prepareListItem });
|
|
6341
|
-
_modules.set("
|
|
6505
|
+
_modules.set("964206f2e7c45a34e414d4d690243bf90eb4cf99793e13d1cda834de3d386773", _exports);
|
|
6342
6506
|
return _exports;
|
|
6343
6507
|
})();
|
|
6344
6508
|
|
|
6345
|
-
const _m54 = _modules.get("
|
|
6509
|
+
const _m54 = _modules.get("f254a333f483757dc21be9d40dbd3ca51013d32a3c646b564270e3902226a590") ?? (() => {
|
|
6346
6510
|
const { assertGroupedReportSource } = _m44;
|
|
6347
6511
|
|
|
6348
6512
|
const { captureFields } = _m10;
|
|
@@ -6388,11 +6552,11 @@ function captureGroupedPdfTableOptions(configuration) {
|
|
|
6388
6552
|
...(captured.footerPresentation === undefined ? {} : { footerPresentation: presentation(captured.footerPresentation) }) });
|
|
6389
6553
|
}
|
|
6390
6554
|
const _exports = Object.freeze({ groupedPdfLabelFields: groupedPdfLabelFields, groupedPdfTableFields: groupedPdfTableFields, pdfGroupedTable: pdfGroupedTable, captureGroupedPdfTableOptions: captureGroupedPdfTableOptions });
|
|
6391
|
-
_modules.set("
|
|
6555
|
+
_modules.set("f254a333f483757dc21be9d40dbd3ca51013d32a3c646b564270e3902226a590", _exports);
|
|
6392
6556
|
return _exports;
|
|
6393
6557
|
})();
|
|
6394
6558
|
|
|
6395
|
-
const _m53 = _modules.get("
|
|
6559
|
+
const _m53 = _modules.get("a3ebee86ff33369e9ebc8b994d71bad32497a55433a313c426676277cb660d2f") ?? (() => {
|
|
6396
6560
|
const { assertGroupedReportSource, groupedReportOperation } = _m44;
|
|
6397
6561
|
|
|
6398
6562
|
const { consumeRows } = _m3;
|
|
@@ -6646,11 +6810,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
6646
6810
|
}
|
|
6647
6811
|
}
|
|
6648
6812
|
const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
|
|
6649
|
-
_modules.set("
|
|
6813
|
+
_modules.set("a3ebee86ff33369e9ebc8b994d71bad32497a55433a313c426676277cb660d2f", _exports);
|
|
6650
6814
|
return _exports;
|
|
6651
6815
|
})();
|
|
6652
6816
|
|
|
6653
|
-
const _m45 = _modules.get("
|
|
6817
|
+
const _m45 = _modules.get("e7fe5a5c6b675c6217db5f5a72d8883609e8417ee3c6f3c2184d375463f93231") ?? (() => {
|
|
6654
6818
|
const { BlobByteSink, withDestination } = _m2;
|
|
6655
6819
|
|
|
6656
6820
|
const { OfficeIMOError } = _m4;
|
|
@@ -6900,7 +7064,9 @@ async function writePdfDocumentTo(blocks, destination, configuration = {}) {
|
|
|
6900
7064
|
const inputDrawing = block.drawing, capturedCaption = snapshotCaption(block.caption), alternative = graphicAlternative(block, pages.settings), alignment = graphicAlignment(block.alignment);
|
|
6901
7065
|
if (capturedCaption && alternative === undefined)
|
|
6902
7066
|
throw new TypeError("A captioned PDF graphic requires alternativeText and cannot be decorative.");
|
|
6903
|
-
const drawing = await prepareDrawing(inputDrawing, pages.settings, fonts, { commands, elements: drawingElements }
|
|
7067
|
+
const drawing = await prepareDrawing(inputDrawing, pages.settings, fonts, { commands, elements: drawingElements }, {
|
|
7068
|
+
images, registerImage: (name, id) => pages.registerXObject(name, id), opacity: alpha => pages.opacityState(alpha)
|
|
7069
|
+
}), caption = await prepareCaption(capturedCaption);
|
|
6904
7070
|
commands += drawing.commands;
|
|
6905
7071
|
drawingElements += drawing.elements;
|
|
6906
7072
|
await flushParagraphs((caption?.height ?? 0) + pages.graphicHeight(drawing.width, drawing.height));
|
|
@@ -6940,11 +7106,11 @@ function captureTableOptions(options) {
|
|
|
6940
7106
|
return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
|
|
6941
7107
|
}
|
|
6942
7108
|
const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
|
|
6943
|
-
_modules.set("
|
|
7109
|
+
_modules.set("e7fe5a5c6b675c6217db5f5a72d8883609e8417ee3c6f3c2184d375463f93231", _exports);
|
|
6944
7110
|
return _exports;
|
|
6945
7111
|
})();
|
|
6946
7112
|
|
|
6947
|
-
const _m43 = _modules.get("
|
|
7113
|
+
const _m43 = _modules.get("37e4a768d57818c4335fd3d61b9b7aae633cde303e7634579655a6a3de4a86ce") ?? (() => {
|
|
6948
7114
|
const { assertGroupedReportSource } = _m44;
|
|
6949
7115
|
|
|
6950
7116
|
const { BlobByteSink } = _m2;
|
|
@@ -6990,7 +7156,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
|
|
|
6990
7156
|
return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
|
|
6991
7157
|
}
|
|
6992
7158
|
const _exports = Object.freeze({ pdfGroupedTable: _m54.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
|
|
6993
|
-
_modules.set("
|
|
7159
|
+
_modules.set("37e4a768d57818c4335fd3d61b9b7aae633cde303e7634579655a6a3de4a86ce", _exports);
|
|
6994
7160
|
return _exports;
|
|
6995
7161
|
})();
|
|
6996
7162
|
|
|
@@ -7083,10 +7249,10 @@ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00",
|
|
|
7083
7249
|
return _exports;
|
|
7084
7250
|
})();
|
|
7085
7251
|
|
|
7086
|
-
const _m0 = _modules.get("
|
|
7252
|
+
const _m0 = _modules.get("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca") ?? (() => {
|
|
7087
7253
|
|
|
7088
7254
|
const _exports = Object.freeze({ writePdf: _m1.writePdf, writePdfTo: _m1.writePdfTo, writeGroupedPdf: _m43.writeGroupedPdf, writeGroupedPdfTo: _m43.writeGroupedPdfTo, pdfGroupedTable: _m43.pdfGroupedTable, createGroupedReport: _m44.createGroupedReport, writePdfDocument: _m45.writePdfDocument, writePdfDocumentTo: _m45.writePdfDocumentTo, pdfTable: _m45.pdfTable, PdfFont: _m22.PdfFont, preflightPdfText: _m55.preflightPdfText, ExportCell: _m7.ExportCell, saveBlob: _m56.saveBlob });
|
|
7089
|
-
_modules.set("
|
|
7255
|
+
_modules.set("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca", _exports);
|
|
7090
7256
|
return _exports;
|
|
7091
7257
|
})();
|
|
7092
7258
|
Object.assign(officeimo, _m0, { core: _m56, pdf: _m0 });
|