@yudaocode/univer-pdfs 1.6.211 → 1.6.213

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/lib/es/index.js CHANGED
@@ -24,6 +24,7 @@ import {
24
24
  PdfImageSourceType,
25
25
  PdfListKind,
26
26
  PdfListPresetId,
27
+ PdfRenderError,
27
28
  PdfTableBorderStyle,
28
29
  PdfTableCellVerticalAlign,
29
30
  PdfTextAnchor,
@@ -40,7 +41,10 @@ import {
40
41
  UNIVER_PDF_SCHEMA,
41
42
  UNIVER_PDF_SCHEMA_VERSION,
42
43
  buildMinimalTestTrueTypeFont,
44
+ calculatePdfTableRowCapacity,
45
+ clearPdfFontUrlCache,
43
46
  cmykToRgb,
47
+ collectMissingGlyphsFromPdfUnit,
44
48
  collectPdfInputContractHints,
45
49
  collectUsedCodePointsFromPdfUnit,
46
50
  computeAutoFitFontSize,
@@ -164,8 +168,9 @@ import {
164
168
  validatePdfTemplateSchema,
165
169
  validatePdfTemplateVariables,
166
170
  visitTemplateVariables,
171
+ wrapMixedCjkAndLatinLines,
167
172
  wrapPdfTextLines
168
- } from "./chunk-72OJSR4Z.js";
173
+ } from "./chunk-4A226M74.js";
169
174
  import {
170
175
  Fragment,
171
176
  PDF_JSX_ELEMENT_SYMBOL,
@@ -6864,6 +6869,509 @@ async function convertMarkdownToPdfBytes(markdown, options) {
6864
6869
  });
6865
6870
  }
6866
6871
 
