modern-pdf-lib 0.25.0 → 0.28.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.
Files changed (110) hide show
  1. package/README.md +16 -3
  2. package/dist/{batchOptimize-Ba_pWw71.cjs → batchOptimize-CXC9gNqD.cjs} +55 -55
  3. package/dist/{batchOptimize-DtRwBOqR.mjs → batchOptimize-CjLGD5ie.mjs} +25 -25
  4. package/dist/{bridge-DYCQzxF7.cjs → bridge-ByvzPu5h.cjs} +29 -31
  5. package/dist/{bridge-CcivG_Sm.mjs → bridge-ZD6O6QQa.mjs} +4 -5
  6. package/dist/browser.cjs +263 -151
  7. package/dist/browser.d.cts +166 -166
  8. package/dist/browser.d.cts.map +1 -1
  9. package/dist/browser.d.mts +166 -166
  10. package/dist/browser.d.mts.map +1 -1
  11. package/dist/browser.mjs +15 -19
  12. package/dist/cli/index.cjs +7 -7
  13. package/dist/cli/index.mjs +8 -8
  14. package/dist/{compressionAnalysis-odbHC7Uk.mjs → compressionAnalysis-BgKy45pA.mjs} +60 -74
  15. package/dist/{compressionAnalysis-DGs-MqTe.d.mts → compressionAnalysis-CDOp_vPr.d.mts} +136 -136
  16. package/dist/compressionAnalysis-CDOp_vPr.d.mts.map +1 -0
  17. package/dist/{compressionAnalysis-B84FPXaQ.cjs → compressionAnalysis-Djv-Zvcd.cjs} +90 -104
  18. package/dist/{compressionAnalysis-VtYV9Zmq.d.cts → compressionAnalysis-UfmonqbM.d.cts} +136 -136
  19. package/dist/compressionAnalysis-UfmonqbM.d.cts.map +1 -0
  20. package/dist/create.cjs +21 -23
  21. package/dist/create.d.cts +2 -2
  22. package/dist/create.d.mts +2 -2
  23. package/dist/create.mjs +3 -5
  24. package/dist/{deduplicateImages-MfUDPxQz.mjs → deduplicateImages-BTCyAPfJ.mjs} +4 -5
  25. package/dist/{deduplicateImages-cKsnD6Ep.cjs → deduplicateImages-CaGgaqyS.cjs} +14 -15
  26. package/dist/{fieldAppearance-C8PoLFSc.d.mts → fieldAppearance-Df1262CT.d.cts} +44 -44
  27. package/dist/fieldAppearance-Df1262CT.d.cts.map +1 -0
  28. package/dist/{fieldAppearance-CdiGFG5e.d.cts → fieldAppearance-_CZdoUCD.d.mts} +44 -44
  29. package/dist/fieldAppearance-_CZdoUCD.d.mts.map +1 -0
  30. package/dist/fontEmbed-DGiZS0h2.d.cts +677 -0
  31. package/dist/fontEmbed-DGiZS0h2.d.cts.map +1 -0
  32. package/dist/fontEmbed-DtA_riGC.d.mts +677 -0
  33. package/dist/fontEmbed-DtA_riGC.d.mts.map +1 -0
  34. package/dist/forms.cjs +3 -4
  35. package/dist/forms.d.cts +2 -2
  36. package/dist/forms.d.mts +2 -2
  37. package/dist/forms.mjs +2 -3
  38. package/dist/{grayscaleDetect-C6kFF3dk.mjs → grayscaleDetect-6GJrgBRT.mjs} +3 -3
  39. package/dist/{grayscaleDetect-C2m-eEXR.cjs → grayscaleDetect-DAUqxjgR.cjs} +13 -14
  40. package/dist/{imageExtract-zEb1gnkb.cjs → imageExtract-DT50Hp_g.cjs} +13 -14
  41. package/dist/{imageExtract-Dnk_Ssv7.mjs → imageExtract-Dapir-ux.mjs} +3 -4
  42. package/dist/index-C1lZe66f.d.mts +8682 -0
  43. package/dist/index-C1lZe66f.d.mts.map +1 -0
  44. package/dist/index-D1SvXWSI.d.cts +8682 -0
  45. package/dist/index-D1SvXWSI.d.cts.map +1 -0
  46. package/dist/index.cjs +263 -150
  47. package/dist/index.d.cts +7 -7
  48. package/dist/index.d.mts +7 -7
  49. package/dist/index.mjs +14 -17
  50. package/dist/{layout-DH61a1iR.cjs → layout-C4vbTlBW.cjs} +184 -134
  51. package/dist/{layout-D6EUKSP8.mjs → layout-lO4x64kY.mjs} +50 -12
  52. package/dist/{loader-C7B5dVCI.mjs → loader-B1Ix7ozU.mjs} +259 -13
  53. package/dist/{loader-I4zdkoWc.cjs → loader-DR7H0XOf.cjs} +343 -67
  54. package/dist/parse.cjs +7 -8
  55. package/dist/parse.d.cts +3 -3
  56. package/dist/parse.d.mts +3 -3
  57. package/dist/parse.mjs +6 -7
  58. package/dist/pdfDocument-CH2E4UCc.d.mts +5160 -0
  59. package/dist/pdfDocument-CH2E4UCc.d.mts.map +1 -0
  60. package/dist/{pdfDocument-CEbbUP9i.cjs → pdfDocument-C_7mrBCL.cjs} +20493 -9511
  61. package/dist/pdfDocument-CzOipXnw.d.cts +5160 -0
  62. package/dist/pdfDocument-CzOipXnw.d.cts.map +1 -0
  63. package/dist/{pdfDocument-B0_XwS4X.mjs → pdfDocument-DRbT6HZw.mjs} +11017 -863
  64. package/dist/{pdfForm-9gd40uz9.cjs → pdfForm-BVS_do95.cjs} +113 -102
  65. package/dist/pdfForm-Ca86NDWn.d.cts +897 -0
  66. package/dist/pdfForm-Ca86NDWn.d.cts.map +1 -0
  67. package/dist/pdfForm-Ca86NDWn.d.mts +897 -0
  68. package/dist/pdfForm-Ca86NDWn.d.mts.map +1 -0
  69. package/dist/{pdfForm-Cn-cVicP.mjs → pdfForm-CfLnlsj-.mjs} +23 -18
  70. package/dist/{pdfObjects-1veop1_d.cjs → pdfObjects-BcPlSI0a.cjs} +62 -53
  71. package/dist/{pdfObjects-uEsWlfzU.mjs → pdfObjects-CB7TEdbW.mjs} +12 -2
  72. package/dist/rolldown-runtime-ak5kbic3.cjs +18 -0
  73. package/dist/{src-B1iDGLCL.cjs → src-C-IDXuvi.cjs} +9886 -1421
  74. package/dist/{src-Db6Qknoz.mjs → src-DJaD-bJ2.mjs} +8392 -515
  75. package/dist/{streamDecode-Bj568Nc9.mjs → streamDecode-BamENT3k.mjs} +129 -150
  76. package/dist/{streamDecode-CvgErkFu.cjs → streamDecode-DcaZz309.cjs} +139 -160
  77. package/package.json +26 -22
  78. package/dist/compressionAnalysis-DGs-MqTe.d.mts.map +0 -1
  79. package/dist/compressionAnalysis-VtYV9Zmq.d.cts.map +0 -1
  80. package/dist/fflateAdapter-LTAeAhaD.cjs +0 -207
  81. package/dist/fflateAdapter-PSiW_ML7.mjs +0 -196
  82. package/dist/fieldAppearance-C8PoLFSc.d.mts.map +0 -1
  83. package/dist/fieldAppearance-CdiGFG5e.d.cts.map +0 -1
  84. package/dist/fontEmbed-BN842wlb.d.cts +0 -659
  85. package/dist/fontEmbed-BN842wlb.d.cts.map +0 -1
  86. package/dist/fontEmbed-Dgq5K89o.d.mts +0 -659
  87. package/dist/fontEmbed-Dgq5K89o.d.mts.map +0 -1
  88. package/dist/fontSubset-5SLWMmEw.cjs +0 -518
  89. package/dist/fontSubset-D-vQQems.mjs +0 -495
  90. package/dist/index-DCSbmXWh.d.mts +0 -5939
  91. package/dist/index-DCSbmXWh.d.mts.map +0 -1
  92. package/dist/index-J1W3FdL8.d.cts +0 -5939
  93. package/dist/index-J1W3FdL8.d.cts.map +0 -1
  94. package/dist/libdeflateWasm-8b91Vmia.mjs +0 -220
  95. package/dist/libdeflateWasm-BdiDEJOj.cjs +0 -237
  96. package/dist/pdfCatalog-3yMIhJtt.mjs +0 -138
  97. package/dist/pdfCatalog-CYy4NXEY.cjs +0 -173
  98. package/dist/pdfDocument-BgvEP5Po.d.mts +0 -4673
  99. package/dist/pdfDocument-BgvEP5Po.d.mts.map +0 -1
  100. package/dist/pdfDocument-CbU-2TjT.d.cts +0 -4673
  101. package/dist/pdfDocument-CbU-2TjT.d.cts.map +0 -1
  102. package/dist/pdfForm-BiyNtYem.d.mts +0 -905
  103. package/dist/pdfForm-BiyNtYem.d.mts.map +0 -1
  104. package/dist/pdfForm-SOXJ72LW.d.cts +0 -905
  105. package/dist/pdfForm-SOXJ72LW.d.cts.map +0 -1
  106. package/dist/pdfPage-B_d9HmkG.mjs +0 -8015
  107. package/dist/pdfPage-Cd8jOJp6.cjs +0 -8728
  108. package/dist/pngEmbed-BWAbEUKF.mjs +0 -552
  109. package/dist/pngEmbed-D4X4ZN-3.cjs +0 -563
  110. package/dist/rolldown-runtime-CKhH4XqG.cjs +0 -24
