pdfnative 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2322,6 +2322,16 @@ var MYANMAR_EXTENDED_A_END = 43647;
2322
2322
  var MYANMAR_EXTENDED_B_START = 43488;
2323
2323
  var MYANMAR_EXTENDED_B_END = 43519;
2324
2324
  var MYANMAR_VIRAMA = 4153;
2325
+ var MATH_OPERATORS_START = 8704;
2326
+ var MATH_OPERATORS_END = 8959;
2327
+ var SUPPLEMENTAL_MATH_OPERATORS_START = 10752;
2328
+ var SUPPLEMENTAL_MATH_OPERATORS_END = 11007;
2329
+ var GEOMETRIC_SHAPES_START = 9632;
2330
+ var GEOMETRIC_SHAPES_END = 9727;
2331
+ var MISC_MATH_SYMBOLS_A_START = 10176;
2332
+ var MISC_MATH_SYMBOLS_A_END = 10223;
2333
+ var MISC_MATH_SYMBOLS_B_START = 10624;
2334
+ var MISC_MATH_SYMBOLS_B_END = 10751;
2325
2335
  var EMOJI_RANGES = [
2326
2336
  [127744, 128511],
2327
2337
  // Miscellaneous Symbols and Pictographs
@@ -2400,6 +2410,9 @@ function isMyanmarCodepoint(cp) {
2400
2410
  function isDevanagariCodepoint(cp) {
2401
2411
  return cp >= DEVANAGARI_START && cp <= DEVANAGARI_END || cp >= DEVANAGARI_EXT_START && cp <= DEVANAGARI_EXT_END;
2402
2412
  }
2413
+ function isMathCodepoint(cp) {
2414
+ return cp >= MATH_OPERATORS_START && cp <= MATH_OPERATORS_END || cp >= SUPPLEMENTAL_MATH_OPERATORS_START && cp <= SUPPLEMENTAL_MATH_OPERATORS_END || cp >= GEOMETRIC_SHAPES_START && cp <= GEOMETRIC_SHAPES_END || cp >= MISC_MATH_SYMBOLS_A_START && cp <= MISC_MATH_SYMBOLS_A_END || cp >= MISC_MATH_SYMBOLS_B_START && cp <= MISC_MATH_SYMBOLS_B_END;
2415
+ }
2403
2416
  function isEmojiCodepoint(cp) {
2404
2417
  if (cp >= FITZPATRICK_START && cp <= FITZPATRICK_END) return true;
2405
2418
  for (const [lo, hi] of EMOJI_RANGES) {
@@ -2486,10 +2499,16 @@ function containsDevanagari(str) {
2486
2499
  }
2487
2500
  return false;
2488
2501
  }
2502
+ function containsMath(str) {
2503
+ for (let i = 0; i < str.length; i++) {
2504
+ if (isMathCodepoint(str.charCodeAt(i))) return true;
2505
+ }
2506
+ return false;
2507
+ }
2489
2508
 
2490
2509
  // src/shaping/script-detect.ts
2491
2510
  function needsUnicodeFont(lang) {
2492
- return ["th", "ja", "zh", "ko", "el", "hi", "te", "tr", "vi", "pl", "ar", "he", "ru", "ka", "hy", "am", "si", "bo", "km", "my", "emoji"].includes(lang);
2511
+ return ["th", "ja", "zh", "ko", "el", "hi", "te", "tr", "vi", "pl", "ar", "he", "ru", "ka", "hy", "am", "si", "bo", "km", "my", "math", "emoji"].includes(lang);
2493
2512
  }
2494
2513
  function detectFallbackLangs(texts, primaryLang) {
2495
2514
  const needed = /* @__PURE__ */ new Set();
@@ -2590,6 +2609,10 @@ function detectFallbackLangs(texts, primaryLang) {
2590
2609
  needed.add("hy");
2591
2610
  continue;
2592
2611
  }
2612
+ if (isMathCodepoint(cp)) {
2613
+ needed.add("math");
2614
+ continue;
2615
+ }
2593
2616
  if (isEmojiCodepoint(cp)) {
2594
2617
  needed.add("emoji");
2595
2618
  continue;
@@ -2620,6 +2643,7 @@ function detectCharLang(cp) {
2620
2643
  if (cp >= 1024 && cp <= 1279 || cp >= 1280 && cp <= 1327) return "ru";
2621
2644
  if (cp >= 4256 && cp <= 4351 || cp >= 11520 && cp <= 11567) return "ka";
2622
2645
  if (cp >= 1328 && cp <= 1423 || cp >= 64275 && cp <= 64279) return "hy";
2646
+ if (isMathCodepoint(cp)) return "math";
2623
2647
  if (isEmojiCodepoint(cp)) return "emoji";
2624
2648
  return null;
2625
2649
  }
@@ -6249,6 +6273,10 @@ function buildTextRunsWithFallback(text, fontRef, fd, sz, trackGid, pdfA = false
6249
6273
  for (let i = 0; i < text.length; ) {
6250
6274
  const rawCp = text.codePointAt(i) ?? 0;
6251
6275
  const charLen = rawCp > 65535 ? 2 : 1;
6276
+ if (rawCp < 32 || rawCp === 127) {
6277
+ i += charLen;
6278
+ continue;
6279
+ }
6252
6280
  const cp = rawCp === 8239 || rawCp === 160 ? 32 : rawCp;
6253
6281
  const char = text.substring(i, i + charLen);
6254
6282
  const gid = fd.cmap[cp] ?? 0;
@@ -8792,6 +8820,61 @@ function buildViewerPreferences(prefs) {
8792
8820
  // src/core/pdf-document.ts
8793
8821
  init_pdf_encrypt();
8794
8822
 
8823
+ // src/core/pdf-layout-debug.ts
8824
+ function resolveDebugOptions(debug) {
8825
+ if (!debug) return null;
8826
+ if (debug === true) {
8827
+ return { showMargins: true, showContentBounds: true, showCells: true };
8828
+ }
8829
+ const showMargins = debug.showMargins === true;
8830
+ const showContentBounds = debug.showContentBounds === true;
8831
+ const showCells = debug.showCells === true;
8832
+ if (!showMargins && !showContentBounds && !showCells) return null;
8833
+ return { showMargins, showContentBounds, showCells };
8834
+ }
8835
+ var COL_MARGIN = "0 0.45 0.95";
8836
+ var COL_BLOCK = "0.90 0.20 0.30";
8837
+ var COL_CELL = "0 0.62 0.30";
8838
+ function rectOp(x, y, w, h, color, lineW) {
8839
+ return `q ${color} RG ${fmtNum(lineW)} w ${fmtNum(x)} ${fmtNum(y)} ${fmtNum(w)} ${fmtNum(h)} re S Q`;
8840
+ }
8841
+ function marginBoxOps(pgW, pgH, mg, footerH) {
8842
+ const x = mg.l;
8843
+ const yBottom = mg.b + footerH;
8844
+ const w = pgW - mg.l - mg.r;
8845
+ const h = pgH - mg.t - yBottom;
8846
+ return rectOp(x, yBottom, w, h, COL_MARGIN, 0.5);
8847
+ }
8848
+ function blockBoundsOps(x, width, yTop, yBottom) {
8849
+ const h = yTop - yBottom;
8850
+ if (h <= 0) return "";
8851
+ return rectOp(x, yBottom, width, h, COL_BLOCK, 0.4);
8852
+ }
8853
+ function tableCellOps(plan, slice, yTop) {
8854
+ const drawCaption = slice ? slice.drawCaption : true;
8855
+ const drawHeader = slice ? slice.drawHeader : true;
8856
+ const fromRow = slice ? slice.fromRow : 0;
8857
+ const toRow = slice ? slice.toRow : plan.rowHeights.length;
8858
+ const parts = [];
8859
+ let y = yTop - (drawCaption ? plan.captionHeight : 0);
8860
+ if (drawHeader) {
8861
+ const hBottom = y - plan.headerHeight;
8862
+ for (let c = 0; c < plan.cx.length; c++) {
8863
+ parts.push(rectOp(plan.cx[c], hBottom, plan.cwi[c], plan.headerHeight, COL_CELL, 0.3));
8864
+ }
8865
+ y = hBottom;
8866
+ }
8867
+ for (let r = fromRow; r < toRow; r++) {
8868
+ const rh = plan.rowHeights[r];
8869
+ const rBottom = y - rh;
8870
+ for (let c = 0; c < plan.cx.length; c++) {
8871
+ parts.push(rectOp(plan.cx[c], rBottom, plan.cwi[c], rh, COL_CELL, 0.3));
8872
+ }
8873
+ y = rBottom;
8874
+ }
8875
+ return parts.join("\n");
8876
+ }
8877
+
8795
8878
  // src/core/pdf-form.ts
8796
8879
  var DEFAULT_FIELD_HEIGHT_TEXT = 22;
8797
8880
  var DEFAULT_FIELD_HEIGHT_MULTILINE = 60;
@@ -10926,6 +11009,51 @@ function getNum(attrs, name, def = 0) {
10926
11009
  const v = getAttr(attrs, name);
10927
11010
  return v !== void 0 ? +v : def;
10928
11011
  }
11012
+ function getLen(attrs, name) {
11013
+ const v = getAttr(attrs, name);
11014
+ if (v === void 0) return void 0;
11015
+ const n2 = parseFloat(v);
11016
+ return Number.isFinite(n2) ? n2 : void 0;
11017
+ }
11018
+ function decodeSvgEntities(s) {
11019
+ return s.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (_m, ent) => {
11020
+ if (ent[0] === "#") {
11021
+ const cp = ent[1] === "x" || ent[1] === "X" ? parseInt(ent.slice(2), 16) : parseInt(ent.slice(1), 10);
11022
+ return Number.isFinite(cp) && cp >= 0 && cp <= 1114111 ? String.fromCodePoint(cp) : "";
11023
+ }
11024
+ switch (ent) {
11025
+ case "amp":
11026
+ return "&";
11027
+ case "lt":
11028
+ return "<";
11029
+ case "gt":
11030
+ return ">";
11031
+ case "quot":
11032
+ return '"';
11033
+ case "apos":
11034
+ return "'";
11035
+ case "nbsp":
11036
+ return "\xA0";
11037
+ default:
11038
+ return "";
11039
+ }
11040
+ });
11041
+ }
11042
+ function stripSvgTags(raw) {
11043
+ let out = "";
11044
+ let inTag = false;
11045
+ for (const ch2 of raw) {
11046
+ if (ch2 === "<") inTag = true;
11047
+ else if (ch2 === ">") inTag = false;
11048
+ else if (!inTag) out += ch2;
11049
+ }
11050
+ return out;
11051
+ }
11052
+ function sanitizeSvgText(raw) {
11053
+ const noTags = stripSvgTags(raw);
11054
+ const decoded = decodeSvgEntities(noTags);
11055
+ return decoded.replace(/[\u0000-\u001F\u007F-\u009F]+/g, " ").replace(/\s+/g, " ").trim();
11056
+ }
10929
11057
  function rectToPath(x, y, w, h, rx, ry) {
10930
11058
  if (w <= 0 || h <= 0) return "";
10931
11059
  if (rx <= 0 && ry <= 0) {
@@ -11007,7 +11135,60 @@ function parseSvgMarkup(svg) {
11007
11135
  });
11008
11136
  }
11009
11137
  }
11010
- return { elements, viewBox };
11138
+ const textElements = parseSvgText(svg);
11139
+ return { elements, textElements, viewBox };
11140
+ }
11141
+ function parseSvgText(svg) {
11142
+ const out = [];
11143
+ const textRe = /<text\b([^>]*)>([\s\S]*?)<\/text>/gi;
11144
+ let tm;
11145
+ while ((tm = textRe.exec(svg)) !== null) {
11146
+ const attrs = tm[1];
11147
+ const inner = tm[2];
11148
+ const baseX = getLen(attrs, "x") ?? 0;
11149
+ const baseY = getLen(attrs, "y") ?? 0;
11150
+ const baseSize = getLen(attrs, "font-size") ?? 16;
11151
+ const baseFillRaw = getAttr(attrs, "fill");
11152
+ const baseFill = baseFillRaw ? normalizeSvgColor(baseFillRaw) : void 0;
11153
+ const baseAnchor = normalizeAnchor(getAttr(attrs, "text-anchor"));
11154
+ const tspanRe = /<tspan\b([^>]*)>([\s\S]*?)<\/tspan>/gi;
11155
+ let sm;
11156
+ let penX = baseX;
11157
+ let penY = baseY;
11158
+ let found = false;
11159
+ while ((sm = tspanRe.exec(inner)) !== null) {
11160
+ found = true;
11161
+ const sa = sm[1];
11162
+ const text = sanitizeSvgText(sm[2]);
11163
+ const ax = getLen(sa, "x");
11164
+ const ay = getLen(sa, "y");
11165
+ const adx = getLen(sa, "dx");
11166
+ const ady = getLen(sa, "dy");
11167
+ penX = ax !== void 0 ? ax : penX + (adx ?? 0);
11168
+ penY = ay !== void 0 ? ay : penY + (ady ?? 0);
11169
+ if (!text) continue;
11170
+ const fillRaw = getAttr(sa, "fill");
11171
+ out.push({
11172
+ text,
11173
+ x: penX,
11174
+ y: penY,
11175
+ fontSize: getLen(sa, "font-size") ?? baseSize,
11176
+ fill: fillRaw ? normalizeSvgColor(fillRaw) : baseFill,
11177
+ anchor: normalizeAnchor(getAttr(sa, "text-anchor")) ?? baseAnchor
11178
+ });
11179
+ }
11180
+ if (!found) {
11181
+ const text = sanitizeSvgText(inner);
11182
+ if (text) {
11183
+ out.push({ text, x: baseX, y: baseY, fontSize: baseSize, fill: baseFill, anchor: baseAnchor });
11184
+ }
11185
+ }
11186
+ }
11187
+ return out;
11188
+ }
11189
+ function normalizeAnchor(v) {
11190
+ if (v === "middle" || v === "end" || v === "start") return v;
11191
+ return void 0;
11011
11192
  }
11012
11193
  var fn = (n2) => n2.toFixed(2);
11013
11194
  function resolveColor(color, fallback) {
@@ -11043,36 +11224,62 @@ function buildPathOps(segments, fillRgb, strokeRgb, strokeWidth) {
11043
11224
  ops.push("Q");
11044
11225
  return ops.join("\n");
11045
11226
  }
11046
- function renderSvg(data, x, y, w, h, options) {
11227
+ function renderSvg(data, x, y, w, h, options, enc) {
11047
11228
  if (!data || w <= 0 || h <= 0) return "";
11048
11229
  const isSvgMarkup = data.trimStart().charAt(0) === "<";
11049
11230
  let vb;
11050
11231
  let elements;
11232
+ let textElements = [];
11051
11233
  if (isSvgMarkup) {
11052
11234
  const parsed = parseSvgMarkup(data);
11053
11235
  vb = options?.viewBox ?? parsed.viewBox ?? [0, 0, w, h];
11054
11236
  elements = parsed.elements;
11237
+ textElements = parsed.textElements;
11055
11238
  } else {
11056
11239
  vb = options?.viewBox ?? [0, 0, w, h];
11057
11240
  elements = [{ pathData: data }];
11058
11241
  }
11059
- if (elements.length === 0 || vb[2] <= 0 || vb[3] <= 0) return "";
11242
+ if (elements.length === 0 && textElements.length === 0 || vb[2] <= 0 || vb[3] <= 0) return "";
11060
11243
  const sx = w / vb[2];
11061
11244
  const sy = h / vb[3];
11062
- const cmOp = `${fn(sx)} 0 0 ${fn(-sy)} ${fn(x - vb[0] * sx)} ${fn(y + vb[1] * sy)} cm`;
11245
+ const tx2 = x - vb[0] * sx;
11246
+ const ty = y + vb[1] * sy;
11247
+ const cmOp = `${fn(sx)} 0 0 ${fn(-sy)} ${fn(tx2)} ${fn(ty)} cm`;
11063
11248
  const defaultFill = resolveColor(options?.fill, "0 0 0");
11064
11249
  const defaultStroke = resolveColor(options?.stroke, null);
11065
11250
  const defaultSw = options?.strokeWidth ?? 1;
11066
- const allOps = ["q", cmOp];
11251
+ const shapeOps = [];
11067
11252
  for (const elem of elements) {
11068
11253
  const segments = parseSvgPath(elem.pathData);
11069
11254
  if (segments.length === 0) continue;
11070
11255
  const fillRgb = resolveColor(elem.fill, defaultFill);
11071
11256
  const strokeRgb = resolveColor(elem.stroke, defaultStroke);
11072
11257
  const sw = elem.strokeWidth ?? defaultSw;
11073
- allOps.push(buildPathOps(segments, fillRgb, strokeRgb, sw));
11074
- }
11075
- allOps.push("Q");
11258
+ shapeOps.push(buildPathOps(segments, fillRgb, strokeRgb, sw));
11259
+ }
11260
+ const textOps = [];
11261
+ if (enc && textElements.length > 0) {
11262
+ for (const t of textElements) {
11263
+ const szPdf = t.fontSize * sy;
11264
+ if (szPdf <= 0 || !t.text) continue;
11265
+ const pdfBaseX = t.x * sx + tx2;
11266
+ const pdfBaseY = -sy * t.y + ty;
11267
+ const width = enc.tw(t.text, szPdf);
11268
+ const anchorOffset = t.anchor === "middle" ? width / 2 : t.anchor === "end" ? width : 0;
11269
+ const pdfX = pdfBaseX - anchorOffset;
11270
+ const fillRgb = resolveColor(t.fill, "0 0 0");
11271
+ textOps.push("q");
11272
+ if (fillRgb) textOps.push(`${fillRgb} rg`);
11273
+ textOps.push(txt(t.text, pdfX, pdfBaseY, enc.f1, szPdf, enc));
11274
+ textOps.push("Q");
11275
+ }
11276
+ }
11277
+ if (shapeOps.length === 0 && textOps.length === 0) return "";
11278
+ const allOps = [];
11279
+ if (shapeOps.length > 0) {
11280
+ allOps.push("q", cmOp, ...shapeOps, "Q");
11281
+ }
11282
+ allOps.push(...textOps);
11076
11283
  return allOps.join("\n");
11077
11284
  }
11078
11285
 
@@ -11378,7 +11585,7 @@ function planTable(block, enc, mgL, cw) {
11378
11585
  headerLines.push(lines);
11379
11586
  if (lines.length > headerMaxLines) headerMaxLines = lines.length;
11380
11587
  }
11381
- const headerHeight = headerMaxLines === 1 ? TH_H : Math.max(TH_H, headerMaxLines * fs.th * TABLE_LINE_HEIGHT + CELL_PAD_BOTTOM + 2);
11588
+ const headerHeight = headerMaxLines === 1 ? TH_H : Math.max(TH_H, headerMaxLines * fs.th * TABLE_LINE_HEIGHT + pad + 2);
11382
11589
  const rowLines = [];
11383
11590
  const rowHeights = [];
11384
11591
  for (let r = 0; r < block.rows.length; r++) {
@@ -11391,7 +11598,7 @@ function planTable(block, enc, mgL, cw) {
11391
11598
  if (lines.length > maxLines) maxLines = lines.length;
11392
11599
  }
11393
11600
  rowLines.push(cells);
11394
- const h = maxLines === 1 ? minRowH : Math.max(minRowH, maxLines * fs.td * TABLE_LINE_HEIGHT + CELL_PAD_BOTTOM + 2);
11601
+ const h = maxLines === 1 ? minRowH : Math.max(minRowH, maxLines * fs.td * TABLE_LINE_HEIGHT + pad + 2);
11395
11602
  rowHeights.push(h);
11396
11603
  }
11397
11604
  const captionLines = block.caption ? wrapText(block.caption, cw, CAPTION_FONT_SIZE, enc) : [];
@@ -11817,7 +12024,7 @@ function renderBarcodeBlock(block, y, mgL, cw, tagCtx, documentChildren) {
11817
12024
  y = by - 6;
11818
12025
  return { ops, y };
11819
12026
  }
11820
- function renderSvgBlock(block, y, mgL, cw, tagCtx, documentChildren) {
12027
+ function renderSvgBlock(block, y, mgL, cw, tagCtx, documentChildren, enc) {
11821
12028
  const ops = [];
11822
12029
  const w = block.width ?? DEFAULT_SVG_SIZE;
11823
12030
  const h = block.height ?? DEFAULT_SVG_SIZE;
@@ -11833,7 +12040,7 @@ function renderSvgBlock(block, y, mgL, cw, tagCtx, documentChildren) {
11833
12040
  stroke: block.stroke,
11834
12041
  strokeWidth: block.strokeWidth,
11835
12042
  viewBox: block.viewBox
11836
- });
12043
+ }, enc);
11837
12044
  if (svgOps) {
11838
12045
  if (tagCtx?.tagged) {
11839
12046
  const mcid = tagCtx.mcidAlloc.next(tagCtx.pageObjNum);
@@ -12015,6 +12222,7 @@ function assembleDocumentParts(params, layoutOptions) {
12015
12222
  if (watermarkOpts) {
12016
12223
  validateWatermark(watermarkOpts, layout?.tagged);
12017
12224
  }
12225
+ const debugOpts = resolveDebugOptions(layout?.debug);
12018
12226
  const attachments = layout?.attachments;
12019
12227
  validateAttachments(attachments, layout?.tagged);
12020
12228
  const mcidAlloc = tagged ? createMCIDAllocator() : void 0;
@@ -12202,6 +12410,10 @@ function assembleDocumentParts(params, layoutOptions) {
12202
12410
  const tagCtx = tagged && mcidAlloc ? { tagged: true, mcidAlloc, pageObjNum} : void 0;
12203
12411
  const ops = [];
12204
12412
  let y = pgH - mg.t;
12413
+ const debugOps = [];
12414
+ if (debugOpts?.showMargins) {
12415
+ debugOps.push(marginBoxOps(pgW, pgH, mg, FT_H));
12416
+ }
12205
12417
  if (headerTpl) {
12206
12418
  const hOps = renderPageTemplate(
12207
12419
  headerTpl,
@@ -12242,6 +12454,7 @@ function assembleDocumentParts(params, layoutOptions) {
12242
12454
  }
12243
12455
  const blocks = pageBlocks[p] ?? [];
12244
12456
  for (const block of blocks) {
12457
+ const yBefore = debugOpts ? y : 0;
12245
12458
  switch (block.type) {
12246
12459
  case "heading": {
12247
12460
  if (headingDestIdx < headingDests.length) {
@@ -12322,7 +12535,7 @@ function assembleDocumentParts(params, layoutOptions) {
12322
12535
  break;
12323
12536
  }
12324
12537
  case "svg": {
12325
- const result = renderSvgBlock(block, y, mg.l, cw, tagCtx, documentChildren);
12538
+ const result = renderSvgBlock(block, y, mg.l, cw, tagCtx, documentChildren, enc);
12326
12539
  ops.push(...result.ops);
12327
12540
  y = result.y;
12328
12541
  break;
@@ -12334,6 +12547,19 @@ function assembleDocumentParts(params, layoutOptions) {
12334
12547
  break;
12335
12548
  }
12336
12549
  }
12550
+ if (debugOpts) {
12551
+ if (debugOpts.showContentBounds) {
12552
+ const bo = blockBoundsOps(mg.l, cw, yBefore, y);
12553
+ if (bo) debugOps.push(bo);
12554
+ }
12555
+ if (debugOpts.showCells) {
12556
+ if (block.type === "__tableSlice") {
12557
+ debugOps.push(tableCellOps(block.slice.plan, block.slice, yBefore));
12558
+ } else if (block.type === "table") {
12559
+ debugOps.push(tableCellOps(planTable(block, enc, mg.l, cw), void 0, yBefore));
12560
+ }
12561
+ }
12562
+ }
12337
12563
  }
12338
12564
  if (wmState?.foregroundOps) {
12339
12565
  ops.push(wmState.foregroundOps);
@@ -12354,6 +12580,9 @@ function assembleDocumentParts(params, layoutOptions) {
12354
12580
  documentChildren
12355
12581
  );
12356
12582
  ops.push(...ftOps);
12583
+ if (debugOps.length > 0) {
12584
+ ops.push(...debugOps);
12585
+ }
12357
12586
  pageStreams.push(ops.join("\n"));
12358
12587
  }
12359
12588
  const annotsByPage = /* @__PURE__ */ new Map();
@@ -12951,6 +13180,173 @@ function autoOutlineFromHeadings(headings) {
12951
13180
  return root;
12952
13181
  }
12953
13182
 
13183
+ // src/core/pdf-layout-inspect.ts
13184
+ var TITLE_BAND_H = 22 + 12;
13185
+ function inspectDocumentLayout(params, layoutOptions) {
13186
+ if (!params || typeof params !== "object" || !Array.isArray(params.blocks)) {
13187
+ throw new Error("inspectDocumentLayout: params.blocks must be an array");
13188
+ }
13189
+ const layout = layoutOptions ?? params.layout;
13190
+ const pgW = layout?.pageWidth ?? PG_W;
13191
+ const pgH = layout?.pageHeight ?? PG_H;
13192
+ const mg = layout?.margins ?? { ...DEFAULT_MARGINS };
13193
+ const cw = pgW - mg.l - mg.r;
13194
+ const fontEntries = params.fontEntries ? [...params.fontEntries] : [];
13195
+ const tagged = resolvePdfAConfig(layout?.tagged).enabled;
13196
+ const enc = createEncodingContext(fontEntries, tagged, layout?.normalize ?? false);
13197
+ const headerH = layout?.headerTemplate ? HEADER_H : 0;
13198
+ const availableH = pgH - mg.t - mg.b - FT_H - headerH;
13199
+ const pages = [[]];
13200
+ let remainH = availableH;
13201
+ let curY = pgH - mg.t - headerH;
13202
+ if (params.title) {
13203
+ remainH -= TITLE_BAND_H;
13204
+ curY -= TITLE_BAND_H;
13205
+ }
13206
+ const newPage = () => {
13207
+ pages.push([]);
13208
+ remainH = availableH;
13209
+ curY = pgH - mg.t - headerH;
13210
+ };
13211
+ for (const block of params.blocks) {
13212
+ if (block.type === "pageBreak") {
13213
+ newPage();
13214
+ continue;
13215
+ }
13216
+ if (block.type === "table") {
13217
+ const plan = planTable(block, enc, mg.l, cw);
13218
+ const repeatHeader = block.repeatHeader !== false;
13219
+ const totalRows = block.rows.length;
13220
+ if (totalRows === 0) {
13221
+ const totalH = plan.captionHeight + plan.headerHeight + plan.trailerSpacing;
13222
+ if (totalH > remainH && pages[pages.length - 1].length > 0) newPage();
13223
+ pages[pages.length - 1].push({ type: "table", page: pages.length - 1, x: mg.l, top: curY, width: cw, height: totalH });
13224
+ remainH -= totalH;
13225
+ curY -= totalH;
13226
+ continue;
13227
+ }
13228
+ let rowIdx = 0;
13229
+ let isFirstSlice = true;
13230
+ while (rowIdx < totalRows) {
13231
+ const drawCaption = isFirstSlice;
13232
+ const drawHeader = isFirstSlice || repeatHeader;
13233
+ const tCapH = drawCaption ? plan.captionHeight : 0;
13234
+ const tHdrH = drawHeader ? plan.headerHeight : 0;
13235
+ const availableForRows = remainH - tCapH - tHdrH - plan.trailerSpacing;
13236
+ let usedH = 0;
13237
+ let count = 0;
13238
+ while (rowIdx + count < totalRows && usedH + plan.rowHeights[rowIdx + count] <= availableForRows) {
13239
+ usedH += plan.rowHeights[rowIdx + count];
13240
+ count++;
13241
+ }
13242
+ if (count === 0 && pages[pages.length - 1].length > 0) {
13243
+ newPage();
13244
+ continue;
13245
+ }
13246
+ if (count === 0) count = 1;
13247
+ rowIdx += count;
13248
+ const isFinalSlice = rowIdx >= totalRows;
13249
+ const sliceH = tCapH + tHdrH + usedH + (isFinalSlice ? plan.trailerSpacing : 0);
13250
+ pages[pages.length - 1].push({ type: "table", page: pages.length - 1, x: mg.l, top: curY, width: cw, height: sliceH });
13251
+ remainH -= sliceH;
13252
+ curY -= sliceH;
13253
+ isFirstSlice = false;
13254
+ if (!isFinalSlice) newPage();
13255
+ }
13256
+ continue;
13257
+ }
13258
+ const blockH = estimateBlockHeight(block, enc, cw);
13259
+ if (blockH > remainH && pages[pages.length - 1].length > 0) newPage();
13260
+ pages[pages.length - 1].push({ type: block.type, page: pages.length - 1, x: mg.l, top: curY, width: cw, height: blockH });
13261
+ remainH -= blockH;
13262
+ curY -= blockH;
13263
+ }
13264
+ const inspectedPages = pages.map((blocks, index) => ({ index, blocks }));
13265
+ return {
13266
+ pageWidth: pgW,
13267
+ pageHeight: pgH,
13268
+ margins: { t: mg.t, r: mg.r, b: mg.b, l: mg.l },
13269
+ totalPages: Math.max(1, pages.length),
13270
+ pages: inspectedPages
13271
+ };
13272
+ }
13273
+
13274
+ // src/core/pdf-annot-markup.ts
13275
+ var SUBTYPE = {
13276
+ text: "Text",
13277
+ highlight: "Highlight",
13278
+ underline: "Underline",
13279
+ strikeout: "StrikeOut",
13280
+ squiggly: "Squiggly",
13281
+ square: "Square",
13282
+ circle: "Circle",
13283
+ line: "Line",
13284
+ freetext: "FreeText"
13285
+ };
13286
+ function rectStr(r) {
13287
+ return `[${fmtNum(r[0])} ${fmtNum(r[1])} ${fmtNum(r[2])} ${fmtNum(r[3])}]`;
13288
+ }
13289
+ function quadFromRect(r) {
13290
+ const [x1, y1, x2, y2] = r;
13291
+ return [x1, y2, x2, y2, x1, y1, x2, y1];
13292
+ }
13293
+ function commonEntries(a) {
13294
+ const parts = [];
13295
+ if (a.contents !== void 0) parts.push(`/Contents ${encodePdfTextString(a.contents)}`);
13296
+ if (a.title !== void 0) parts.push(`/T ${encodePdfTextString(a.title)}`);
13297
+ if (a.color !== void 0) parts.push(`/C [${parseColor(a.color)}]`);
13298
+ if (a.opacity !== void 0) parts.push(`/CA ${fmtNum(a.opacity)}`);
13299
+ if (a.modified !== void 0) parts.push(`/M ${encodePdfTextString(a.modified)}`);
13300
+ parts.push(`/F ${a.flags ?? 4}`);
13301
+ return parts.join(" ");
13302
+ }
13303
+ function buildAnnotation(annot, objNum) {
13304
+ return `${objNum} 0 obj
13305
+ ${buildAnnotationBody(annot)}
13306
+ endobj`;
13307
+ }
13308
+ function buildAnnotationBody(annot) {
13309
+ const entries = [
13310
+ `/Type /Annot`,
13311
+ `/Subtype /${SUBTYPE[annot.type]}`,
13312
+ `/Rect ${rectStr(annot.rect)}`,
13313
+ commonEntries(annot)
13314
+ ];
13315
+ switch (annot.type) {
13316
+ case "text": {
13317
+ if (annot.open !== void 0) entries.push(`/Open ${annot.open ? "true" : "false"}`);
13318
+ if (annot.icon !== void 0) entries.push(`/Name /${annot.icon}`);
13319
+ break;
13320
+ }
13321
+ case "highlight":
13322
+ case "underline":
13323
+ case "strikeout":
13324
+ case "squiggly": {
13325
+ const quad = annot.quadPoints && annot.quadPoints.length >= 8 ? annot.quadPoints : quadFromRect(annot.rect);
13326
+ entries.push(`/QuadPoints [${quad.map(fmtNum).join(" ")}]`);
13327
+ break;
13328
+ }
13329
+ case "square":
13330
+ case "circle": {
13331
+ if (annot.interiorColor !== void 0) entries.push(`/IC [${parseColor(annot.interiorColor)}]`);
13332
+ entries.push(`/BS << /W ${fmtNum(annot.borderWidth ?? 1)} >>`);
13333
+ break;
13334
+ }
13335
+ case "line": {
13336
+ entries.push(`/L [${fmtNum(annot.start[0])} ${fmtNum(annot.start[1])} ${fmtNum(annot.end[0])} ${fmtNum(annot.end[1])}]`);
13337
+ entries.push(`/BS << /W ${fmtNum(annot.borderWidth ?? 1)} >>`);
13338
+ break;
13339
+ }
13340
+ case "freetext": {
13341
+ const sz = annot.fontSize ?? 12;
13342
+ const col = annot.color !== void 0 ? parseColor(annot.color) : "0 0 0";
13343
+ entries.push(`/DA (/Helv ${fmtNum(sz)} Tf ${col} rg)`);
13344
+ break;
13345
+ }
13346
+ }
13347
+ return `<< ${entries.filter(Boolean).join(" ")} >>`;
13348
+ }
13349
+
12954
13350
  // src/core/pdf-signature.ts
12955
13351
  init_sha();
12956
13352
 
@@ -14298,6 +14694,28 @@ function openPdf(bytes) {
14298
14694
  if (!entry || entry.type === 0) return null;
14299
14695
  return resolveRef({ num, gen: entry.gen });
14300
14696
  }
14697
+ let _pageRefs;
14698
+ function collectPageRefs() {
14699
+ if (_pageRefs) return _pageRefs;
14700
+ const catalog = getCatalog();
14701
+ const refs = [];
14702
+ const walk = (nodeVal, depth) => {
14703
+ if (depth > 100) return;
14704
+ const node = resolveValue2(nodeVal);
14705
+ if (!isDict(node)) return;
14706
+ if (dictGetName(node, "Type") === "Page") {
14707
+ if (isRef(nodeVal)) refs.push(nodeVal);
14708
+ return;
14709
+ }
14710
+ const kids = node.get("Kids");
14711
+ if (isArray(kids)) {
14712
+ for (const k of kids) walk(k, depth + 1);
14713
+ }
14714
+ };
14715
+ walk(catalog.get("Pages") ?? null, 0);
14716
+ _pageRefs = refs;
14717
+ return refs;
14718
+ }
14301
14719
  function decodeStreamData(stream) {
14302
14720
  let data = stream.data;
14303
14721
  const filterName = dictGetName(stream.dict, "Filter");
@@ -14349,10 +14767,107 @@ function openPdf(bytes) {
14349
14767
  const info = resolveValue2(infoRef);
14350
14768
  return isDict(info) ? info : null;
14351
14769
  },
14770
+ getPageLabels() {
14771
+ const catalog = getCatalog();
14772
+ const plVal = resolveValue2(catalog.get("PageLabels") ?? null);
14773
+ if (!isDict(plVal)) return null;
14774
+ const entries = /* @__PURE__ */ new Map();
14775
+ collectNumberTree(plVal, resolveValue2, entries);
14776
+ if (entries.size === 0) return null;
14777
+ const ranges = [];
14778
+ for (const startPage of [...entries.keys()].sort((a, b) => a - b)) {
14779
+ const dict = resolveValue2(entries.get(startPage) ?? null);
14780
+ if (!isDict(dict)) continue;
14781
+ const range = { startPage };
14782
+ const sOp = dictGetName(dict, "S");
14783
+ range.style = sOp === void 0 ? "none" : STYLE_FROM_OP[sOp] ?? "none";
14784
+ const prefix = dict.get("P");
14785
+ if (typeof prefix === "string") range.prefix = prefix;
14786
+ const start = dictGetNum(dict, "St");
14787
+ if (start !== void 0) range.start = start;
14788
+ ranges.push(range);
14789
+ }
14790
+ return ranges.length > 0 ? ranges : null;
14791
+ },
14792
+ getAnnotations(pageIndex) {
14793
+ const pages = collectPages();
14794
+ if (pageIndex < 0 || pageIndex >= pages.length) return [];
14795
+ const annotsVal = resolveValue2(pages[pageIndex].get("Annots") ?? null);
14796
+ if (!isArray(annotsVal)) return [];
14797
+ const out = [];
14798
+ for (const a of annotsVal) {
14799
+ const d = resolveValue2(a);
14800
+ if (!isDict(d)) continue;
14801
+ const subtype = dictGetName(d, "Subtype") ?? "";
14802
+ const rectVal = resolveValue2(d.get("Rect") ?? null);
14803
+ let rect = null;
14804
+ if (isArray(rectVal) && rectVal.length === 4 && rectVal.every((n2) => typeof n2 === "number")) {
14805
+ rect = [rectVal[0], rectVal[1], rectVal[2], rectVal[3]];
14806
+ }
14807
+ const parsed = { subtype, rect };
14808
+ const contents = d.get("Contents");
14809
+ if (typeof contents === "string") parsed.contents = decodePdfTextString(contents);
14810
+ const title = d.get("T");
14811
+ if (typeof title === "string") parsed.title = decodePdfTextString(title);
14812
+ const c = resolveValue2(d.get("C") ?? null);
14813
+ if (isArray(c)) {
14814
+ const nums = c.filter((x) => typeof x === "number");
14815
+ if (nums.length > 0) parsed.color = nums;
14816
+ }
14817
+ const qp = resolveValue2(d.get("QuadPoints") ?? null);
14818
+ if (isArray(qp)) {
14819
+ parsed.quadPoints = qp.filter((x) => typeof x === "number");
14820
+ }
14821
+ const action = resolveValue2(d.get("A") ?? null);
14822
+ if (isDict(action)) {
14823
+ const uri = action.get("URI");
14824
+ if (typeof uri === "string") parsed.url = uri;
14825
+ }
14826
+ out.push(parsed);
14827
+ }
14828
+ return out;
14829
+ },
14830
+ getPageRef(pageIndex) {
14831
+ const refs = collectPageRefs();
14832
+ return pageIndex >= 0 && pageIndex < refs.length ? refs[pageIndex] : null;
14833
+ },
14352
14834
  decodeStream: decodeStreamData,
14353
14835
  getObject
14354
14836
  };
14355
14837
  }
14838
+ function decodePdfTextString(raw) {
14839
+ if (raw.length >= 2 && raw.charCodeAt(0) === 254 && raw.charCodeAt(1) === 255) {
14840
+ let out = "";
14841
+ for (let i = 2; i + 1 < raw.length; i += 2) {
14842
+ out += String.fromCharCode(raw.charCodeAt(i) << 8 | raw.charCodeAt(i + 1));
14843
+ }
14844
+ return out;
14845
+ }
14846
+ return raw;
14847
+ }
14848
+ var STYLE_FROM_OP = {
14849
+ D: "decimal",
14850
+ r: "roman",
14851
+ R: "Roman",
14852
+ a: "alpha",
14853
+ A: "Alpha"
14854
+ };
14855
+ function collectNumberTree(node, resolve, out) {
14856
+ const nums = resolve(node.get("Nums") ?? null);
14857
+ if (isArray(nums)) {
14858
+ for (let i = 0; i + 1 < nums.length; i += 2) {
14859
+ const key = resolve(nums[i]);
14860
+ if (typeof key === "number") out.set(key, nums[i + 1]);
14861
+ }
14862
+ }
14863
+ const kids = resolve(node.get("Kids") ?? null);
14864
+ if (isArray(kids)) {
14865
+ for (const kid of kids) {
14866
+ const kd = resolve(kid);
14867
+ if (isDict(kd)) collectNumberTree(kd, resolve, out);
14868
+ }
14869
+ }
14870
+ }
14356
14871
  function flattenPageTree(node, resolve, pages) {
14357
14872
  const type = dictGetName(node, "Type");
14358
14873
  if (type === "Page") {
@@ -14487,6 +15002,21 @@ function createModifier(reader) {
14487
15002
  if (modified.has(num)) return modified.get(num) ?? null;
14488
15003
  return reader.getObject(num);
14489
15004
  }
15005
+ function addAnnotation(pageIndex, annotationBody) {
15006
+ const pageRef = reader.getPageRef(pageIndex);
15007
+ if (!pageRef) throw new Error(`addAnnotation: no page at index ${pageIndex}`);
15008
+ const objNum = addRawObject(annotationBody);
15009
+ const page = getObject(pageRef.num);
15010
+ if (!isDict(page)) throw new Error(`addAnnotation: page ${pageIndex} is not a dictionary`);
15011
+ const clone = new Map(page);
15012
+ const existing = clone.get("Annots");
15013
+ const resolved = isRef(existing) ? reader.resolveValue(existing) : existing;
15014
+ const annots = isArray(resolved) ? [...resolved] : [];
15015
+ annots.push({ type: "ref", num: objNum, gen: 0 });
15016
+ clone.set("Annots", annots);
15017
+ setObject(pageRef.num, clone);
15018
+ return objNum;
15019
+ }
14490
15020
  function save() {
14491
15021
  if (modified.size === 0) {
14492
15022
  return reader.bytes;
@@ -14532,6 +15062,7 @@ ${xrefOffset}
14532
15062
  setObject,
14533
15063
  addObject,
14534
15064
  addRawObject,
15065
+ addAnnotation,
14535
15066
  getObject,
14536
15067
  save,
14537
15068
  get nextObjNum() {
@@ -16145,6 +16676,6 @@ async function createPDF(pdfParams, options) {
16145
16676
  return generatePDFMainThread(pdfParams, options?.layoutOptions);
16146
16677
  }
16147
16678
 
16148
- export { BAL_H, DEFAULT_COLORS, DEFAULT_COLUMNS, DEFAULT_CW, DEFAULT_FONT_SIZES, DEFAULT_MARGINS, DEFAULT_MAX_BLOCKS, DEFAULT_MAX_INFLATE_OUTPUT, FT_H, HEADER_H, INFO_LN, KNOWN_DECODE_FILTERS, MAX_PARSE_DEPTH, MAX_XREF_CHAIN, PAGE_SIZES, PDF_A_CONFORMANCE_TARGETS, PG_H, PG_W, ROW_H, TH_H, TITLE_LN, WORKER_THRESHOLD, WORKER_TIMEOUT_MS, addSignaturePlaceholder, applyDecodeFilter, buildAcroFormDict, buildAppearanceStreamDict, buildCmsSignedData, buildDocumentPDF, buildDocumentPDFBytes, buildDocumentPDFStream, buildDocumentPDFStreamPageByPage, buildDocumentPDFStreamTrue, buildEmbeddedFiles, buildFormWidget, buildImageOperators, buildImageXObject, buildInternalLinkAnnotation, buildLinkAnnotation, buildPDF, buildPDFBytes, buildPDFStream, buildPDFStreamPageByPage, buildPDFStreamTrue, buildRadioGroupParent, buildSMaskXObject, buildSigDict, buildWatermarkState, chunkBinaryString, classifyClusters, classifyUseCategory, clearFontCache, computeColumnPositions, concatChunks, containsArabic, containsBengali, containsDevanagari, containsEthiopic, containsHebrew, containsKhmer, containsMyanmar, containsRTL, containsSinhala, containsTamil, containsTelugu, containsThai, containsTibetan, contoursToPath, createEncodingContext, createModifier, createPDF, createTokenizer, decodeASCII85, decodeASCIIHex, decodeEcPublicKey, decodeLZW, decodeRunLength, defaultFieldHeight, derBitString, derDecode, derInteger, derOctetString, derOid, derSequence, detectCharLang, detectFallbackLangs, detectImageFormat, dictGet, dictGetArray, dictGetDict, dictGetName, dictGetNum, dictGetRef, downloadBlob, ean13CheckDigit, ecPublicKeyFromPrivate, ecdsaSign, ecdsaVerify, encodeCode128, encodeEcPublicKey, encodePDF417, encodePdfTextString, estimateCmsSize, estimateContentsSize, extractGlyphContours, extractPages, findStartxref, generateDataMatrix, generatePDFInWorker, generatePDFMainThread, generateQR, getCryptoProvider, getMaxInflateOutputSize, getRegisteredLangs, getTrailerRef, getTrailerValue, hasFontLoader, helveticaBoldWidth, helveticaWidth, hmacSha256, inflateSync, initCrypto, initNodeCompression, initNodeDecompression as initNodeDecompression_parser, isArmenianCodepoint, isArray, isBengaliCodepoint, isCyrillicCodepoint, isDevanagariCodepoint, isDict, isEthiopicCodepoint, isGeorgianCodepoint, isKhmerCodepoint, isLinkAnnotation, isMyanmarCodepoint, isName, isRef, isSelfSigned, isSinhalaCodepoint, isStream, isTamilCodepoint, isTeluguCodepoint, isTibetanCodepoint, isValidPdfRgb, loadFontData, mergePdfs, nameValue, needsUnicodeFont, normalizeBidiEmbeddings, normalizeColors, openPdf, parseCertificate, parseColor, parseColrCpal, parseCpal, parseGlyfFont, parseImage, parseIndirectObject, parseJPEG, parsePNG, parseRsaPrivateKey, parseRsaPublicKey, parseSvgPath, parseValue, parseXrefTable, pdfString, registerFont, registerFonts, renderBarcode, renderCode128, renderColorGlyph, renderDataMatrix, renderEAN13, renderPDF417, renderQR, renderSvg, resetFontRegistry, resolveBidiRuns, resolveLayout, resolvePdfAConfig, resolveTemplate, rsaSign, rsaSignHash, rsaVerify, rsaVerifyHash, setCryptoProvider, setDeflateImpl, setInflateImpl, setMaxInflateOutputSize, sha384, sha512, shapeArabicText, shapeBengaliText, shapeDevanagariText, shapeKhmerText, shapeMyanmarText, shapeSinhalaText, shapeTamilText, shapeTeluguText, shapeThaiText, shapeTibetanText, signPdfBytes, slugify, splitPdf, splitTextByFont, streamByteLength, streamToFile, stripBidiControls, toBytes, toWinAnsi, truncate, truncateToWidth, validateAttachments, validateDocumentStreamable, validateFontData, validatePdfUA, validateTableStreamable, validateURL, validateWatermark, verifyCertSignature, wrapText };
16679
+ export { BAL_H, DEFAULT_COLORS, DEFAULT_COLUMNS, DEFAULT_CW, DEFAULT_FONT_SIZES, DEFAULT_MARGINS, DEFAULT_MAX_BLOCKS, DEFAULT_MAX_INFLATE_OUTPUT, FT_H, HEADER_H, INFO_LN, KNOWN_DECODE_FILTERS, MAX_PARSE_DEPTH, MAX_XREF_CHAIN, PAGE_SIZES, PDF_A_CONFORMANCE_TARGETS, PG_H, PG_W, ROW_H, TH_H, TITLE_LN, WORKER_THRESHOLD, WORKER_TIMEOUT_MS, addSignaturePlaceholder, applyDecodeFilter, buildAcroFormDict, buildAnnotation, buildAnnotationBody, buildAppearanceStreamDict, buildCmsSignedData, buildDocumentPDF, buildDocumentPDFBytes, buildDocumentPDFStream, buildDocumentPDFStreamPageByPage, buildDocumentPDFStreamTrue, buildEmbeddedFiles, buildFormWidget, buildImageOperators, buildImageXObject, buildInternalLinkAnnotation, buildLinkAnnotation, buildPDF, buildPDFBytes, buildPDFStream, buildPDFStreamPageByPage, buildPDFStreamTrue, buildRadioGroupParent, buildSMaskXObject, buildSigDict, buildWatermarkState, chunkBinaryString, classifyClusters, classifyUseCategory, clearFontCache, computeColumnPositions, concatChunks, containsArabic, containsBengali, containsDevanagari, containsEthiopic, containsHebrew, containsKhmer, containsMath, containsMyanmar, containsRTL, containsSinhala, containsTamil, containsTelugu, containsThai, containsTibetan, contoursToPath, createEncodingContext, createModifier, createPDF, createTokenizer, decodeASCII85, decodeASCIIHex, decodeEcPublicKey, decodeLZW, decodeRunLength, defaultFieldHeight, derBitString, derDecode, derInteger, derOctetString, derOid, derSequence, detectCharLang, detectFallbackLangs, detectImageFormat, dictGet, dictGetArray, dictGetDict, dictGetName, dictGetNum, dictGetRef, downloadBlob, ean13CheckDigit, ecPublicKeyFromPrivate, ecdsaSign, ecdsaVerify, encodeCode128, encodeEcPublicKey, encodePDF417, encodePdfTextString, estimateCmsSize, estimateContentsSize, extractGlyphContours, extractPages, findStartxref, generateDataMatrix, generatePDFInWorker, generatePDFMainThread, generateQR, getCryptoProvider, getMaxInflateOutputSize, getRegisteredLangs, getTrailerRef, getTrailerValue, hasFontLoader, helveticaBoldWidth, helveticaWidth, hmacSha256, inflateSync, initCrypto, initNodeCompression, initNodeDecompression as initNodeDecompression_parser, inspectDocumentLayout, isArmenianCodepoint, isArray, isBengaliCodepoint, isCyrillicCodepoint, isDevanagariCodepoint, isDict, isEthiopicCodepoint, isGeorgianCodepoint, isKhmerCodepoint, isLinkAnnotation, isMathCodepoint, isMyanmarCodepoint, isName, isRef, isSelfSigned, isSinhalaCodepoint, isStream, isTamilCodepoint, isTeluguCodepoint, isTibetanCodepoint, isValidPdfRgb, loadFontData, mergePdfs, nameValue, needsUnicodeFont, normalizeBidiEmbeddings, normalizeColors, openPdf, parseCertificate, parseColor, parseColrCpal, parseCpal, parseGlyfFont, parseImage, parseIndirectObject, parseJPEG, parsePNG, parseRsaPrivateKey, parseRsaPublicKey, parseSvgPath, parseValue, parseXrefTable, pdfString, registerFont, registerFonts, renderBarcode, renderCode128, renderColorGlyph, renderDataMatrix, renderEAN13, renderPDF417, renderQR, renderSvg, resetFontRegistry, resolveBidiRuns, resolveLayout, resolvePdfAConfig, resolveTemplate, rsaSign, rsaSignHash, rsaVerify, rsaVerifyHash, setCryptoProvider, setDeflateImpl, setInflateImpl, setMaxInflateOutputSize, sha384, sha512, shapeArabicText, shapeBengaliText, shapeDevanagariText, shapeKhmerText, shapeMyanmarText, shapeSinhalaText, shapeTamilText, shapeTeluguText, shapeThaiText, shapeTibetanText, signPdfBytes, slugify, splitPdf, splitTextByFont, streamByteLength, streamToFile, stripBidiControls, toBytes, toWinAnsi, truncate, truncateToWidth, validateAttachments, validateDocumentStreamable, validateFontData, validatePdfUA, validateTableStreamable, validateURL, validateWatermark, verifyCertSignature, wrapText };
16149
16680
  //# sourceMappingURL=index.js.map
16150
16681
  //# sourceMappingURL=index.js.map