6872
+ // src/exporter/pdf-fidelity-samples.ts
6873
+ import { Tools as Tools5 } from "@univerjs/core";
6874
+ function buildA4Snapshot(id, name, elements, margins = [40, 40, 40, 40]) {
6875
+ const base = createDefaultPdfUnitData({ id, name });
6876
+ const pageId = "page-1";
6877
+ const map = {};
6878
+ const order = [];
6879
+ for (const el of elements) {
6880
+ map[el.id] = el;
6881
+ order.push(el.id);
6882
+ }
6883
+ return {
6884
+ ...base,
6885
+ id,
6886
+ name,
6887
+ document: {
6888
+ pageSize: { ...PDF_PAGE_PRESETS.A4 },
6889
+ margins,
6890
+ pages: {
6891
+ [pageId]: {
6892
+ id: pageId,
6893
+ title: "Page 1",
6894
+ pageSize: { ...PDF_PAGE_PRESETS.A4 },
6895
+ backgroundColor: "#ffffff"
6896
+ }
6897
+ },
6898
+ pageOrder: [pageId]
6899
+ },
6900
+ editState: {
6901
+ ...base.editState,
6902
+ elementsByPage: { [pageId]: map },
6903
+ elementOrderByPage: { [pageId]: order }
6904
+ }
6905
+ };
6906
+ }
6907
+ function createPdfBrowserFidelitySamples() {
6908
+ const s1Elements = [
6909
+ {
6910
+ id: "s1-banner",
6911
+ type: "shape" /* SHAPE */,
6912
+ shapeType: "rect",
6913
+ fillColor: "#1e293b",
6914
+ strokeWidth: 0,
6915
+ transform: { left: 40, top: 40, width: 515.28, height: 42 }
6916
+ },
6917
+ {
6918
+ id: "s1-title",
6919
+ type: "text" /* TEXT */,
6920
+ content: "Monthly Report \xB7 \u6708\u5EA6\u7ECF\u8425\u7B80\u62A5\uFF082026\uFF09",
6921
+ transform: { left: 52, top: 47, width: 490, height: 28 },
6922
+ style: {
6923
+ fontSize: 15,
6924
+ fontWeight: "bold",
6925
+ color: "#ffffff",
6926
+ verticalAlign: "middle"
6927
+ }
6928
+ },
6929
+ {
6930
+ id: "s1-subtitle",
6931
+ type: "text" /* TEXT */,
6932
+ content: "Vector Subset Font & ToUnicode Verification Sample",
6933
+ transform: { left: 40, top: 92, width: 515.28, height: 22 },
6934
+ style: { fontSize: 10.5, italic: true, color: "#475569" }
6935
+ },
6936
+ {
6937
+ id: "s1-lbl-period",
6938
+ type: "text" /* TEXT */,
6939
+ content: "Report Period:",
6940
+ transform: { left: 40, top: 130, width: 130, height: 26 },
6941
+ style: { fontSize: 11, fontWeight: "bold", color: "#334155", verticalAlign: "middle" }
6942
+ },
6943
+ {
6944
+ id: "s1-val-period",
6945
+ type: "text" /* TEXT */,
6946
+ content: "\u4E00\u6708\uFF082026Q1\uFF09",
6947
+ transform: { left: 178, top: 130, width: 377.28, height: 26 },
6948
+ style: {
6949
+ fontSize: 11,
6950
+ color: "#0f172a",
6951
+ backgroundColor: "#f8fafc",
6952
+ borderColor: "#cbd5e1",
6953
+ borderWidth: 1,
6954
+ padding: 5,
6955
+ verticalAlign: "middle"
6956
+ }
6957
+ },
6958
+ {
6959
+ id: "s1-lbl-region",
6960
+ type: "text" /* TEXT */,
6961
+ content: "Service Region:",
6962
+ transform: { left: 40, top: 168, width: 130, height: 26 },
6963
+ style: { fontSize: 11, fontWeight: "bold", color: "#334155", verticalAlign: "middle" }
6964
+ },
6965
+ {
6966
+ id: "s1-val-region",
6967
+ type: "text" /* TEXT */,
6968
+ content: "\u534E\u4E1C\xB7\u4E0A\u6D77\u6D66\u4E1C\u5F20\u6C5F\u9AD8\u79D1\u6280\u56ED\u533A",
6969
+ transform: { left: 178, top: 168, width: 377.28, height: 26 },
6970
+ style: {
6971
+ fontSize: 11,
6972
+ color: "#0f172a",
6973
+ backgroundColor: "#f8fafc",
6974
+ borderColor: "#cbd5e1",
6975
+ borderWidth: 1,
6976
+ padding: 5,
6977
+ verticalAlign: "middle"
6978
+ }
6979
+ },
6980
+ {
6981
+ id: "s1-lbl-status",
6982
+ type: "text" /* TEXT */,
6983
+ content: "Audit Status:",
6984
+ transform: { left: 40, top: 206, width: 130, height: 26 },
6985
+ style: { fontSize: 11, fontWeight: "bold", color: "#334155", verticalAlign: "middle" }
6986
+ },
6987
+ {
6988
+ id: "s1-val-status",
6989
+ type: "text" /* TEXT */,
6990
+ content: "\u5DF2\u6838\u9A8C\uFF1A\u4E13\u7968\u901A\u8FC7\uFF01\u3010\u6279\u6B21 A-108\u3011",
6991
+ transform: { left: 178, top: 206, width: 377.28, height: 26 },
6992
+ style: {
6993
+ fontSize: 11,
6994
+ fontWeight: "bold",
6995
+ color: "#0f766e",
6996
+ backgroundColor: "#f0fdfa",
6997
+ borderColor: "#99f6e4",
6998
+ borderWidth: 1,
6999
+ padding: 5,
7000
+ verticalAlign: "middle"
7001
+ }
7002
+ },
7003
+ {
7004
+ id: "s1-lbl-summary",
7005
+ type: "text" /* TEXT */,
7006
+ content: "Summary Note:",
7007
+ transform: { left: 40, top: 244, width: 130, height: 26 },
7008
+ style: { fontSize: 11, fontWeight: "bold", color: "#334155", verticalAlign: "middle" }
7009
+ },
7010
+ {
7011
+ id: "s1-val-summary",
7012
+ type: "text" /* TEXT */,
7013
+ content: "\u6838\u5FC3\u6A21\u5757 Controller-V2 \u5B8C\u6210\u5EA6 98.5\uFF05\uFF1B\u6B21\u65E5\u8FBE\u6B63\u5E38\uFF0C\u201C\u96F6\u5DEE\u9519\u201D\u4EA4\u4ED8\u3002",
7014
+ transform: { left: 178, top: 244, width: 377.28, height: 26 },
7015
+ style: {
7016
+ fontSize: 11,
7017
+ color: "#0f172a",
7018
+ backgroundColor: "#f8fafc",
7019
+ borderColor: "#cbd5e1",
7020
+ borderWidth: 1,
7021
+ padding: 5,
7022
+ verticalAlign: "middle"
7023
+ }
7024
+ }
7025
+ ];
7026
+ const s1ShortCjk = buildA4Snapshot("s1-cjk-short", "S1 \u4E2D\u6587\u77ED\u6587\u672C\u4E0E\u4E2D\u897F\u6DF7\u6392", s1Elements);
7027
+ const s2LongTextBox = buildA4Snapshot("s2-cjk-long-textbox", "S2 \u4E2D\u6587\u957F\u6587\u672C\u6846\u5BF9\u9F50\u4E0E\u88C1\u5207", [
7028
+ {
7029
+ id: "s2-title",
7030
+ type: "text" /* TEXT */,
7031
+ content: "S2 \u591A\u6BB5\u6DF7\u6392\u957F\u6587\u672C\u6846\uFF08\u5DE6/\u4E2D/\u53F3 \xD7 \u4E0A/\u4E2D/\u4E0B\u5BF9\u9F50\u3001\u8D85\u957F\u897F\u6587\u65AD\u884C\u4E0E\u6EA2\u51FA\u88C1\u5207\uFF09",
7032
+ transform: { left: 40, top: 40, width: 515.28, height: 28 },
7033
+ style: { fontSize: 13, fontWeight: "bold", color: "#0f172a", verticalAlign: "middle" }
7034
+ },
7035
+ {
7036
+ id: "s2-left-top-clip",
7037
+ type: "text" /* TEXT */,
7038
+ content: "\u5DE6\u5BF9\u9F50\xB7\u9876\u90E8\u793A\u4F8B\uFF1A\u4E0A\u6D77\u6D66\u4E1C\u5F20\u6C5F\u9AD8\u79D1\u6280\u56ED\u533A\u5DE5\u4E1A\u4F20\u611F\u5668\u6A21\u5757\u5DF2\u5B8C\u6210\u5E74\u5EA6\u6838\u9A8C\u3002\nEnglish words wrap cleanly while SupercalifragilisticexpialidociousControllerModule2026 breaks by character.\n\u7B2C\u4E09\u6BB5\uFF1A\u8D85\u51FA\u56FA\u5B9A\u9AD8\u5EA6\u7684\u7B2C\u56DB\u884C\u4E0E\u7B2C\u4E94\u884C\u5C06\u5728\u6846\u5185\u4E25\u683C\u88C1\u5207\uFF0C\u7EDD\u4E0D\u5411\u4E0B\u65B9\u5143\u7D20\u6EA2\u51FA\u3002\n\u7B2C\u56DB\u6BB5\uFF1A\u672C\u884C\u4F4D\u4E8E\u6846\u5E95\u88C1\u5207\u8FB9\u754C\u4E4B\u5916\u3002",
7039
+ overflow: "clip",
7040
+ transform: { left: 40, top: 82, width: 515.28, height: 74 },
7041
+ style: {
7042
+ fontSize: 10.5,
7043
+ lineHeight: 1.45,
7044
+ textAlign: "left",
7045
+ verticalAlign: "top",
7046
+ color: "#0f172a",
7047
+ backgroundColor: "#f8fafc",
7048
+ borderColor: "#94a3b8",
7049
+ borderWidth: 1,
7050
+ padding: 6
7051
+ }
7052
+ },
7053
+ {
7054
+ id: "s2-center-middle",
7055
+ type: "text" /* TEXT */,
7056
+ content: "\u5C45\u4E2D\xB7\u5782\u76F4\u5C45\u4E2D\u793A\u4F8B\uFF08Center / Middle\uFF09\n\u534E\u4E1C\u534E\u5357\u534E\u5317\u4E09\u533A\u5408\u8BA1\u901A\u8FC7\u7387 99.2\uFF05\uFF0C\u5355\u636E\u72B6\u6001\u6B63\u5E38\u3002",
7057
+ transform: { left: 40, top: 174, width: 250, height: 86 },
7058
+ style: {
7059
+ fontSize: 10.5,
7060
+ lineHeight: 1.45,
7061
+ textAlign: "center",
7062
+ verticalAlign: "middle",
7063
+ color: "#1e293b",
7064
+ backgroundColor: "#eff6ff",
7065
+ borderColor: "#93c5fd",
7066
+ borderWidth: 1,
7067
+ padding: 6
7068
+ }
7069
+ },
7070
+ {
7071
+ id: "s2-right-bottom",
7072
+ type: "text" /* TEXT */,
7073
+ content: "\u53F3\u5BF9\u9F50\xB7\u5E95\u90E8\u793A\u4F8B\uFF08Right / Bottom\uFF09\n\u8D22\u52A1\u4E13\u7528\u7AE0 \uFF5C \u4ED3\u5E93\u7B7E\u7AE0\n2026-01-31",
7074
+ transform: { left: 305.28, top: 174, width: 250, height: 86 },
7075
+ style: {
7076
+ fontSize: 10.5,
7077
+ lineHeight: 1.4,
7078
+ textAlign: "right",
7079
+ verticalAlign: "bottom",
7080
+ color: "#0f766e",
7081
+ backgroundColor: "#f0fdfa",
7082
+ borderColor: "#5eead4",
7083
+ borderWidth: 1,
7084
+ padding: 6
7085
+ }
7086
+ },
7087
+ {
7088
+ id: "s2-autofit-shrink",
7089
+ type: "text" /* TEXT */,
7090
+ content: "\u7F29\u5C0F\u5B57\u53F7\u81EA\u9002\u5E94\u793A\u4F8B\uFF08autoFitFontSize\uFF09\uFF1A\u5F53\u957F\u6587\u672C\u8D85\u51FA\u7D27\u51D1\u9AD8\u5EA6\u65F6\u81EA\u52A8\u7F29\u5C0F\u5B57\u53F7\u81F3\u4E0D\u4F4E\u4E8E\u6700\u5C0F\u5B57\u53F7\uFF0C\u5B8C\u6574\u4FDD\u7559\u534E\u4E1C\u5F20\u6C5F\u56ED\u533A\u7CBE\u5BC6\u63A7\u5236\u5668\u7EC4\u4EF6\u9A8C\u6536\u8BF4\u660E\u4E0E Batch-2026-Q1 \u7F16\u53F7\u3002",
7091
+ overflow: "shrink",
7092
+ autoFitFontSize: true,
7093
+ minFontSize: 7,
7094
+ transform: { left: 40, top: 278, width: 515.28, height: 42 },
7095
+ style: {
7096
+ fontSize: 12,
7097
+ lineHeight: 1.35,
7098
+ textAlign: "left",
7099
+ verticalAlign: "middle",
7100
+ color: "#334155",
7101
+ backgroundColor: "#fefce8",
7102
+ borderColor: "#fde047",
7103
+ borderWidth: 1,
7104
+ padding: 5
7105
+ }
7106
+ }
7107
+ ]);
7108
+ const s3SinglePageTable = buildA4Snapshot("s3-single-page-table", "S3 \u5355\u9875\u4E94\u5217\u6BD4\u4F8B\u4E0E\u683C\u5F0F\u8868\u683C", [
7109
+ {
7110
+ id: "s3-title",
7111
+ type: "text" /* TEXT */,
7112
+ content: "S3 \u91C7\u8D2D\u51FA\u5E93\u6838\u9A8C\u5355\u9875\u660E\u7EC6\u8868\uFF08\u5217\u5BBD\u6BD4\u4F8B 1:2:1:1:1 \xB7 \u6570\u503C/\u8D27\u5E01/\u767E\u5206\u6BD4\uFF09",
7113
+ transform: { left: 40, top: 40, width: 515.28, height: 28 },
7114
+ style: { fontSize: 13.5, fontWeight: "bold", color: "#0f172a", verticalAlign: "middle" }
7115
+ },
7116
+ {
7117
+ id: "s3-table",
7118
+ type: "table" /* TABLE */,
7119
+ transform: { left: 40, top: 82, width: 515.28, height: 196 },
7120
+ headerHeight: 28,
7121
+ rowHeight: 24,
7122
+ borderColor: "#cbd5e1",
7123
+ borderWidth: 0.8,
7124
+ zebraStripeColor: "#f1f5f9",
7125
+ headerStyle: {
7126
+ fontSize: 10,
7127
+ fontWeight: "bold",
7128
+ color: "#ffffff",
7129
+ backgroundColor: "#1e293b",
7130
+ padding: 5
7131
+ },
7132
+ bodyStyle: {
7133
+ fontSize: 9.5,
7134
+ color: "#0f172a",
7135
+ padding: 5
7136
+ },
7137
+ columns: [
7138
+ { id: "c1", header: "\u5E8F\u53F7", field: "seq", widthRatio: 1, align: "center", format: "text" },
7139
+ { id: "c2", header: "\u5546\u54C1\u89C4\u683C\u8BF4\u660E", field: "spec", widthRatio: 2, align: "left", format: "text" },
7140
+ { id: "c3", header: "\u6570\u91CF", field: "qty", widthRatio: 1, align: "right", format: "number", decimals: 0 },
7141
+ {
7142
+ id: "c4",
7143
+ header: "\u5355\u4EF7",
7144
+ field: "price",
7145
+ widthRatio: 1,
7146
+ align: "right",
7147
+ format: "currency",
7148
+ currencySymbol: "\xA5",
7149
+ decimals: 2
7150
+ },
7151
+ { id: "c5", header: "\u5B8C\u6210\u5EA6", field: "rate", widthRatio: 1, align: "right", format: "percent", decimals: 1 }
7152
+ ],
7153
+ rows: [
7154
+ ["A-01", "\u5DE5\u4E1A\u4F20\u611F\u5668\u6A21\u5757\uFF08\u534E\u4E1C\u6807\u51C6\u7248\uFF09", "1200", "358.5", "0.985"],
7155
+ ["A-02", "\u7CBE\u5BC6\u63A7\u5236\u5668\u7EC4\u4EF6 Controller-V2", "450", "1280", "1"],
7156
+ ["A-03", "\u5F20\u6C5F\u56ED\u533A\u6B21\u65E5\u8FBE\u4FDD\u4EF7\u8FD0\u8F93\u5305", "3200", "45.25", "0.962"],
7157
+ ["A-04", "\u534E\u5357\u6DF1\u5733\u9646\u8FD0\u4E13\u7968\u6838\u9A8C\u6279\u6B21", "860", "512.8", "0.894"],
7158
+ ["A-05", "\u534E\u5317\u5317\u4EAC\u4ED3\u5E93\u7B7E\u7AE0\u8FFD\u6EAF\u7801\u5957\u88C5", "1540", "96", "0.998"],
7159
+ ["A-06", "\u5E74\u5EA6\u5408\u8BA1\u5907\u54C1\u6A21\u5757\uFF08\u5185\u90E8\u8D44\u6599\uFF09", "300", "2150.4", "0.95"]
7160
+ ]
7161
+ }
7162
+ ]);
7163
+ const overflowRows = [
7164
+ [
7165
+ "\u4E0A\u6D77\u6D66\u4E1C\u5F20\u6C5F\u9AD8\u79D1\u6280\u56ED\u533A\u5DE5\u4E1A\u4F20\u611F\u5668\u7CBE\u5BC6\u63A7\u5236\u5668\u7EC4\u4EF6\u6838\u9A8C\u901A\u8FC7\u660E\u7EC6\u8D85\u51FA\u88C1\u5207\u4E0D\u5916\u6EA2",
7166
+ "SupercalifragilisticexpialidociousControllerModule2026OverflowCheck",
7167
+ "\u7B2C\u4E00\u884C\uFF1A\u5DF2\u6838\u9A8C\n\u7B2C\u4E8C\u884C\uFF1A\u5F85\u5BA1\u8BF4\u660E\n\u7B2C\u4E09\u884C\uFF1A\u8D85\u51FA\u88C1\u5207\u4E0D\u5916\u6EA2",
7168
+ "\u6B63\u5E38\u90BB\u683C A1"
7169
+ ],
7170
+ [
7171
+ "\u5317\u4EAC\u6DF1\u5733\u676D\u5DDE\u4E09\u5730\u4ED3\u5E93\u7B7E\u7AE0\u4E0E\u987A\u4E30\u7535\u5B50\u9762\u5355\u4E09\u8054\u91C7\u8D2D\u51FA\u5E93\u5957\u6253\u6A21\u677F\u957F\u6587\u672C\u6838\u9A8C",
7172
+ "ElectroencephalographicallyCalibratedSensorBatch99887766",
7173
+ "\u9996\u884C\u6B63\u5E38\u663E\u793A\n\u6B21\u884C\u8D85\u51FA\u56FA\u5B9A\u884C\u9AD8\u88C1\u5207",
7174
+ "\u6B63\u5E38\u90BB\u683C A2"
7175
+ ]
7176
+ ];
7177
+ const s4CellOverflow = buildA4Snapshot("s4-cell-overflow", "S4 \u7A84\u5217\u5355\u5143\u683C\u65AD\u884C\u88C1\u5207\u4E0E\u81EA\u9002\u5E94\u5B57\u53F7", [
7178
+ {
7179
+ id: "s4-title-clip",
7180
+ type: "text" /* TEXT */,
7181
+ content: "S4-A \u9ED8\u8BA4\u56FA\u5B9A\u884C\u9AD8\uFF0824pt\uFF09\u7A84\u5217\u6EA2\u51FA\u4E25\u683C\u88C1\u5207\uFF08T4 \u65AD\u884C + T5 \u5355\u5143\u683C\u5185\u88C1\u5207\uFF0C\u4E0D\u4FB5\u5165\u90BB\u683C\uFF09",
7182
+ transform: { left: 40, top: 40, width: 515.28, height: 24 },
7183
+ style: { fontSize: 11.5, fontWeight: "bold", color: "#0f172a", verticalAlign: "middle" }
7184
+ },
7185
+ {
7186
+ id: "s4-table-clip",
7187
+ type: "table" /* TABLE */,
7188
+ transform: { left: 40, top: 72, width: 515.28, height: 84 },
7189
+ headerHeight: 26,
7190
+ rowHeight: 24,
7191
+ borderColor: "#94a3b8",
7192
+ borderWidth: 0.8,
7193
+ zebraStripeColor: "#f8fafc",
7194
+ headerStyle: {
7195
+ fontSize: 9.5,
7196
+ fontWeight: "bold",
7197
+ color: "#ffffff",
7198
+ backgroundColor: "#334155",
7199
+ padding: 4
7200
+ },
7201
+ bodyStyle: {
7202
+ fontSize: 9.5,
7203
+ color: "#0f172a",
7204
+ padding: 4
7205
+ },
7206
+ columns: [
7207
+ { id: "o1", header: "\u7A84\u5217\u957F\u4E2D\u6587", field: "cjk", widthRatio: 1, align: "left" },
7208
+ { id: "o2", header: "\u7A84\u5217\u8D85\u957F\u897F\u6587", field: "latin", widthRatio: 1, align: "left" },
7209
+ { id: "o3", header: "\u7A84\u5217\u591A\u884C\u6587\u672C", field: "multi", widthRatio: 1, align: "left" },
7210
+ { id: "o4", header: "\u5BF9\u7167\u90BB\u683C", field: "neighbor", widthRatio: 1, align: "center" }
7211
+ ],
7212
+ rows: overflowRows
7213
+ },
7214
+ {
7215
+ id: "s4-title-autofit",
7216
+ type: "text" /* TEXT */,
7217
+ content: "S4-B \u5F00\u542F\u8868\u683C\u5355\u5143\u683C\u7F29\u5C0F\u5B57\u53F7\uFF08T6 autoFitFontSize: true, minFontSize: 6.5\uFF09",
7218
+ transform: { left: 40, top: 180, width: 515.28, height: 24 },
7219
+ style: { fontSize: 11.5, fontWeight: "bold", color: "#0f766e", verticalAlign: "middle" }
7220
+ },
7221
+ {
7222
+ id: "s4-table-autofit",
7223
+ type: "table" /* TABLE */,
7224
+ transform: { left: 40, top: 212, width: 515.28, height: 84 },
7225
+ headerHeight: 26,
7226
+ rowHeight: 24,
7227
+ autoFitFontSize: true,
7228
+ minFontSize: 6.5,
7229
+ borderColor: "#94a3b8",
7230
+ borderWidth: 0.8,
7231
+ zebraStripeColor: "#f0fdfa",
7232
+ headerStyle: {
7233
+ fontSize: 9.5,
7234
+ fontWeight: "bold",
7235
+ color: "#ffffff",
7236
+ backgroundColor: "#0f766e",
7237
+ padding: 4
7238
+ },
7239
+ bodyStyle: {
7240
+ fontSize: 9.5,
7241
+ color: "#0f172a",
7242
+ padding: 4
7243
+ },
7244
+ columns: [
7245
+ { id: "a1", header: "\u7A84\u5217\u957F\u4E2D\u6587", field: "cjk", widthRatio: 1, align: "left" },
7246
+ { id: "a2", header: "\u7A84\u5217\u8D85\u957F\u897F\u6587", field: "latin", widthRatio: 1, align: "left" },
7247
+ { id: "a3", header: "\u7A84\u5217\u591A\u884C\u6587\u672C", field: "multi", widthRatio: 1, align: "left" },
7248
+ { id: "a4", header: "\u5BF9\u7167\u90BB\u683C", field: "neighbor", widthRatio: 1, align: "center" }
7249
+ ],
7250
+ rows: overflowRows
7251
+ }
7252
+ ]);
7253
+ const s5Rows = Array.from({ length: 35 }, (_, idx) => {
7254
+ const seq = String(idx + 1).padStart(2, "0");
7255
+ const region = idx % 3 === 0 ? "\u534E\u4E1C\u4E0A\u6D77\u56ED\u533A" : idx % 3 === 1 ? "\u534E\u5357\u6DF1\u5733\u56ED\u533A" : "\u534E\u5317\u5317\u4EAC\u56ED\u533A";
7256
+ const item = idx % 2 === 0 ? "\u5DE5\u4E1A\u4F20\u611F\u5668\u6A21\u5757" : "\u7CBE\u5BC6\u63A7\u5236\u5668\u7EC4\u4EF6";
7257
+ const qty = String((idx + 1) * 10);
7258
+ const amount = ((idx + 1) * 125.5).toFixed(2);
7259
+ return [`R-${seq}`, `${region}\xB7${item}`, qty, amount, idx % 2 === 0 ? "\u5DF2\u6838\u9A8C" : "\u901A\u8FC7"];
7260
+ });
7261
+ const s5MultiPageTable = buildA4Snapshot("s5-multipage-table", "S5 \u591A\u9875\u8868\u683C\u4E0E\u4E0A\u4E0B\u5143\u7D20\u6D41\u8F6C", [
7262
+ {
7263
+ id: "s5-above-title",
7264
+ type: "text" /* TEXT */,
7265
+ content: "S5 \u591A\u9875\u51FA\u5165\u5E93\u6838\u9A8C\u660E\u7EC6\u8868\uFF08\u5355\u9875\u5BB9\u91CF 14 \u884C \xD7 2.5 \u500D = 35 \u884C\uFF09",
7266
+ transform: { left: 40, top: 42, width: 515.28, height: 26 },
7267
+ style: { fontSize: 13.5, fontWeight: "bold", color: "#0f172a", verticalAlign: "middle" }
7268
+ },
7269
+ {
7270
+ id: "s5-above-meta",
7271
+ type: "text" /* TEXT */,
7272
+ content: "\u5355\u636E\u72B6\u6001\uFF1A\u5DF2\u6838\u9A8C \uFF5C \u56ED\u533A\uFF1A\u534E\u4E1C\u5F20\u6C5F\u9AD8\u79D1\u6280\u56ED\u533A \uFF5C \u65E5\u671F\uFF1A2026-01-31",
7273
+ transform: { left: 40, top: 72, width: 515.28, height: 22 },
7274
+ style: {
7275
+ fontSize: 10,
7276
+ color: "#334155",
7277
+ backgroundColor: "#f8fafc",
7278
+ borderColor: "#cbd5e1",
7279
+ borderWidth: 0.8,
7280
+ padding: 4,
7281
+ verticalAlign: "middle"
7282
+ }
7283
+ },
7284
+ {
7285
+ id: "s5-table",
7286
+ type: "table" /* TABLE */,
7287
+ transform: { left: 40, top: 106, width: 515.28, height: 362 },
7288
+ headerHeight: 26,
7289
+ rowHeight: 24,
7290
+ repeatHeader: true,
7291
+ zebraParity: "continuous",
7292
+ zebraStripeColor: "#f1f5f9",
7293
+ borderColor: "#cbd5e1",
7294
+ borderWidth: 0.8,
7295
+ headerStyle: {
7296
+ fontSize: 10,
7297
+ fontWeight: "bold",
7298
+ color: "#ffffff",
7299
+ backgroundColor: "#1e293b",
7300
+ padding: 5
7301
+ },
7302
+ bodyStyle: {
7303
+ fontSize: 9.5,
7304
+ color: "#0f172a",
7305
+ padding: 5
7306
+ },
7307
+ columns: [
7308
+ { id: "m1", header: "\u8BA2\u5355\u7F16\u53F7", field: "no", widthRatio: 1, align: "center", format: "text" },
7309
+ { id: "m2", header: "\u5546\u54C1\u89C4\u683C", field: "spec", widthRatio: 2, align: "left", format: "text" },
7310
+ { id: "m3", header: "\u6570\u91CF", field: "qty", widthRatio: 1, align: "right", format: "number", decimals: 0 },
7311
+ {
7312
+ id: "m4",
7313
+ header: "\u91D1\u989D",
7314
+ field: "amt",
7315
+ widthRatio: 1,
7316
+ align: "right",
7317
+ format: "currency",
7318
+ currencySymbol: "\xA5",
7319
+ decimals: 2
7320
+ },
7321
+ { id: "m5", header: "\u72B6\u6001", field: "status", widthRatio: 1, align: "center", format: "text" }
7322
+ ],
7323
+ rows: s5Rows
7324
+ },
7325
+ {
7326
+ id: "s5-below-footer",
7327
+ type: "text" /* TEXT */,
7328
+ content: "\u8868\u540E\u7B7E\u6536\u680F\uFF1A\u5BA1\u6279\u4EBA \u5F20\u5DE5 \uFF5C \u8D22\u52A1\u4E13\u7528\u7AE0 \uFF5C \u4ED3\u5E93\u7B7E\u7AE0\uFF08\u4EC5\u5728\u672B\u9875\u8868\u5C3E\u51FA\u73B0\uFF0C\u4E0D\u4E0E\u8868\u683C\u91CD\u53E0\uFF09",
7329
+ transform: { left: 40, top: 486, width: 515.28, height: 32 },
7330
+ style: {
7331
+ fontSize: 10.5,
7332
+ fontWeight: "bold",
7333
+ color: "#0f766e",
7334
+ backgroundColor: "#f0fdfa",
7335
+ borderColor: "#5eead4",
7336
+ borderWidth: 1,
7337
+ padding: 6,
7338
+ verticalAlign: "middle"
7339
+ }
7340
+ }
7341
+ ]);
7342
+ const s6MissingGlyphs = Tools5.deepClone(s1ShortCjk);
7343
+ s6MissingGlyphs.id = "s6-missing-glyphs";
7344
+ s6MissingGlyphs.name = "S6 \u7F3A\u5B57\u4E0E\u5B57\u4F53\u5F02\u5E38\u8BCA\u65AD";
7345
+ s6MissingGlyphs.editState.elementsByPage["page-1"]["s6-missing-note"] = {
7346
+ id: "s6-missing-note",
7347
+ type: "text" /* TEXT */,
7348
+ content: "\u7F3A\u5B57\u8BCA\u65AD\u5907\u6CE8\uFF1A\u751F\u50FB\u5B57\u9F98\u4E0E\u56FE\u6807\u{1F680}\u6838\u9A8C",
7349
+ transform: { left: 40, top: 286, width: 515.28, height: 28 },
7350
+ style: {
7351
+ fontSize: 11,
7352
+ color: "#b91c1c",
7353
+ backgroundColor: "#fef2f2",
7354
+ borderColor: "#fecaca",
7355
+ borderWidth: 1,
7356
+ padding: 5,
7357
+ verticalAlign: "middle"
7358
+ }
7359
+ };
7360
+ s6MissingGlyphs.editState.elementOrderByPage["page-1"].push("s6-missing-note");
7361
+ const s7DefaultNoFont = Tools5.deepClone(s1ShortCjk);
7362
+ s7DefaultNoFont.id = "s7-default-no-font";
7363
+ s7DefaultNoFont.name = "S7 \u9ED8\u8BA4\u672A\u4F20\u5B57\u4F53\u5149\u6805\u517C\u5BB9\u6A21\u5F0F";
7364
+ return {
7365
+ s1ShortCjk,
7366
+ s2LongTextBox,
7367
+ s3SinglePageTable,
7368
+ s4CellOverflow,
7369
+ s5MultiPageTable,
7370
+ s6MissingGlyphs,
7371
+ s7DefaultNoFont
7372
+ };
7373
+ }
7374
+
6867
7375
  // src/plugin.ts