@@ -1,6 +1,5 @@
1
- const require_pdfPage = require('./pdfPage-Cd8jOJp6.cjs');
2
- const require_pdfObjects = require('./pdfObjects-1veop1_d.cjs');
3
-
1
+ const require_pdfDocument = require("./pdfDocument-C_7mrBCL.cjs");
2
+ const require_pdfObjects = require("./pdfObjects-BcPlSI0a.cjs");
4
3
  //#region src/utils/pdfValueHelpers.ts
5
4
  /**
6
5
  * @module utils/pdfValueHelpers
@@ -12,29 +11,70 @@ const require_pdfObjects = require('./pdfObjects-1veop1_d.cjs');
12
11
  * Create a {@link PdfName} from a string.
13
12
  *
14
13
  * @param value The name value (with or without leading `/`).
14
+ * @returns A new {@link PdfName} instance.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const name = asPdfName('Type');
19
+ * ```
15
20
  */
16
- function asPDFName(value) {
21
+ function asPdfName(value) {
17
22
  return require_pdfObjects.PdfName.of(value);
18
23
  }
19
24
  /**
20
25
  * Create a {@link PdfNumber} from a numeric value.
21
26
  *
22
27
  * @param value The number.
28
+ * @returns A new {@link PdfNumber} instance.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const num = asPdfNumber(42);
33
+ * ```
23
34
  */
24
- function asPDFNumber(value) {
35
+ function asPdfNumber(value) {
25
36
  return require_pdfObjects.PdfNumber.of(value);
26
37
  }
27
38
  /**
39
+ * Create a {@link PdfName} from a string.
40
+ *
41
+ * @deprecated Use {@link asPdfName} instead. This alias uses inconsistent
42
+ * PascalCase `PDF` while the rest of the codebase uses `Pdf`.
43
+ * Will be removed in v2.0.
44
+ * @param value The name value (with or without leading `/`).
45
+ * @returns A new {@link PdfName} instance.
46
+ */
47
+ function asPDFName(value) {
48
+ return asPdfName(value);
49
+ }
50
+ /**
51
+ * Create a {@link PdfNumber} from a numeric value.
52
+ *
53
+ * @deprecated Use {@link asPdfNumber} instead. This alias uses inconsistent
54
+ * PascalCase `PDF` while the rest of the codebase uses `Pdf`.
55
+ * Will be removed in v2.0.
56
+ * @param value The number.
57
+ * @returns A new {@link PdfNumber} instance.
58
+ */
59
+ function asPDFNumber(value) {
60
+ return asPdfNumber(value);
61
+ }
62
+ /**
28
63
  * Extract a numeric value from a {@link PdfObject}.
29
64
  *
30
65
  * Returns `undefined` if the object is not a PdfNumber.
31
66
  *
32
67
  * @param obj The PDF object to inspect.
68
+ * @returns The numeric value, or `undefined` if not a PdfNumber.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const val = asNumber(someObj); // number | undefined
73
+ * ```
33
74
  */
34
75
  function asNumber(obj) {
35
76
  if (obj.kind === "number") return obj.value;
36
77
  }
37
-
38
78
  //#endregion
39
79
  //#region src/core/enums.ts
40
80
  /**
@@ -114,7 +154,6 @@ const ParseSpeeds = {
114
154
  Medium: 100,
115
155
  Slow: 10
116
156
  };
117
-
118
157
  //#endregion
119
158
  //#region src/core/pageManipulation.ts
120
159
  /**
@@ -124,7 +163,7 @@ const ParseSpeeds = {
124
163
  * @returns A `[width, height]` tuple in PDF points.
125
164
  */
126
165
  function resolveSize(size) {
127
- const resolved = size ?? require_pdfPage.PageSizes.A4;
166
+ const resolved = size ?? require_pdfDocument.PageSizes.A4;
128
167
  if (Array.isArray(resolved)) return [resolved[0], resolved[1]];
129
168
  return [resolved.width, resolved.height];
130
169
  }
@@ -184,7 +223,7 @@ function insertPage(doc, index, size) {
184
223
  const registry = doc.getRegistry();
185
224
  validateInsertIndex(index, pages.length, "insertPage");
186
225
  const [w, h] = resolveSize(size);
187
- const page = new require_pdfPage.PdfPage(w, h, registry);
226
+ const page = new require_pdfDocument.PdfPage(w, h, registry);
188
227
  doc.registerFontsOnPage(page);
189
228
  pages.splice(index, 0, page);
190
229
  return page;
@@ -351,7 +390,6 @@ function rotateAllPages(doc, angle) {
351
390
  page.setRotation(newRotation);
352
391
  }
353
392
  }
354
-
355
393
  //#endregion
356
394
  //#region src/core/layout.ts
357
395
  /**
@@ -367,7 +405,7 @@ function layoutMultilineText(text, options) {
367
405
  const rawLines = text.split("\n");
368
406
  const allLines = [];
369
407
  for (const rawLine of rawLines) if (maxWidth > 0) {
370
- const wrapped = require_pdfPage.wrapText(rawLine, maxWidth, font, fontSize, wordBreaks);
408
+ const wrapped = require_pdfDocument.wrapText(rawLine, maxWidth, font, fontSize, wordBreaks);
371
409
  for (const line of wrapped) allLines.push({
372
410
  text: line,
373
411
  width: font.widthOfTextAtSize(line, fontSize)
@@ -389,7 +427,7 @@ function layoutMultilineText(text, options) {
389
427
  */
390
428
  function layoutCombedText(text, options) {
391
429
  const { font, fontSize, cellCount, cellWidth } = options;
392
- return text.slice(0, cellCount).split("").map((char, i) => {
430
+ return Array.from(text).slice(0, cellCount).map((char, i) => {
393
431
  const charWidth = font.widthOfTextAtSize(char, fontSize);
394
432
  return {
395
433
  char,
@@ -468,150 +506,162 @@ function layoutSinglelineText(text, options) {
468
506
  y
469
507
  };
470
508
  }
471
-
472
509
  //#endregion
473
- Object.defineProperty(exports, 'BlendMode', {
474
- enumerable: true,
475
- get: function () {
476
- return BlendMode;
477
- }
510
+ Object.defineProperty(exports, "BlendMode", {
511
+ enumerable: true,
512
+ get: function() {
513
+ return BlendMode;
514
+ }
478
515
  });
479
- Object.defineProperty(exports, 'ImageAlignment', {
480
- enumerable: true,
481
- get: function () {
482
- return ImageAlignment;
483
- }
516
+ Object.defineProperty(exports, "ImageAlignment", {
517
+ enumerable: true,
518
+ get: function() {
519
+ return ImageAlignment;
520
+ }
484
521
  });
485
- Object.defineProperty(exports, 'LineCapStyle', {
486
- enumerable: true,
487
- get: function () {
488
- return LineCapStyle;
489
- }
522
+ Object.defineProperty(exports, "LineCapStyle", {
523
+ enumerable: true,
524
+ get: function() {
525
+ return LineCapStyle;
526
+ }
490
527
  });
491
- Object.defineProperty(exports, 'LineJoinStyle', {
492
- enumerable: true,
493
- get: function () {
494
- return LineJoinStyle;
495
- }
528
+ Object.defineProperty(exports, "LineJoinStyle", {
529
+ enumerable: true,
530
+ get: function() {
531
+ return LineJoinStyle;
532
+ }
496
533
  });
497
- Object.defineProperty(exports, 'ParseSpeeds', {
498
- enumerable: true,
499
- get: function () {
500
- return ParseSpeeds;
501
- }
534
+ Object.defineProperty(exports, "ParseSpeeds", {
535
+ enumerable: true,
536
+ get: function() {
537
+ return ParseSpeeds;
538
+ }
502
539
  });
503
- Object.defineProperty(exports, 'TextAlignment', {
504
- enumerable: true,
505
- get: function () {
506
- return TextAlignment;
507
- }
540
+ Object.defineProperty(exports, "TextAlignment", {
541
+ enumerable: true,
542
+ get: function() {
543
+ return TextAlignment;
544
+ }
508
545
  });
509
- Object.defineProperty(exports, 'TextRenderingMode', {
510
- enumerable: true,
511
- get: function () {
512
- return TextRenderingMode;
513
- }
546
+ Object.defineProperty(exports, "TextRenderingMode", {
547
+ enumerable: true,
548
+ get: function() {
549
+ return TextRenderingMode;
550
+ }
514
551
  });
515
- Object.defineProperty(exports, 'asNumber', {
516
- enumerable: true,
517
- get: function () {
518
- return asNumber;
519
- }
552
+ Object.defineProperty(exports, "asNumber", {
553
+ enumerable: true,
554
+ get: function() {
555
+ return asNumber;
556
+ }
520
557
  });
521
- Object.defineProperty(exports, 'asPDFName', {
522
- enumerable: true,
523
- get: function () {
524
- return asPDFName;
525
- }
558
+ Object.defineProperty(exports, "asPDFName", {
559
+ enumerable: true,
560
+ get: function() {
561
+ return asPDFName;
562
+ }
526
563
  });
527
- Object.defineProperty(exports, 'asPDFNumber', {
528
- enumerable: true,
529
- get: function () {
530
- return asPDFNumber;
531
- }
564
+ Object.defineProperty(exports, "asPDFNumber", {
565
+ enumerable: true,
566
+ get: function() {
567
+ return asPDFNumber;
568
+ }
532
569
  });
533
- Object.defineProperty(exports, 'computeFontSize', {
534
- enumerable: true,
535
- get: function () {
536
- return computeFontSize;
537
- }
570
+ Object.defineProperty(exports, "asPdfName", {
571
+ enumerable: true,
572
+ get: function() {
573
+ return asPdfName;
574
+ }
538
575
  });
539
- Object.defineProperty(exports, 'cropPage', {
540
- enumerable: true,
541
- get: function () {
542
- return cropPage;
543
- }
576
+ Object.defineProperty(exports, "asPdfNumber", {
577
+ enumerable: true,
578
+ get: function() {
579
+ return asPdfNumber;
580
+ }
544
581
  });
545
- Object.defineProperty(exports, 'getPageSize', {
546
- enumerable: true,
547
- get: function () {
548
- return getPageSize;
549
- }
582
+ Object.defineProperty(exports, "computeFontSize", {
583
+ enumerable: true,
584
+ get: function() {
585
+ return computeFontSize;
586
+ }
550
587
  });
551
- Object.defineProperty(exports, 'insertPage', {
552
- enumerable: true,
553
- get: function () {
554
- return insertPage;
555
- }
588
+ Object.defineProperty(exports, "cropPage", {
589
+ enumerable: true,
590
+ get: function() {
591
+ return cropPage;
592
+ }
556
593
  });
557
- Object.defineProperty(exports, 'layoutCombedText', {
558
- enumerable: true,
559
- get: function () {
560
- return layoutCombedText;
561
- }
594
+ Object.defineProperty(exports, "getPageSize", {
595
+ enumerable: true,
596
+ get: function() {
597
+ return getPageSize;
598
+ }
562
599
  });
563
- Object.defineProperty(exports, 'layoutMultilineText', {
564
- enumerable: true,
565
- get: function () {
566
- return layoutMultilineText;
567
- }
600
+ Object.defineProperty(exports, "insertPage", {
601
+ enumerable: true,
602
+ get: function() {
603
+ return insertPage;
604
+ }
568
605
  });
569
- Object.defineProperty(exports, 'layoutSinglelineText', {
570
- enumerable: true,
571
- get: function () {
572
- return layoutSinglelineText;
573
- }
606
+ Object.defineProperty(exports, "layoutCombedText", {
607
+ enumerable: true,
608
+ get: function() {
609
+ return layoutCombedText;
610
+ }
574
611
  });
575
- Object.defineProperty(exports, 'movePage', {
576
- enumerable: true,
577
- get: function () {
578
- return movePage;
579
- }
612
+ Object.defineProperty(exports, "layoutMultilineText", {
613
+ enumerable: true,
614
+ get: function() {
615
+ return layoutMultilineText;
616
+ }
580
617
  });
581
- Object.defineProperty(exports, 'removePage', {
582
- enumerable: true,
583
- get: function () {
584
- return removePage;
585
- }
618
+ Object.defineProperty(exports, "layoutSinglelineText", {
619
+ enumerable: true,
620
+ get: function() {
621
+ return layoutSinglelineText;
622
+ }
586
623
  });
587
- Object.defineProperty(exports, 'removePages', {
588
- enumerable: true,
589
- get: function () {
590
- return removePages;
591
- }
624
+ Object.defineProperty(exports, "movePage", {
625
+ enumerable: true,
626
+ get: function() {
627
+ return movePage;
628
+ }
592
629
  });
593
- Object.defineProperty(exports, 'resizePage', {
594
- enumerable: true,
595
- get: function () {
596
- return resizePage;
597
- }
630
+ Object.defineProperty(exports, "removePage", {
631
+ enumerable: true,
632
+ get: function() {
633
+ return removePage;
634
+ }
598
635
  });
599
- Object.defineProperty(exports, 'reversePages', {
600
- enumerable: true,
601
- get: function () {
602
- return reversePages;
603
- }
636
+ Object.defineProperty(exports, "removePages", {
637
+ enumerable: true,
638
+ get: function() {
639
+ return removePages;
640
+ }
604
641
  });
605
- Object.defineProperty(exports, 'rotateAllPages', {
606
- enumerable: true,
607
- get: function () {
608
- return rotateAllPages;
609
- }
642
+ Object.defineProperty(exports, "resizePage", {
643
+ enumerable: true,
644
+ get: function() {
645
+ return resizePage;
646
+ }
647
+ });
648
+ Object.defineProperty(exports, "reversePages", {
649
+ enumerable: true,
650
+ get: function() {
651
+ return reversePages;
652
+ }
610
653
  });
611
- Object.defineProperty(exports, 'rotatePage', {
612
- enumerable: true,
613
- get: function () {
614
- return rotatePage;
615
- }
654
+ Object.defineProperty(exports, "rotateAllPages", {
655
+ enumerable: true,
656
+ get: function() {
657
+ return rotateAllPages;
658
+ }
616
659
  });
617
- //# sourceMappingURL=layout-DH61a1iR.cjs.map
660
+ Object.defineProperty(exports, "rotatePage", {
661
+ enumerable: true,
662
+ get: function() {
663
+ return rotatePage;
664
+ }
665
+ });
666
+
667
+ //# sourceMappingURL=layout-C4vbTlBW.cjs.map
@@ -1,6 +1,5 @@
1
- import { i as wrapText, n as PdfPage, t as PageSizes } from "./pdfPage-B_d9HmkG.mjs";
2
- import { i as PdfName, o as PdfNumber } from "./pdfObjects-uEsWlfzU.mjs";
3
-
1
+ import { Bt as PdfPage, Vt as wrapText, zt as PageSizes } from "./pdfDocument-DRbT6HZw.mjs";
2
+ import { i as PdfName, o as PdfNumber } from "./pdfObjects-CB7TEdbW.mjs";
4
3
  //#region src/utils/pdfValueHelpers.ts
5
4
  /**
6
5
  * @module utils/pdfValueHelpers
@@ -12,29 +11,70 @@ import { i as PdfName, o as PdfNumber } from "./pdfObjects-uEsWlfzU.mjs";
12
11
  * Create a {@link PdfName} from a string.
13
12
  *
14
13
  * @param value The name value (with or without leading `/`).
14
+ * @returns A new {@link PdfName} instance.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const name = asPdfName('Type');
19
+ * ```
15
20
  */
16
- function asPDFName(value) {
21
+ function asPdfName(value) {
17
22
  return PdfName.of(value);
18
23
  }
19
24
  /**
20
25
  * Create a {@link PdfNumber} from a numeric value.
21
26
  *
22
27
  * @param value The number.
28
+ * @returns A new {@link PdfNumber} instance.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const num = asPdfNumber(42);
33
+ * ```
23
34
  */
24
- function asPDFNumber(value) {
35
+ function asPdfNumber(value) {
25
36
  return PdfNumber.of(value);
26
37
  }
27
38
  /**
39
+ * Create a {@link PdfName} from a string.
40
+ *
41
+ * @deprecated Use {@link asPdfName} instead. This alias uses inconsistent
42
+ * PascalCase `PDF` while the rest of the codebase uses `Pdf`.
43
+ * Will be removed in v2.0.
44
+ * @param value The name value (with or without leading `/`).
45
+ * @returns A new {@link PdfName} instance.
46
+ */
47
+ function asPDFName(value) {
48
+ return asPdfName(value);
49
+ }
50
+ /**
51
+ * Create a {@link PdfNumber} from a numeric value.
52
+ *
53
+ * @deprecated Use {@link asPdfNumber} instead. This alias uses inconsistent
54
+ * PascalCase `PDF` while the rest of the codebase uses `Pdf`.
55
+ * Will be removed in v2.0.
56
+ * @param value The number.
57
+ * @returns A new {@link PdfNumber} instance.
58
+ */
59
+ function asPDFNumber(value) {
60
+ return asPdfNumber(value);
61
+ }
62
+ /**
28
63
  * Extract a numeric value from a {@link PdfObject}.
29
64
  *
30
65
  * Returns `undefined` if the object is not a PdfNumber.
31
66
  *
32
67
  * @param obj The PDF object to inspect.
68
+ * @returns The numeric value, or `undefined` if not a PdfNumber.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const val = asNumber(someObj); // number | undefined
73
+ * ```
33
74
  */
34
75
  function asNumber(obj) {
35
76
  if (obj.kind === "number") return obj.value;
36
77
  }
37
-
38
78
  //#endregion
39
79
  //#region src/core/enums.ts
40
80
  /**
@@ -114,7 +154,6 @@ const ParseSpeeds = {
114
154
  Medium: 100,
115
155
  Slow: 10
116
156
  };
117
-
118
157
  //#endregion
119
158
  //#region src/core/pageManipulation.ts
120
159
  /**
@@ -351,7 +390,6 @@ function rotateAllPages(doc, angle) {
351
390
  page.setRotation(newRotation);
352
391
  }
353
392
  }
354
-
355
393
  //#endregion
356
394
  //#region src/core/layout.ts
357
395
  /**
@@ -389,7 +427,7 @@ function layoutMultilineText(text, options) {
389
427
  */
390
428
  function layoutCombedText(text, options) {
391
429
  const { font, fontSize, cellCount, cellWidth } = options;
392
- return text.slice(0, cellCount).split("").map((char, i) => {
430
+ return Array.from(text).slice(0, cellCount).map((char, i) => {
393
431
  const charWidth = font.widthOfTextAtSize(char, fontSize);
394
432
  return {
395
433
  char,
@@ -468,7 +506,7 @@ function layoutSinglelineText(text, options) {
468
506
  y
469
507
  };
470
508
  }
471
-
472
509
  //#endregion
473
- export { asPDFName as C, asNumber as S, LineCapStyle as _, cropPage as a, TextAlignment as b, movePage as c, resizePage as d, reversePages as f, ImageAlignment as g, BlendMode as h, layoutSinglelineText as i, removePage as l, rotatePage as m, layoutCombedText as n, getPageSize as o, rotateAllPages as p, layoutMultilineText as r, insertPage as s, computeFontSize as t, removePages as u, LineJoinStyle as v, asPDFNumber as w, TextRenderingMode as x, ParseSpeeds as y };
474
- //# sourceMappingURL=layout-D6EUKSP8.mjs.map
510
+ export { asPDFName as C, asPdfNumber as E, asNumber as S, asPdfName as T, LineCapStyle as _, cropPage as a, TextAlignment as b, movePage as c, resizePage as d, reversePages as f, ImageAlignment as g, BlendMode as h, layoutSinglelineText as i, removePage as l, rotatePage as m, layoutCombedText as n, getPageSize as o, rotateAllPages as p, layoutMultilineText as r, insertPage as s, computeFontSize as t, removePages as u, LineJoinStyle as v, asPDFNumber as w, TextRenderingMode as x, ParseSpeeds as y };
511
+
512
+ //# sourceMappingURL=layout-lO4x64kY.mjs.map