6868
7376
  import {
6869
7377
  ICommandService as ICommandService2,
@@ -6882,7 +7390,7 @@ import {
6882
7390
  generateRandomId as generateRandomId6,
6883
7391
  IUniverInstanceService as IUniverInstanceService4,
6884
7392
  Optional,
6885
- Tools as Tools5,
7393
+ Tools as Tools6,
6886
7394
  UniverInstanceType as UniverInstanceType4
6887
7395
  } from "@univerjs/core";
6888
7396
  import { BehaviorSubject as BehaviorSubject2, Subject } from "rxjs";
@@ -7180,14 +7688,14 @@ function normalizePdfImportWarnings(raw) {
7180
7688
  return normalized;
7181
7689
  }
7182
7690
  function buildOverlayImportCandidateSnapshot(baseSnapshot, outcome) {
7183
- const prevSnapshot = Tools5.deepClone(baseSnapshot);
7691
+ const prevSnapshot = Tools6.deepClone(baseSnapshot);
7184
7692
  const existingOrder = prevSnapshot.document?.pageOrder ?? [];
7185
7693
  const pageSizes = outcome.pageSizes ?? [];
7186
7694
  const totalPages = Math.max(1, pageSizes.length || outcome.sourceDocumentRef.pageCount || 1);
7187
7695
  const nextPages = {};
7188
7696
  const nextPageOrder = [];
7189
- const nextElementsByPage = Tools5.deepClone(prevSnapshot.editState?.elementsByPage ?? {});
7190
- const nextElementOrderByPage = Tools5.deepClone(prevSnapshot.editState?.elementOrderByPage ?? {});
7697
+ const nextElementsByPage = Tools6.deepClone(prevSnapshot.editState?.elementsByPage ?? {});
7698
+ const nextElementOrderByPage = Tools6.deepClone(prevSnapshot.editState?.elementOrderByPage ?? {});
7191
7699
  for (let i = 0; i < totalPages; i++) {
7192
7700
  const pid = existingOrder[i] || `page-${generateRandomId6(6)}`;
7193
7701
  nextPageOrder.push(pid);
@@ -7196,7 +7704,7 @@ function buildOverlayImportCandidateSnapshot(baseSnapshot, outcome) {
7196
7704
  id: pid,
7197
7705
  title: `Page ${i + 1}`,
7198
7706
  sourcePageNumber: i + 1,
7199
- pageSize: Tools5.deepClone(resolvedSize),
7707
+ pageSize: Tools6.deepClone(resolvedSize),
7200
7708
  backgroundColor: "#ffffff"
7201
7709
  };
7202
7710
  if (!nextElementsByPage[pid]) nextElementsByPage[pid] = {};
@@ -7204,10 +7712,10 @@ function buildOverlayImportCandidateSnapshot(baseSnapshot, outcome) {
7204
7712
  }
7205
7713
  return {
7206
7714
  ...prevSnapshot,
7207
- sourceDocumentRef: Tools5.deepClone(outcome.sourceDocumentRef),
7715
+ sourceDocumentRef: Tools6.deepClone(outcome.sourceDocumentRef),
7208
7716
  document: {
7209
7717
  ...prevSnapshot.document,
7210
- pageSize: Tools5.deepClone(pageSizes[0] ?? prevSnapshot.document.pageSize),
7718
+ pageSize: Tools6.deepClone(pageSizes[0] ?? prevSnapshot.document.pageSize),
7211
7719
  pages: nextPages,
7212
7720
  pageOrder: nextPageOrder
7213
7721
  },
@@ -7228,8 +7736,8 @@ function normalizeAdapterImportResult(raw) {
7228
7736
  return {
7229
7737
  outcome: {
7230
7738
  mode: "overlay",
7231
- sourceDocumentRef: Tools5.deepClone(record.sourceDocumentRef),
7232
- pageSizes: Tools5.deepClone(record.pageSizes ?? []),
7739
+ sourceDocumentRef: Tools6.deepClone(record.sourceDocumentRef),
7740
+ pageSizes: Tools6.deepClone(record.pageSizes ?? []),
7233
7741
  ...warnings.length > 0 ? { warnings } : {}
7234
7742
  },
7235
7743
  warnings
@@ -7237,7 +7745,7 @@ function normalizeAdapterImportResult(raw) {
7237
7745
  }
7238
7746
  if (record.mode === "snapshot") {
7239
7747
  const warnings = normalizePdfImportWarnings(record.warnings);
7240
- const clonedSnapshot = Tools5.deepClone(record.snapshot);
7748
+ const clonedSnapshot = Tools6.deepClone(record.snapshot);
7241
7749
  return {
7242
7750
  outcome: {
7243
7751
  mode: "snapshot",
@@ -7249,7 +7757,7 @@ function normalizeAdapterImportResult(raw) {
7249
7757
  }
7250
7758
  if (record.snapshot && typeof record.snapshot === "object") {
7251
7759
  const warnings = normalizePdfImportWarnings(record.warnings);
7252
- const clonedSnapshot = Tools5.deepClone(record.snapshot);
7760
+ const clonedSnapshot = Tools6.deepClone(record.snapshot);
7253
7761
  return {
7254
7762
  outcome: {
7255
7763
  mode: "snapshot",
@@ -7261,7 +7769,7 @@ function normalizeAdapterImportResult(raw) {
7261
7769
  }
7262
7770
  if ("schema" in record || "document" in record) {
7263
7771
  const warnings = normalizePdfImportWarnings(record.warnings);
7264
- const clonedSnapshot = Tools5.deepClone(record);
7772
+ const clonedSnapshot = Tools6.deepClone(record);
7265
7773
  delete clonedSnapshot.warnings;
7266
7774
  return {
7267
7775
  outcome: {
@@ -7691,7 +8199,7 @@ var PdfIoService = class extends Disposable2 {
7691
8199
  }
7692
8200
  _resolveBaseSnapshotForImport(context) {
7693
8201
  if (context?.snapshot) {
7694
- const cloned = Tools5.deepClone(context.snapshot);
8202
+ const cloned = Tools6.deepClone(context.snapshot);
7695
8203
  return {
7696
8204
  unitId: context.unitId || cloned.id,
7697
8205
  baseSnapshot: cloned
@@ -7748,7 +8256,7 @@ var PdfIoService = class extends Disposable2 {
7748
8256
  try {
7749
8257
  rawResult = await adapter.importPdf(file, {
7750
8258
  unitId,
7751
- snapshot: Tools5.deepClone(baseSnapshot),
8259
+ snapshot: Tools6.deepClone(baseSnapshot),
7752
8260
  defaultImport
7753
8261
  });
7754
8262
  } catch (err) {
@@ -7768,7 +8276,7 @@ var PdfIoService = class extends Disposable2 {
7768
8276
  }
7769
8277
  }
7770
8278
  const { outcome, warnings } = normalizeAdapterImportResult(rawResult);
7771
- const candidateSnapshot = outcome.mode === "snapshot" ? Tools5.deepClone(outcome.snapshot) : buildOverlayImportCandidateSnapshot(baseSnapshot, outcome);
8279
+ const candidateSnapshot = outcome.mode === "snapshot" ? Tools6.deepClone(outcome.snapshot) : buildOverlayImportCandidateSnapshot(baseSnapshot, outcome);
7772
8280
  return {
7773
8281
  snapshot: candidateSnapshot,
7774
8282
  outcome,
@@ -8041,6 +8549,7 @@ export {
8041
8549
  PdfIoTargetError,
8042
8550
  PdfListKind,
8043
8551
  PdfListPresetId,
8552
+ PdfRenderError,
8044
8553
  PdfSelectionService,
8045
8554
  PdfTableBorderStyle,
8046
8555
  PdfTableCellVerticalAlign,
@@ -8092,8 +8601,11 @@ export {
8092
8601
  buildMinimalTestTrueTypeFont,
8093
8602
  buildOverlayImportCandidateSnapshot,
8094
8603
  buildPdfTemplateFromOcrFields,
8604
+ calculatePdfTableRowCapacity,
8095
8605
  canonicalJsonStringify,
8606
+ clearPdfFontUrlCache,
8096
8607
  cmykToRgb,
8608
+ collectMissingGlyphsFromPdfUnit,
8097
8609
  collectPdfInputContractHints,
8098
8610
  collectUsedCodePointsFromPdfUnit,
8099
8611
  comparePdfBytes,
@@ -8123,6 +8635,7 @@ export {
8123
8635
  createDefaultElement,
8124
8636
  createDefaultPdfUnitData,
8125
8637
  createHttpSilentPrintAdapter,
8638
+ createPdfBrowserFidelitySamples,
8126
8639
  createPdfJsxNode,
8127
8640
  detectCJKCharacters,
8128
8641
  detectCJKInPdfInputs,
@@ -8270,6 +8783,7 @@ export {
8270
8783
  verifyPdfAuditSeal,
8271
8784
  verifyPdfUnitSignature,
8272
8785
  visitTemplateVariables,
8786
+ wrapMixedCjkAndLatinLines,
8273
8787
  wrapPdfTextLines
8274
8788
  };
8275
8789
  //# sourceMappingURL=index.js.map