modern-pdf-lib 0.22.9 → 0.26.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/README.md +22 -4
- package/dist/{batchOptimize-CxyY4fZe.mjs → batchOptimize-BCJEEN8J.mjs} +4 -4
- package/dist/{batchOptimize-Ba_pWw71.cjs → batchOptimize-C1W3O68Q.cjs} +3 -3
- package/dist/{bridge-DYCQzxF7.cjs → bridge-DMEuGtfn.cjs} +2 -2
- package/dist/{bridge-DTH5LMAK.mjs → bridge-DaS-gzEd.mjs} +3 -3
- package/dist/browser.cjs +78 -13
- package/dist/browser.d.cts +5 -5
- package/dist/browser.d.mts +5 -5
- package/dist/browser.mjs +12 -12
- package/dist/cli/index.cjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{compressionAnalysis-B84FPXaQ.cjs → compressionAnalysis-B-FPzgzw.cjs} +7 -7
- package/dist/{compressionAnalysis-BBv4BkQP.d.mts → compressionAnalysis-Ch7t-HXn.d.mts} +26 -3
- package/dist/compressionAnalysis-Ch7t-HXn.d.mts.map +1 -0
- package/dist/{compressionAnalysis-ChkscEa1.mjs → compressionAnalysis-CwknBtqx.mjs} +7 -7
- package/dist/{compressionAnalysis-CtJ2X9l2.d.cts → compressionAnalysis-Dgv1TtHJ.d.cts} +26 -3
- package/dist/compressionAnalysis-Dgv1TtHJ.d.cts.map +1 -0
- package/dist/create.cjs +23 -4
- package/dist/create.d.cts +3 -3
- package/dist/create.d.mts +3 -3
- package/dist/create.mjs +4 -4
- package/dist/{deduplicateImages-CmTeo6Tx.mjs → deduplicateImages-DIon68zB.mjs} +2 -2
- package/dist/{fflateAdapter-CBQpGTlx.mjs → fflateAdapter-DuNiByKx.mjs} +2 -2
- package/dist/{fontEmbed-LID6yG6g.d.cts → fontEmbed-3YhUPLFj.d.cts} +26 -3
- package/dist/fontEmbed-3YhUPLFj.d.cts.map +1 -0
- package/dist/{fontEmbed-Dsu9fo4U.d.mts → fontEmbed-DlVnVCZU.d.mts} +26 -3
- package/dist/fontEmbed-DlVnVCZU.d.mts.map +1 -0
- package/dist/{fontSubset-DWpduoY2.mjs → fontSubset-BGFDIMmT.mjs} +2 -2
- package/dist/forms.cjs +9 -2
- package/dist/forms.d.cts +3 -3
- package/dist/forms.d.mts +3 -3
- package/dist/forms.mjs +2 -2
- package/dist/{index-BtYOx5wh.d.mts → index-B4S61WjK.d.mts} +1929 -326
- package/dist/index-B4S61WjK.d.mts.map +1 -0
- package/dist/{index-bpktKzCA.d.cts → index-xfJP6Ycm.d.cts} +1929 -326
- package/dist/index-xfJP6Ycm.d.cts.map +1 -0
- package/dist/index.cjs +78 -13
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +12 -12
- package/dist/{layout-DgX_0jfK.mjs → layout-CrqeJBMI.mjs} +40 -4
- package/dist/{layout-CuAVk_Or.cjs → layout-DQh05VP-.cjs} +57 -3
- package/dist/{libdeflateWasm-rLppXytE.mjs → libdeflateWasm-CcA1W04G.mjs} +3 -3
- package/dist/{libdeflateWasm-BdiDEJOj.cjs → libdeflateWasm-DLw-I1CY.cjs} +2 -2
- package/dist/{loader-3u6Tw5T-.mjs → loader-CVB-c_3Z.mjs} +16 -6
- package/dist/{loader-I4zdkoWc.cjs → loader-DYCH3n7d.cjs} +15 -5
- package/dist/parse.cjs +4 -2
- package/dist/parse.d.cts +3 -3
- package/dist/parse.d.mts +3 -3
- package/dist/parse.mjs +3 -3
- package/dist/{pdfCatalog-CYy4NXEY.cjs → pdfCatalog-Bqq4FiLn.cjs} +2 -1
- package/dist/{pdfCatalog-IImGcMbR.mjs → pdfCatalog-CnKMAtIo.mjs} +3 -2
- package/dist/{pdfDocument-BSiQdNZq.d.cts → pdfDocument-Bc_vAO74.d.cts} +293 -175
- package/dist/pdfDocument-Bc_vAO74.d.cts.map +1 -0
- package/dist/{pdfDocument-i6U5fQ91.d.mts → pdfDocument-Bi-NoyXv.d.mts} +293 -175
- package/dist/pdfDocument-Bi-NoyXv.d.mts.map +1 -0
- package/dist/{pdfDocument-BFxHD_2u.mjs → pdfDocument-D7aFSQEY.mjs} +1920 -53
- package/dist/{pdfDocument-pmRXryVI.cjs → pdfDocument-D9uYNSb-.cjs} +2035 -48
- package/dist/{pdfForm-9gd40uz9.cjs → pdfForm-BpqDGp29.cjs} +7 -1
- package/dist/{pdfForm-Cn-cVicP.mjs → pdfForm-C3mC9FoQ.mjs} +2 -2
- package/dist/{pdfPage-Cd8e7flb.mjs → pdfPage-BJIE5hc6.mjs} +189 -24
- package/dist/{pdfPage-Cd8jOJp6.cjs → pdfPage-C_tjEjj1.cjs} +188 -23
- package/dist/{pngEmbed-BLj2zi-5.mjs → pngEmbed-CGi7cym7.mjs} +3 -3
- package/dist/{pngEmbed-D4X4ZN-3.cjs → pngEmbed-CTn9IeNB.cjs} +2 -2
- package/dist/{src-Dm4aaZ8q.mjs → src-QZWP21qF.mjs} +7879 -2739
- package/dist/{src-6L07EQsi.cjs → src-lFqJHb1C.cjs} +8263 -2841
- package/package.json +5 -2
- package/dist/compressionAnalysis-BBv4BkQP.d.mts.map +0 -1
- package/dist/compressionAnalysis-CtJ2X9l2.d.cts.map +0 -1
- package/dist/fontEmbed-Dsu9fo4U.d.mts.map +0 -1
- package/dist/fontEmbed-LID6yG6g.d.cts.map +0 -1
- package/dist/index-BtYOx5wh.d.mts.map +0 -1
- package/dist/index-bpktKzCA.d.cts.map +0 -1
- package/dist/pdfDocument-BSiQdNZq.d.cts.map +0 -1
- package/dist/pdfDocument-i6U5fQ91.d.mts.map +0 -1
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
import { $ as DrawLineOptions, $n as colorToComponents, $t as PdfLayerManager, A as
|
|
1
|
+
import { $ as DrawLineOptions, $n as colorToComponents, $t as PdfLayerManager, A as LoadPdfOptions, An as Angle, At as ColorStop, B as encodePermissions, Bn as rotationMatrix, Bt as linearGradient, C as ViewerPreferences, Cn as BlendMode, Ct as renderMultiPageTable, D as OutlineItemOptions, Dn as ParseSpeeds, Dt as QrCodeOptions, E as OutlineDestination, En as LineJoinStyle, Et as QrCodeMatrix, F as EncryptAlgorithm, Fn as degreesToRadians, Ft as RadialGradientFill, G as buildCatalog, Gn as translate, Gt as EmbeddedPdfPage, H as DocumentMetadata, Hn as scale, Ht as tilingPattern, I as EncryptOptions, In as radians, It as RadialGradientOptions, J as buildPageTree, Jn as GrayscaleColor, Jt as RedactionOptions, K as buildDocumentStructure, Kn as CmykColor, Kt as embedPageAsFormXObject, L as PdfEncryptionHandler, Ln as radiansToDegrees, Lt as TilingPatternOptions, M as PdfSaveOptions, Mn as Radians, Mt as LinearGradientOptions, N as PdfWriter, Nn as concatMatrix, Nt as NormalizedStop, O as PdfOutlineItem, On as TextAlignment, Ot as encodeQrCode, P as serializePdf, Pn as degrees, Pt as PatternFill, Q as DrawImageOptions, Qn as cmyk, Qt as PdfLayer, R as PdfPermissionFlags, Rn as restoreState, Rt as buildGradientObjects, S as PdfViewerPreferences, Sn as StructureType, St as TextRun, T as parseViewerPreferences, Tn as LineCapStyle, Tt as ErrorCorrectionLevel, U as DocumentStructure, Un as setGraphicsState, Ut as DrawPageOptions, V as CatalogOptions, Vn as saveState, Vt as radialGradient, W as PageEntry, Wn as skew, Wt as EmbedPageOptions, X as DrawCircleOptions, Xn as applyFillColor, Xt as getRedactionMarks, Y as formatPdfDate, Yn as RgbColor, Yt as applyRedactions, Z as DrawEllipseOptions, Zn as applyStrokeColor, Zt as markForRedaction, _ as PdfSignatureInfo, _n as createAnnotation, _t as PageContent, a as StandardFonts, an as SvgDrawCommand, ar as setFillColorCmyk, at as FontRef, b as getSignatures, bn as PdfStructureTree, bt as TableRenderResult, c as verifySignature, cn as parseSvgColor, cr as setFillingColor, ct as PageSizes, d as addWatermark, dn as AnnotationFlags, dr as setStrokeColorGray, dt as SoftMaskRef, en as beginLayerContent, er as componentsToColor, et as DrawQrCodeOptions, f as addWatermarkToPage, fn as AnnotationOptions, fr as setStrokeColorRgb, ft as TransparencyGroupOptions, g as getAttachments, gn as buildAnnotationDict, gt as NestedTableContent, h as buildEmbeddedFilesNameTree, hn as annotationFromDict, ht as MultiPageTableResult, i as StandardFontName, in as svgToPdfOperators, ir as setFillColor, it as DrawTextOptions, j as loadPdf, jn as Degrees, jt as GradientFill, k as PdfOutlineTree, kn as TextRenderingMode, kt as qrCodeToOperators, l as verifySignatures, ln as parseSvgPath, lr as setStrokeColor, lt as PdfPage, m as attachFile, mn as PdfAnnotation, mr as setStrokingColor, mt as DrawTableOptions, n as PdfDocument, nn as SvgRenderOptions, nr as rgb, nt as DrawSquareOptions, o as createPdf, on as SvgElement, or as setFillColorGray, ot as ImageRef, p as EmbeddedFile, pn as AnnotationType, pr as setStrokeColorSpace, pt as CellContent, q as buildInfoDict, qn as Color, qt as RedactionMark, r as SetTitleOptions, rn as drawSvgOnPage, rr as setColorSpace, rt as DrawSvgPathOptions, s as SignatureVerificationResult, sn as parseSvg, sr as setFillColorRgb, st as PageSize, t as EmbedFontOptions, tn as endLayerContent, tr as grayscale, tt as DrawRectangleOptions, u as WatermarkOptions, un as parseSvgTransform, ur as setStrokeColorCmyk, ut as SoftMaskBuilder, v as SignOptions, vn as AccessibilityIssue, vt as TableCell, w as buildViewerPreferencesDict, wn as ImageAlignment, wt as renderTable, x as signPdf, xn as StructureElementOptions, xt as TableRow, y as VisibleSignatureOptions, yn as PdfStructureElement, yt as TableColumn, z as decodePermissions, zn as rotate, zt as buildPatternObjects } from "./pdfDocument-Bc_vAO74.cjs";
|
|
2
2
|
import { C as PdfRef, E as RegistryEntry, S as PdfObjectRegistry, T as PdfString, _ as PdfDict, a as PdfListboxField, b as PdfNumber, c as PdfCheckboxField, d as FieldType, f as PdfField, g as PdfBool, h as PdfArray, i as PdfButtonField, l as PdfTextField, m as ByteWriter, n as RefResolver, o as PdfDropdownField, p as WidgetAnnotationHost, r as PdfSignatureField, s as PdfRadioGroup, t as PdfForm, u as FieldFlags, v as PdfName, w as PdfStream, x as PdfObject, y as PdfNull } from "./pdfForm-SOXJ72LW.cjs";
|
|
3
|
-
import { A as movePage, C as copyPages, D as cropPage, E as CropBox, F as rotateAllPages, I as rotatePage, M as removePages, N as resizePage, O as getPageSize, P as reversePages, S as PageRange, T as splitPdf, _ as LayoutSinglelineResult, a as FontEmbeddingResult, b as layoutMultilineText, c as SubsetCmap, d as extractMetrics, f as ComputeFontSizeOptions, g as LayoutSinglelineOptions, h as LayoutMultilineResult, i as FontDescriptorData, j as removePage, k as insertPage, l as SubsetResult, m as LayoutMultilineOptions, n as CIDSystemInfoData, o as Type0FontData, p as LayoutCombedOptions, r as EmbeddedFont, s as WidthEntry, t as CIDFontData, u as FontMetrics, v as computeFontSize, w as mergePdfs, x as layoutSinglelineText, y as layoutCombedText } from "./fontEmbed-
|
|
3
|
+
import { A as movePage, C as copyPages, D as cropPage, E as CropBox, F as rotateAllPages, I as rotatePage, L as asNumber, M as removePages, N as resizePage, O as getPageSize, P as reversePages, R as asPDFName, S as PageRange, T as splitPdf, _ as LayoutSinglelineResult, a as FontEmbeddingResult, b as layoutMultilineText, c as SubsetCmap, d as extractMetrics, f as ComputeFontSizeOptions, g as LayoutSinglelineOptions, h as LayoutMultilineResult, i as FontDescriptorData, j as removePage, k as insertPage, l as SubsetResult, m as LayoutMultilineOptions, n as CIDSystemInfoData, o as Type0FontData, p as LayoutCombedOptions, r as EmbeddedFont, s as WidthEntry, t as CIDFontData, u as FontMetrics, v as computeFontSize, w as mergePdfs, x as layoutSinglelineText, y as layoutCombedText, z as asPDFNumber } from "./fontEmbed-3YhUPLFj.cjs";
|
|
4
4
|
import { a as ListboxAppearanceOptions, c as TextAppearanceOptions, d as generateDropdownAppearance, f as generateListboxAppearance, h as generateTextAppearance, i as DropdownAppearanceOptions, l as generateButtonAppearance, m as generateSignatureAppearance, n as ButtonAppearanceOptions, o as RadioAppearanceOptions, p as generateRadioAppearance, r as CheckboxAppearanceOptions, s as SignatureAppearanceOptions, t as AppearanceProviderFor, u as generateCheckboxAppearance } from "./fieldAppearance-CdiGFG5e.cjs";
|
|
5
|
-
import { a as
|
|
5
|
+
import { _ as parseContentStream, a as ImageInfo, c as PdfParseError, d as TextExtractionOptions, f as TextItem, g as Operand, h as ContentStreamOperator, i as analyzeImages, l as formatHexContext, m as extractTextWithPositions, n as AnalyzeImagesOptions, o as decodeImageStream, p as extractText, r as ImageAnalysis, s as extractImages, t as AnalysisReport, u as decodeStream } from "./compressionAnalysis-Dgv1TtHJ.cjs";
|
|
6
6
|
|
|
7
7
|
//#region \0rolldown/runtime.js
|
|
8
8
|
//#endregion
|
|
9
|
-
//#region src/utils/pdfValueHelpers.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Create a {@link PdfName} from a string.
|
|
12
|
-
*
|
|
13
|
-
* @param value The name value (with or without leading `/`).
|
|
14
|
-
*/
|
|
15
|
-
declare function asPDFName(value: string): PdfName;
|
|
16
|
-
/**
|
|
17
|
-
* Create a {@link PdfNumber} from a numeric value.
|
|
18
|
-
*
|
|
19
|
-
* @param value The number.
|
|
20
|
-
*/
|
|
21
|
-
declare function asPDFNumber(value: number): PdfNumber;
|
|
22
|
-
/**
|
|
23
|
-
* Extract a numeric value from a {@link PdfObject}.
|
|
24
|
-
*
|
|
25
|
-
* Returns `undefined` if the object is not a PdfNumber.
|
|
26
|
-
*
|
|
27
|
-
* @param obj The PDF object to inspect.
|
|
28
|
-
*/
|
|
29
|
-
declare function asNumber(obj: PdfObject): number | undefined;
|
|
30
|
-
//#endregion
|
|
31
9
|
//#region src/core/incrementalWriter.d.ts
|
|
32
10
|
/**
|
|
33
11
|
* Result of an incremental save operation.
|
|
@@ -805,6 +783,132 @@ declare function summarizeIssues(issues: readonly AccessibilityIssue[]): {
|
|
|
805
783
|
*/
|
|
806
784
|
declare function isAccessible(issues: readonly AccessibilityIssue[]): boolean;
|
|
807
785
|
//#endregion
|
|
786
|
+
//#region src/accessibility/pdfUaValidator.d.ts
|
|
787
|
+
/**
|
|
788
|
+
* PDF/UA conformance level.
|
|
789
|
+
*
|
|
790
|
+
* Currently only PDF/UA-1 is supported. PDF/UA-2 (ISO 14289-2)
|
|
791
|
+
* may be added in a future release.
|
|
792
|
+
*/
|
|
793
|
+
type PdfUaLevel = 'UA1';
|
|
794
|
+
/**
|
|
795
|
+
* A single PDF/UA validation error — a must-fix violation.
|
|
796
|
+
*/
|
|
797
|
+
interface PdfUaError {
|
|
798
|
+
/** Machine-readable error code (e.g. `"UA-STRUCT-001"`). */
|
|
799
|
+
readonly code: string;
|
|
800
|
+
/** Human-readable description of the violation. */
|
|
801
|
+
readonly message: string;
|
|
802
|
+
/** The ISO 14289-1 clause reference, if applicable. */
|
|
803
|
+
readonly clause?: string | undefined;
|
|
804
|
+
/** The structure element related to the error, if any. */
|
|
805
|
+
readonly element?: PdfStructureElement | undefined;
|
|
806
|
+
/** Zero-based page index, if the issue is page-specific. */
|
|
807
|
+
readonly pageIndex?: number | undefined;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* A single PDF/UA validation warning — a best-practice recommendation.
|
|
811
|
+
*/
|
|
812
|
+
interface PdfUaWarning {
|
|
813
|
+
/** Machine-readable warning code (e.g. `"UA-WARN-001"`). */
|
|
814
|
+
readonly code: string;
|
|
815
|
+
/** Human-readable recommendation. */
|
|
816
|
+
readonly message: string;
|
|
817
|
+
/** The structure element related to the warning, if any. */
|
|
818
|
+
readonly element?: PdfStructureElement | undefined;
|
|
819
|
+
/** Zero-based page index, if the warning is page-specific. */
|
|
820
|
+
readonly pageIndex?: number | undefined;
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Result of a PDF/UA validation check.
|
|
824
|
+
*/
|
|
825
|
+
interface PdfUaValidationResult {
|
|
826
|
+
/** Whether the document passes all PDF/UA requirements (no errors). */
|
|
827
|
+
readonly valid: boolean;
|
|
828
|
+
/** The PDF/UA conformance level checked against. */
|
|
829
|
+
readonly level: PdfUaLevel;
|
|
830
|
+
/** Must-fix violations that prevent compliance. */
|
|
831
|
+
readonly errors: PdfUaError[];
|
|
832
|
+
/** Best-practice recommendations. */
|
|
833
|
+
readonly warnings: PdfUaWarning[];
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Result of the {@link enforcePdfUa} auto-fix pass.
|
|
837
|
+
*/
|
|
838
|
+
interface PdfUaEnforcementResult {
|
|
839
|
+
/** Actions that were successfully applied. */
|
|
840
|
+
readonly fixed: string[];
|
|
841
|
+
/** Issues that could not be auto-fixed and require manual attention. */
|
|
842
|
+
readonly unfixable: PdfUaError[];
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Validate a PDF document against PDF/UA-1 (ISO 14289-1) requirements.
|
|
846
|
+
*
|
|
847
|
+
* Performs the following checks:
|
|
848
|
+
* 1. Structure tree presence (/StructTreeRoot, /MarkInfo)
|
|
849
|
+
* 2. Document language (/Lang)
|
|
850
|
+
* 3. Document title and /DisplayDocTitle
|
|
851
|
+
* 4. Heading hierarchy (sequential, no skips)
|
|
852
|
+
* 5. Alt text on all illustration elements (Figure, Formula, Form)
|
|
853
|
+
* 6. Table header cells (TH) with scope
|
|
854
|
+
* 7. List structure (L/LI/Lbl/LBody)
|
|
855
|
+
* 8. Reading order via structure tree
|
|
856
|
+
* 9. Font embedding (no unembedded standard 14 fonts)
|
|
857
|
+
* 10. Color contrast (AA: 4.5:1, AAA: 7:1)
|
|
858
|
+
* 11. Bookmarks for navigation
|
|
859
|
+
* 12. Tab order (/Tabs /S) on pages
|
|
860
|
+
*
|
|
861
|
+
* @param doc The PDF document to validate.
|
|
862
|
+
* @param level The PDF/UA conformance level (default: `'UA1'`).
|
|
863
|
+
* @returns A {@link PdfUaValidationResult} with errors and warnings.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```ts
|
|
867
|
+
* import { createPdf } from 'modern-pdf-lib';
|
|
868
|
+
* import { validatePdfUa } from 'modern-pdf-lib/accessibility';
|
|
869
|
+
*
|
|
870
|
+
* const doc = createPdf();
|
|
871
|
+
* const result = validatePdfUa(doc);
|
|
872
|
+
* if (!result.valid) {
|
|
873
|
+
* for (const err of result.errors) {
|
|
874
|
+
* console.error(`[${err.code}] ${err.message}`);
|
|
875
|
+
* }
|
|
876
|
+
* }
|
|
877
|
+
* ```
|
|
878
|
+
*/
|
|
879
|
+
declare function validatePdfUa(doc: PdfDocument, level?: PdfUaLevel): PdfUaValidationResult;
|
|
880
|
+
/**
|
|
881
|
+
* Auto-fix PDF/UA issues that can be corrected programmatically.
|
|
882
|
+
*
|
|
883
|
+
* Applies the following corrections when the relevant requirement is
|
|
884
|
+
* not already satisfied:
|
|
885
|
+
* - Sets `/Lang` to `'en'` if the document has no language.
|
|
886
|
+
* - Sets the document title to `'Untitled'` if missing, and enables
|
|
887
|
+
* `/DisplayDocTitle` in viewer preferences.
|
|
888
|
+
* - Adds `/MarkInfo` by creating a structure tree if none exists.
|
|
889
|
+
* - Sets `/Tabs /S` (structure order) on every page.
|
|
890
|
+
*
|
|
891
|
+
* Returns a result listing what was fixed and what remains unfixable
|
|
892
|
+
* (e.g. missing alt text, heading skips — those require manual
|
|
893
|
+
* content changes).
|
|
894
|
+
*
|
|
895
|
+
* @param doc The PDF document to fix in-place.
|
|
896
|
+
* @returns A {@link PdfUaEnforcementResult} describing what was done.
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```ts
|
|
900
|
+
* import { createPdf } from 'modern-pdf-lib';
|
|
901
|
+
* import { enforcePdfUa, validatePdfUa } from 'modern-pdf-lib/accessibility';
|
|
902
|
+
*
|
|
903
|
+
* const doc = createPdf();
|
|
904
|
+
* doc.addPage();
|
|
905
|
+
* const result = enforcePdfUa(doc);
|
|
906
|
+
* console.log('Fixed:', result.fixed);
|
|
907
|
+
* console.log('Unfixable:', result.unfixable.length);
|
|
908
|
+
* ```
|
|
909
|
+
*/
|
|
910
|
+
declare function enforcePdfUa(doc: PdfDocument): PdfUaEnforcementResult;
|
|
911
|
+
//#endregion
|
|
808
912
|
//#region src/crypto/keyDerivation.d.ts
|
|
809
913
|
/**
|
|
810
914
|
* The subset of encryption dictionary values needed by key derivation.
|
|
@@ -1457,7 +1561,6 @@ declare class PdfPopupAnnotation extends PdfAnnotation {
|
|
|
1457
1561
|
* Create a new popup annotation.
|
|
1458
1562
|
*
|
|
1459
1563
|
* @param options.open Whether the popup is initially open. Default: false.
|
|
1460
|
-
* @param options.parent Reference to the parent annotation (set after registration).
|
|
1461
1564
|
*/
|
|
1462
1565
|
static create(options: AnnotationOptions & {
|
|
1463
1566
|
open?: boolean | undefined;
|
|
@@ -1630,29 +1733,6 @@ declare function generateInkAppearance(annot: PdfAnnotation): PdfStream;
|
|
|
1630
1733
|
*/
|
|
1631
1734
|
declare function generateFreeTextAppearance(annot: PdfAnnotation): PdfStream;
|
|
1632
1735
|
//#endregion
|
|
1633
|
-
//#region src/parser/parseError.d.ts
|
|
1634
|
-
/**
|
|
1635
|
-
* @module parser/parseError
|
|
1636
|
-
* Structured error class for PDF parsing failures.
|
|
1637
|
-
* @packageDocumentation
|
|
1638
|
-
*/
|
|
1639
|
-
declare class PdfParseError extends Error {
|
|
1640
|
-
readonly name = "PdfParseError";
|
|
1641
|
-
readonly offset: number;
|
|
1642
|
-
readonly expected: string;
|
|
1643
|
-
readonly actual: string;
|
|
1644
|
-
readonly hexContext: string;
|
|
1645
|
-
constructor(options: {
|
|
1646
|
-
message: string;
|
|
1647
|
-
offset: number;
|
|
1648
|
-
expected?: string | undefined;
|
|
1649
|
-
actual?: string | undefined;
|
|
1650
|
-
data?: Uint8Array | undefined;
|
|
1651
|
-
cause?: Error | undefined;
|
|
1652
|
-
});
|
|
1653
|
-
}
|
|
1654
|
-
declare function formatHexContext(data: Uint8Array, offset: number, windowSize?: number): string;
|
|
1655
|
-
//#endregion
|
|
1656
1736
|
//#region src/signature/byteRange.d.ts
|
|
1657
1737
|
/**
|
|
1658
1738
|
* @module signature/byteRange
|
|
@@ -1726,7 +1806,10 @@ interface PrepareAppearanceOptions {
|
|
|
1726
1806
|
/** Border width. Default: 1. */
|
|
1727
1807
|
borderWidth?: number | undefined;
|
|
1728
1808
|
}
|
|
1729
|
-
declare function prepareForSigning(pdfBytes: Uint8Array, signatureFieldName: string, placeholderSize?: number, appearance?: PrepareAppearanceOptions | undefined
|
|
1809
|
+
declare function prepareForSigning(pdfBytes: Uint8Array, signatureFieldName: string, placeholderSize?: number, appearance?: PrepareAppearanceOptions | undefined, mdpPermission?: number | undefined, fieldLock?: {
|
|
1810
|
+
action: 'All' | 'Include' | 'Exclude';
|
|
1811
|
+
fields?: string[] | undefined;
|
|
1812
|
+
} | undefined): {
|
|
1730
1813
|
preparedPdf: Uint8Array;
|
|
1731
1814
|
byteRange: ByteRangeResult;
|
|
1732
1815
|
};
|
|
@@ -1994,236 +2077,961 @@ declare function parseTimestampResponse(response: Uint8Array): TimestampResult;
|
|
|
1994
2077
|
*/
|
|
1995
2078
|
declare function requestTimestamp(dataHash: Uint8Array, tsaUrl: string, hashAlgorithm?: 'SHA-256' | 'SHA-384' | 'SHA-512'): Promise<TimestampResult>;
|
|
1996
2079
|
//#endregion
|
|
1997
|
-
//#region src/
|
|
2080
|
+
//#region src/signature/incrementalSave.d.ts
|
|
1998
2081
|
/**
|
|
1999
|
-
* @module
|
|
2000
|
-
*
|
|
2001
|
-
* Linearization support for PDF documents.
|
|
2082
|
+
* @module signature/incrementalSave
|
|
2002
2083
|
*
|
|
2003
|
-
*
|
|
2004
|
-
* before the entire file is downloaded. This is sometimes called
|
|
2005
|
-
* "fast web view" or "optimized for the web".
|
|
2084
|
+
* Incremental save with signature preservation.
|
|
2006
2085
|
*
|
|
2007
|
-
*
|
|
2086
|
+
* Provides the ability to perform append-only incremental updates
|
|
2087
|
+
* to a PDF while preserving all existing digital signatures.
|
|
2088
|
+
* This is essential for multi-signature workflows where each signer
|
|
2089
|
+
* adds their signature without invalidating previous signatures.
|
|
2008
2090
|
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
* 5. Remaining pages' objects
|
|
2014
|
-
* 6. Hint stream(s)
|
|
2015
|
-
* 7. Main (overflow) cross-reference table and trailer
|
|
2016
|
-
* 8. %%EOF
|
|
2091
|
+
* Key guarantees:
|
|
2092
|
+
* - Original bytes are never modified (pure append)
|
|
2093
|
+
* - All existing signature byte ranges remain intact
|
|
2094
|
+
* - Each update appends objects + xref + trailer with /Prev pointer
|
|
2017
2095
|
*
|
|
2018
|
-
*
|
|
2019
|
-
*
|
|
2020
|
-
* - Detection of linearized PDFs (`isLinearized`)
|
|
2021
|
-
* - A basic linearization pass (`linearizePdf`) that reorganizes objects
|
|
2022
|
-
* so the first page's objects come first, with a linearization
|
|
2023
|
-
* parameter dict and page-offset hint table.
|
|
2096
|
+
* Reference: PDF 1.7 spec, SS7.5.6 (Incremental Updates),
|
|
2097
|
+
* SS12.8 (Digital Signatures).
|
|
2024
2098
|
*
|
|
2025
|
-
*
|
|
2099
|
+
* @packageDocumentation
|
|
2026
2100
|
*/
|
|
2027
|
-
/**
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2101
|
+
/**
|
|
2102
|
+
* Byte range for an existing signature.
|
|
2103
|
+
*/
|
|
2104
|
+
interface SignatureByteRange {
|
|
2105
|
+
/** The four-element byte range array [offset1, length1, offset2, length2]. */
|
|
2106
|
+
byteRange: [number, number, number, number];
|
|
2107
|
+
/** Offset of the /Contents hex string placeholder. */
|
|
2108
|
+
contentsOffset: number;
|
|
2109
|
+
/** Length of the /Contents hex string (including angle brackets). */
|
|
2110
|
+
contentsLength: number;
|
|
2031
2111
|
}
|
|
2032
2112
|
/**
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2035
|
-
* A linearized PDF has a linearization parameter dictionary as the
|
|
2036
|
-
* very first indirect object after the header. This dictionary
|
|
2037
|
-
* contains `/Linearized` as a key.
|
|
2038
|
-
*
|
|
2039
|
-
* @param pdfBytes The raw PDF bytes.
|
|
2040
|
-
* @returns `true` if the PDF appears to be linearized.
|
|
2113
|
+
* Options for incremental save with signature preservation.
|
|
2041
2114
|
*/
|
|
2042
|
-
|
|
2115
|
+
interface IncrementalSaveOptions {
|
|
2116
|
+
/** Apply FlateDecode compression to new stream objects. Default: true. */
|
|
2117
|
+
compress?: boolean | undefined;
|
|
2118
|
+
/** Preserve existing signatures by verifying byte ranges. Default: true. */
|
|
2119
|
+
preserveSignatures?: boolean | undefined;
|
|
2120
|
+
}
|
|
2043
2121
|
/**
|
|
2044
|
-
*
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
*
|
|
2052
|
-
|
|
2053
|
-
|
|
2122
|
+
* Options for pure append-only incremental updates.
|
|
2123
|
+
*/
|
|
2124
|
+
interface AppendOptions {
|
|
2125
|
+
/** Apply FlateDecode compression. Default: false. */
|
|
2126
|
+
compress?: boolean | undefined;
|
|
2127
|
+
}
|
|
2128
|
+
/**
|
|
2129
|
+
* An object to be appended in an incremental update.
|
|
2130
|
+
*/
|
|
2131
|
+
interface IncrementalObject {
|
|
2132
|
+
/** The PDF object number. */
|
|
2133
|
+
objectNumber: number;
|
|
2134
|
+
/** The generation number (usually 0). */
|
|
2135
|
+
generationNumber: number;
|
|
2136
|
+
/** The serialized object data (everything between `N G obj\n` and `\nendobj`). */
|
|
2137
|
+
data: Uint8Array;
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Information extracted from an existing PDF trailer.
|
|
2141
|
+
*/
|
|
2142
|
+
interface TrailerInfo {
|
|
2143
|
+
/** The /Size value (total number of objects). */
|
|
2144
|
+
size: number;
|
|
2145
|
+
/** The /Root reference string (e.g., "1 0 R"). */
|
|
2146
|
+
rootRef: string;
|
|
2147
|
+
/** The /Info reference string (e.g., "4 0 R"), if present. */
|
|
2148
|
+
infoRef?: string | undefined;
|
|
2149
|
+
/** The byte offset of the previous cross-reference section. */
|
|
2150
|
+
prevXrefOffset: number;
|
|
2151
|
+
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Scan a PDF for all /Type /Sig dictionaries and extract their byte ranges.
|
|
2054
2154
|
*
|
|
2055
|
-
* @param
|
|
2056
|
-
* @
|
|
2057
|
-
* @returns The linearized PDF bytes.
|
|
2155
|
+
* @param pdf The PDF bytes to scan.
|
|
2156
|
+
* @returns Array of signature byte range descriptors.
|
|
2058
2157
|
*/
|
|
2059
|
-
declare function
|
|
2060
|
-
//#endregion
|
|
2061
|
-
//#region src/compliance/pdfA.d.ts
|
|
2158
|
+
declare function findExistingSignatures(pdf: Uint8Array): SignatureByteRange[];
|
|
2062
2159
|
/**
|
|
2063
|
-
*
|
|
2160
|
+
* Verify that no existing signature's covered bytes would overlap
|
|
2161
|
+
* with content appended after the current end of file.
|
|
2064
2162
|
*
|
|
2065
|
-
*
|
|
2163
|
+
* For a valid incremental update, all existing signature byte ranges
|
|
2164
|
+
* must reference bytes within the original file. Any overlap with
|
|
2165
|
+
* new content appended after the last %%EOF would break signatures.
|
|
2066
2166
|
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2069
|
-
*
|
|
2167
|
+
* @param pdf The current PDF bytes.
|
|
2168
|
+
* @param signatures The signature byte ranges to validate.
|
|
2169
|
+
* @returns `true` if all byte ranges are valid and non-overlapping with appended content.
|
|
2170
|
+
*/
|
|
2171
|
+
declare function validateByteRangeIntegrity(pdf: Uint8Array, signatures: SignatureByteRange[]): boolean;
|
|
2172
|
+
/**
|
|
2173
|
+
* Parse the existing trailer from a PDF to extract /Size, /Root, /Info,
|
|
2174
|
+
* and the previous xref offset.
|
|
2070
2175
|
*
|
|
2071
|
-
*
|
|
2072
|
-
*
|
|
2073
|
-
* - **1a**: PDF/A-1a — adds logical structure and tagged PDF
|
|
2074
|
-
* - **2b**: PDF/A-2b (based on PDF 1.7) — allows JPEG2000, transparency
|
|
2075
|
-
* - **2a**: PDF/A-2a — adds logical structure
|
|
2076
|
-
* - **2u**: PDF/A-2u — adds Unicode mapping
|
|
2077
|
-
* - **3b**: PDF/A-3b — allows embedded files of any type
|
|
2078
|
-
* - **3a**: PDF/A-3a — adds logical structure
|
|
2079
|
-
* - **3u**: PDF/A-3u — adds Unicode mapping
|
|
2176
|
+
* Scans backward from the end of the file for `startxref` and the
|
|
2177
|
+
* trailer dictionary.
|
|
2080
2178
|
*
|
|
2081
|
-
*
|
|
2179
|
+
* @param pdf The PDF bytes.
|
|
2180
|
+
* @returns Parsed trailer information.
|
|
2082
2181
|
*/
|
|
2083
|
-
|
|
2084
|
-
type PdfALevel = '1b' | '2b' | '3b' | '1a' | '2a' | '3a' | '2u' | '3u';
|
|
2085
|
-
/** Result of a PDF/A validation check. */
|
|
2086
|
-
interface PdfAValidationResult {
|
|
2087
|
-
valid: boolean;
|
|
2088
|
-
level: PdfALevel;
|
|
2089
|
-
issues: PdfAIssue[];
|
|
2090
|
-
}
|
|
2091
|
-
/** A single PDF/A compliance issue. */
|
|
2092
|
-
interface PdfAIssue {
|
|
2093
|
-
code: string;
|
|
2094
|
-
message: string;
|
|
2095
|
-
severity: 'error' | 'warning';
|
|
2096
|
-
}
|
|
2182
|
+
declare function parseExistingTrailer(pdf: Uint8Array): TrailerInfo;
|
|
2097
2183
|
/**
|
|
2098
|
-
*
|
|
2184
|
+
* Perform an incremental save that preserves ALL existing signatures.
|
|
2099
2185
|
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2186
|
+
* Takes the original PDF bytes and a modified version, detects which
|
|
2187
|
+
* objects changed by comparing object hashes, and appends only the
|
|
2188
|
+
* changed/new objects after the original %%EOF. This ensures all
|
|
2189
|
+
* existing signature byte ranges remain intact.
|
|
2103
2190
|
*
|
|
2104
|
-
* @param
|
|
2105
|
-
* @param
|
|
2106
|
-
* @
|
|
2191
|
+
* @param originalPdf The original (possibly signed) PDF bytes.
|
|
2192
|
+
* @param modifiedPdf The modified PDF bytes with changes.
|
|
2193
|
+
* @param options Options for the incremental save.
|
|
2194
|
+
* @returns The incrementally saved PDF bytes.
|
|
2107
2195
|
*/
|
|
2108
|
-
declare function
|
|
2196
|
+
declare function saveIncrementalWithSignaturePreservation(originalPdf: Uint8Array, modifiedPdf: Uint8Array, options?: IncrementalSaveOptions): Uint8Array;
|
|
2109
2197
|
/**
|
|
2110
|
-
*
|
|
2198
|
+
* Append a pure incremental update to a PDF.
|
|
2111
2199
|
*
|
|
2112
|
-
* This
|
|
2113
|
-
*
|
|
2114
|
-
*
|
|
2115
|
-
* - Document language (if missing, defaults to "en")
|
|
2116
|
-
*
|
|
2117
|
-
* **Limitations:**
|
|
2118
|
-
* - Cannot embed fonts that are not already embedded
|
|
2119
|
-
* - Cannot remove encryption or JavaScript (throws an error)
|
|
2120
|
-
* - Cannot add structure tree for 'a' conformance
|
|
2121
|
-
* - For full PDF/A conversion, use a dedicated tool
|
|
2200
|
+
* This function NEVER modifies bytes before the last %%EOF.
|
|
2201
|
+
* It appends new/modified objects, a new xref subsection, and a
|
|
2202
|
+
* new trailer with a /Prev pointer to the previous xref.
|
|
2122
2203
|
*
|
|
2123
|
-
* @param
|
|
2124
|
-
* @param
|
|
2125
|
-
* @
|
|
2204
|
+
* @param originalPdf The original PDF bytes.
|
|
2205
|
+
* @param newObjects Objects to append (new or modified).
|
|
2206
|
+
* @param options Options for the append operation.
|
|
2207
|
+
* @returns The updated PDF bytes.
|
|
2126
2208
|
*/
|
|
2127
|
-
declare function
|
|
2209
|
+
declare function appendIncrementalUpdate(originalPdf: Uint8Array, newObjects: IncrementalObject[], options?: AppendOptions): Uint8Array;
|
|
2128
2210
|
//#endregion
|
|
2129
|
-
//#region src/
|
|
2211
|
+
//#region src/signature/multiSignatureValidator.d.ts
|
|
2130
2212
|
/**
|
|
2131
|
-
*
|
|
2213
|
+
* @module signature/multiSignatureValidator
|
|
2132
2214
|
*
|
|
2133
|
-
*
|
|
2134
|
-
* - ExtGState with /CA (stroke opacity) < 1.0
|
|
2135
|
-
* - ExtGState with /ca (fill opacity) < 1.0
|
|
2136
|
-
* - /SMask references (soft masks)
|
|
2137
|
-
* - /BM (blend mode) other than /Normal
|
|
2215
|
+
* Multi-signature chain validation for PDFs with multiple signatures.
|
|
2138
2216
|
*
|
|
2139
|
-
*
|
|
2140
|
-
*
|
|
2217
|
+
* In a multi-signature workflow, each subsequent signer adds their
|
|
2218
|
+
* signature via an incremental update. This module validates that:
|
|
2219
|
+
*
|
|
2220
|
+
* 1. Each signature covers the correct byte range
|
|
2221
|
+
* 2. Each subsequent signature covers all content including previous signatures
|
|
2222
|
+
* 3. No signature's covered bytes have been tampered with
|
|
2223
|
+
* 4. The chain is ordered correctly (chronological signing order)
|
|
2224
|
+
*
|
|
2225
|
+
* Reference: PDF 1.7 spec, SS12.8.1 (Signature Filtering).
|
|
2226
|
+
*
|
|
2227
|
+
* @packageDocumentation
|
|
2141
2228
|
*/
|
|
2142
|
-
/**
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
/**
|
|
2147
|
-
|
|
2148
|
-
/**
|
|
2149
|
-
|
|
2150
|
-
/**
|
|
2151
|
-
|
|
2152
|
-
/**
|
|
2153
|
-
|
|
2154
|
-
/**
|
|
2155
|
-
|
|
2229
|
+
/**
|
|
2230
|
+
* Validation status for a single signature in the chain.
|
|
2231
|
+
*/
|
|
2232
|
+
interface SignatureChainEntry {
|
|
2233
|
+
/** The signature field name (extracted from /T). */
|
|
2234
|
+
fieldName: string;
|
|
2235
|
+
/** The signer name (extracted from /Contents PKCS#7 or dictionary). */
|
|
2236
|
+
signerName: string;
|
|
2237
|
+
/** The signing date (extracted from /M), if present. */
|
|
2238
|
+
signedAt?: Date | undefined;
|
|
2239
|
+
/** The byte range covering this signature. */
|
|
2240
|
+
byteRange: [number, number, number, number];
|
|
2241
|
+
/** Whether this signature covers the entire document up to its point. */
|
|
2242
|
+
coversEntireDocument: boolean;
|
|
2243
|
+
/** Validation status for this entry in the chain. */
|
|
2244
|
+
status: 'valid' | 'invalid' | 'broken_chain';
|
|
2156
2245
|
}
|
|
2157
|
-
/**
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2246
|
+
/**
|
|
2247
|
+
* Result of validating the entire signature chain.
|
|
2248
|
+
*/
|
|
2249
|
+
interface SignatureChainResult {
|
|
2250
|
+
/** Ordered array of signature chain entries. */
|
|
2251
|
+
signatures: SignatureChainEntry[];
|
|
2252
|
+
/** Whether the entire chain is valid (all entries valid, no breaks). */
|
|
2253
|
+
isChainValid: boolean;
|
|
2254
|
+
/** Descriptive error messages, if any. */
|
|
2255
|
+
errors: string[];
|
|
2162
2256
|
}
|
|
2163
2257
|
/**
|
|
2164
|
-
*
|
|
2258
|
+
* Validate the entire signature chain in a PDF.
|
|
2165
2259
|
*
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
* - `/SMask <ref>` where ref is not `/None`
|
|
2170
|
-
* - `/BM /<mode>` where mode is not `Normal`
|
|
2260
|
+
* Finds all signatures, validates each one covers the correct byte range,
|
|
2261
|
+
* and verifies each subsequent signature covers all content including
|
|
2262
|
+
* previous signatures. Returns an ordered chain with status for each entry.
|
|
2171
2263
|
*
|
|
2172
|
-
* @param
|
|
2173
|
-
* @returns
|
|
2264
|
+
* @param pdf The PDF bytes to validate.
|
|
2265
|
+
* @returns The signature chain validation result.
|
|
2174
2266
|
*/
|
|
2175
|
-
declare function
|
|
2267
|
+
declare function validateSignatureChain(pdf: Uint8Array): Promise<SignatureChainResult>;
|
|
2268
|
+
//#endregion
|
|
2269
|
+
//#region src/signature/mdpPolicy.d.ts
|
|
2176
2270
|
/**
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2179
|
-
* This replaces:
|
|
2180
|
-
* - `/CA <value>` with `/CA 1` (where value < 1)
|
|
2181
|
-
* - `/ca <value>` with `/ca 1` (where value < 1)
|
|
2182
|
-
* - `/SMask <ref>` with `/SMask /None`
|
|
2183
|
-
* - `/BM /<mode>` with `/BM /Normal`
|
|
2184
|
-
*
|
|
2185
|
-
* **Note:** This is a "lossy" operation — semi-transparent elements
|
|
2186
|
-
* will become fully opaque. For print-quality output, manual review
|
|
2187
|
-
* is recommended.
|
|
2271
|
+
* MDP permission levels for certification signatures.
|
|
2188
2272
|
*
|
|
2189
|
-
*
|
|
2190
|
-
*
|
|
2273
|
+
* These correspond to the /P value in the /TransformParams dictionary
|
|
2274
|
+
* of a /DocMDP transform method.
|
|
2191
2275
|
*/
|
|
2192
|
-
declare
|
|
2193
|
-
|
|
2194
|
-
|
|
2276
|
+
declare enum MdpPermission {
|
|
2277
|
+
/** No changes to the document are permitted. */
|
|
2278
|
+
NoChanges = 1,
|
|
2279
|
+
/** Only form filling and signing are permitted. */
|
|
2280
|
+
FormFillAndSign = 2,
|
|
2281
|
+
/** Form filling, signing, and annotation changes are permitted. */
|
|
2282
|
+
FormFillSignAnnotate = 3
|
|
2283
|
+
}
|
|
2195
2284
|
/**
|
|
2196
|
-
*
|
|
2285
|
+
* Set the certification level (MDP permission) on sign options.
|
|
2197
2286
|
*
|
|
2198
|
-
*
|
|
2287
|
+
* When applied, the resulting signature will include a /DocMDP
|
|
2288
|
+
* transform method in its /TransformParams, which certifies the
|
|
2289
|
+
* document and restricts future modifications to the specified level.
|
|
2199
2290
|
*
|
|
2200
|
-
* This
|
|
2201
|
-
*
|
|
2202
|
-
* the sRGB tone response curve (gamma ~ 2.2).
|
|
2291
|
+
* This should only be used for the FIRST (certification) signature
|
|
2292
|
+
* in a document. Subsequent approval signatures should not set MDP.
|
|
2203
2293
|
*
|
|
2204
|
-
* The
|
|
2205
|
-
*
|
|
2206
|
-
* colorants (red, green, blue), and the tone response curve
|
|
2207
|
-
* (TRC) for each channel.
|
|
2294
|
+
* @param options The sign options to modify (mutated in place).
|
|
2295
|
+
* @param level The MDP permission level to set.
|
|
2208
2296
|
*
|
|
2209
|
-
*
|
|
2297
|
+
* @example
|
|
2298
|
+
* ```ts
|
|
2299
|
+
* const options: SignOptions = {
|
|
2300
|
+
* certificate: certDer,
|
|
2301
|
+
* privateKey: keyDer,
|
|
2302
|
+
* };
|
|
2303
|
+
* setCertificationLevel(options, MdpPermission.FormFillAndSign);
|
|
2304
|
+
* const signedPdf = await signPdf(pdfBytes, 'CertSig', options);
|
|
2305
|
+
* ```
|
|
2210
2306
|
*/
|
|
2307
|
+
declare function setCertificationLevel(options: SignOptions, level: MdpPermission): void;
|
|
2211
2308
|
/**
|
|
2212
|
-
*
|
|
2213
|
-
*
|
|
2214
|
-
* The resulting profile is a valid ICC v2.1.0 profile containing the
|
|
2215
|
-
* minimum set of tags required for a Display profile with 'RGB ' color
|
|
2216
|
-
* space and 'XYZ ' PCS:
|
|
2309
|
+
* Read the certification level (MDP permission) from a PDF.
|
|
2217
2310
|
*
|
|
2218
|
-
*
|
|
2219
|
-
*
|
|
2220
|
-
*
|
|
2221
|
-
* - `rXYZ`, `gXYZ`, `bXYZ` — red/green/blue colorant XYZ values
|
|
2222
|
-
* - `rTRC`, `gTRC`, `bTRC` — red/green/blue tone response curves (gamma 2.2)
|
|
2311
|
+
* Scans the PDF for the first /DocMDP transform method and extracts
|
|
2312
|
+
* the /P value from its /TransformParams. Returns `undefined` if no
|
|
2313
|
+
* certification signature is found.
|
|
2223
2314
|
*
|
|
2224
|
-
* @
|
|
2315
|
+
* @param pdf The PDF bytes to scan.
|
|
2316
|
+
* @returns The MDP permission level, or `undefined` if not certified.
|
|
2225
2317
|
*/
|
|
2226
|
-
declare function
|
|
2318
|
+
declare function getCertificationLevel(pdf: Uint8Array): MdpPermission | undefined;
|
|
2319
|
+
/**
|
|
2320
|
+
* Build a /DocMDP reference dictionary string for inclusion in
|
|
2321
|
+
* the signature dictionary.
|
|
2322
|
+
*
|
|
2323
|
+
* @param sigValueObjNum The object number of the signature value.
|
|
2324
|
+
* @param level The MDP permission level.
|
|
2325
|
+
* @returns The /Reference array string to include in the sig dict.
|
|
2326
|
+
*
|
|
2327
|
+
* @internal
|
|
2328
|
+
*/
|
|
2329
|
+
declare function buildDocMdpReference(sigValueObjNum: number, level: MdpPermission): string;
|
|
2330
|
+
//#endregion
|
|
2331
|
+
//#region src/signature/modificationDetector.d.ts
|
|
2332
|
+
/**
|
|
2333
|
+
* Types of modifications that can be detected.
|
|
2334
|
+
*/
|
|
2335
|
+
type ModificationViolationType = 'content_changed' | 'annotation_added' | 'form_filled' | 'page_added';
|
|
2336
|
+
/**
|
|
2337
|
+
* A single modification violation detected in the document.
|
|
2338
|
+
*/
|
|
2339
|
+
interface ModificationViolation {
|
|
2340
|
+
/** The type of modification detected. */
|
|
2341
|
+
type: ModificationViolationType;
|
|
2342
|
+
/** Human-readable description of the violation. */
|
|
2343
|
+
description: string;
|
|
2344
|
+
/** Index of the signature whose coverage was violated. */
|
|
2345
|
+
affectedSignatureIndex: number;
|
|
2346
|
+
}
|
|
2347
|
+
/**
|
|
2348
|
+
* Report of modifications detected in a certified document.
|
|
2349
|
+
*/
|
|
2350
|
+
interface ModificationReport {
|
|
2351
|
+
/** The certification level, if any. */
|
|
2352
|
+
certificationLevel?: MdpPermission | undefined;
|
|
2353
|
+
/** Whether the modifications comply with the certification level. */
|
|
2354
|
+
isCompliant: boolean;
|
|
2355
|
+
/** List of detected violations. */
|
|
2356
|
+
violations: ModificationViolation[];
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Detect modifications in a certified PDF document.
|
|
2360
|
+
*
|
|
2361
|
+
* Compares content at each signature's byte range against the current
|
|
2362
|
+
* PDF state. If an MDP (DocMDP) certification level is set, checks
|
|
2363
|
+
* whether the modifications comply with the permitted level.
|
|
2364
|
+
*
|
|
2365
|
+
* Modification levels:
|
|
2366
|
+
* - MDP 1 (NoChanges): Any change is a violation
|
|
2367
|
+
* - MDP 2 (FormFillAndSign): Only form fills and new signatures allowed
|
|
2368
|
+
* - MDP 3 (FormFillSignAnnotate): Form fills, signatures, and annotations allowed
|
|
2369
|
+
*
|
|
2370
|
+
* @param pdf The PDF bytes to analyze.
|
|
2371
|
+
* @returns A detailed modification report.
|
|
2372
|
+
*/
|
|
2373
|
+
declare function detectModifications(pdf: Uint8Array): Promise<ModificationReport>;
|
|
2374
|
+
//#endregion
|
|
2375
|
+
//#region src/signature/fieldLock.d.ts
|
|
2376
|
+
/**
|
|
2377
|
+
* Options for locking fields when a signature is applied.
|
|
2378
|
+
*/
|
|
2379
|
+
interface FieldLockOptions {
|
|
2380
|
+
/** Lock action: 'All', 'Include', or 'Exclude'. */
|
|
2381
|
+
action: 'All' | 'Include' | 'Exclude';
|
|
2382
|
+
/** Field names to include or exclude (required for 'Include' and 'Exclude'). */
|
|
2383
|
+
fields?: string[] | undefined;
|
|
2384
|
+
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Information about a field lock on a signature field.
|
|
2387
|
+
*/
|
|
2388
|
+
interface FieldLockInfo {
|
|
2389
|
+
/** The name of the signature field that has the lock. */
|
|
2390
|
+
signatureFieldName: string;
|
|
2391
|
+
/** The lock action: 'All', 'Include', or 'Exclude'. */
|
|
2392
|
+
action: 'All' | 'Include' | 'Exclude';
|
|
2393
|
+
/** The list of locked fields (empty for 'All' action). */
|
|
2394
|
+
lockedFields: string[];
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* Add a field lock dictionary to sign options.
|
|
2398
|
+
*
|
|
2399
|
+
* When applied, the resulting signature field will include a /Lock
|
|
2400
|
+
* dictionary that specifies which form fields should be locked after
|
|
2401
|
+
* this signature is applied.
|
|
2402
|
+
*
|
|
2403
|
+
* @param options The sign options to modify (mutated in place).
|
|
2404
|
+
* @param lock The field lock configuration.
|
|
2405
|
+
*
|
|
2406
|
+
* @example
|
|
2407
|
+
* ```ts
|
|
2408
|
+
* const options: SignOptions = {
|
|
2409
|
+
* certificate: certDer,
|
|
2410
|
+
* privateKey: keyDer,
|
|
2411
|
+
* };
|
|
2412
|
+
* addFieldLock(options, {
|
|
2413
|
+
* action: 'Include',
|
|
2414
|
+
* fields: ['Name', 'Address', 'Amount'],
|
|
2415
|
+
* });
|
|
2416
|
+
* const signedPdf = await signPdf(pdfBytes, 'ApprovalSig', options);
|
|
2417
|
+
* ```
|
|
2418
|
+
*/
|
|
2419
|
+
declare function addFieldLock(options: SignOptions, lock: FieldLockOptions): void;
|
|
2420
|
+
/**
|
|
2421
|
+
* Read all field lock dictionaries from signature fields in a PDF.
|
|
2422
|
+
*
|
|
2423
|
+
* Scans the PDF for signature field dictionaries that contain a /Lock
|
|
2424
|
+
* entry and extracts the lock action and field names.
|
|
2425
|
+
*
|
|
2426
|
+
* @param pdf The PDF bytes to scan.
|
|
2427
|
+
* @returns Array of field lock information objects.
|
|
2428
|
+
*/
|
|
2429
|
+
declare function getFieldLocks(pdf: Uint8Array): FieldLockInfo[];
|
|
2430
|
+
/**
|
|
2431
|
+
* Build a /Lock dictionary string for inclusion in a signature field.
|
|
2432
|
+
*
|
|
2433
|
+
* @param lock The field lock options.
|
|
2434
|
+
* @returns The /Lock dictionary string.
|
|
2435
|
+
*
|
|
2436
|
+
* @internal
|
|
2437
|
+
*/
|
|
2438
|
+
declare function buildFieldLockDict(lock: FieldLockOptions): string;
|
|
2439
|
+
//#endregion
|
|
2440
|
+
//#region src/signature/documentDiff.d.ts
|
|
2441
|
+
/**
|
|
2442
|
+
* @module signature/documentDiff
|
|
2443
|
+
*
|
|
2444
|
+
* Document modification detection — compares the signed version of a PDF
|
|
2445
|
+
* against the current version to identify what changed after signing.
|
|
2446
|
+
*
|
|
2447
|
+
* Uses the ByteRange to extract the signed content (the bytes that were
|
|
2448
|
+
* hashed when the signature was created), parses both versions, and
|
|
2449
|
+
* compares page counts, page content hashes, form field values,
|
|
2450
|
+
* annotation counts, and metadata.
|
|
2451
|
+
*
|
|
2452
|
+
* @packageDocumentation
|
|
2453
|
+
*/
|
|
2454
|
+
/**
|
|
2455
|
+
* A single difference found between signed and current content.
|
|
2456
|
+
*/
|
|
2457
|
+
interface DiffEntry {
|
|
2458
|
+
/** The category of change detected. */
|
|
2459
|
+
type: 'page_added' | 'page_removed' | 'page_modified' | 'form_field_changed' | 'annotation_changed' | 'metadata_changed';
|
|
2460
|
+
/** Zero-based page index (for page-related changes). */
|
|
2461
|
+
pageIndex?: number | undefined;
|
|
2462
|
+
/** Form field name (for form field changes). */
|
|
2463
|
+
fieldName?: string | undefined;
|
|
2464
|
+
/** Human-readable description of the change. */
|
|
2465
|
+
description: string;
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* Result of comparing signed content against the current PDF.
|
|
2469
|
+
*/
|
|
2470
|
+
interface DocumentDiff {
|
|
2471
|
+
/** Which signature was used as the baseline (zero-based). */
|
|
2472
|
+
signatureIndex: number;
|
|
2473
|
+
/** The signing date from the signature dictionary, if available. */
|
|
2474
|
+
signedAt?: Date | undefined;
|
|
2475
|
+
/** All detected changes between the signed and current version. */
|
|
2476
|
+
changes: DiffEntry[];
|
|
2477
|
+
/** Whether any changes were detected at all. */
|
|
2478
|
+
hasChanges: boolean;
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
* Diff the signed content of a PDF against its current state.
|
|
2482
|
+
*
|
|
2483
|
+
* Extracts the signed bytes using the ByteRange of a specific signature
|
|
2484
|
+
* (or the latest signature by default), parses both versions, and
|
|
2485
|
+
* compares page count, page content hashes, form field values,
|
|
2486
|
+
* annotation counts, and metadata.
|
|
2487
|
+
*
|
|
2488
|
+
* @param pdf The current PDF bytes.
|
|
2489
|
+
* @param signatureIndex Zero-based index of the signature to diff against.
|
|
2490
|
+
* If not provided, uses the last (most recent) signature.
|
|
2491
|
+
* @returns A DocumentDiff describing all detected changes.
|
|
2492
|
+
*
|
|
2493
|
+
* @example
|
|
2494
|
+
* ```ts
|
|
2495
|
+
* import { diffSignedContent } from 'modern-pdf-lib/signature';
|
|
2496
|
+
*
|
|
2497
|
+
* const diff = await diffSignedContent(pdfBytes);
|
|
2498
|
+
* if (diff.hasChanges) {
|
|
2499
|
+
* for (const entry of diff.changes) {
|
|
2500
|
+
* console.log(`${entry.type}: ${entry.description}`);
|
|
2501
|
+
* }
|
|
2502
|
+
* }
|
|
2503
|
+
* ```
|
|
2504
|
+
*/
|
|
2505
|
+
declare function diffSignedContent(pdf: Uint8Array, signatureIndex?: number | undefined): Promise<DocumentDiff>;
|
|
2506
|
+
//#endregion
|
|
2507
|
+
//#region src/signature/counterSignature.d.ts
|
|
2508
|
+
/**
|
|
2509
|
+
* @module signature/counterSignature
|
|
2510
|
+
*
|
|
2511
|
+
* Counter-signature support — allows signing an existing signature to
|
|
2512
|
+
* attest that a specific signature existed at a certain time (e.g.,
|
|
2513
|
+
* notarization or witness signing).
|
|
2514
|
+
*
|
|
2515
|
+
* A counter-signature is a PKCS#7 unsigned attribute (OID 1.2.840.113549.1.9.6)
|
|
2516
|
+
* that contains a SignerInfo whose signature is computed over the existing
|
|
2517
|
+
* signature value. It is appended via incremental update.
|
|
2518
|
+
*
|
|
2519
|
+
* References:
|
|
2520
|
+
* - RFC 5652 SS 11.4 (Countersignature)
|
|
2521
|
+
* - PDF 2.0 spec SS 12.8 (Digital Signatures)
|
|
2522
|
+
*
|
|
2523
|
+
* @packageDocumentation
|
|
2524
|
+
*/
|
|
2525
|
+
/**
|
|
2526
|
+
* Information about a counter-signature found on a PDF signature.
|
|
2527
|
+
*/
|
|
2528
|
+
interface CounterSignatureInfo {
|
|
2529
|
+
/** The index of the primary signature that was counter-signed. */
|
|
2530
|
+
targetSignatureIndex: number;
|
|
2531
|
+
/** The Common Name of the counter-signer. */
|
|
2532
|
+
signerName: string;
|
|
2533
|
+
/** When the counter-signature was applied. */
|
|
2534
|
+
signedAt?: Date | undefined;
|
|
2535
|
+
/** Whether the counter-signature is structurally valid. */
|
|
2536
|
+
isValid: boolean;
|
|
2537
|
+
}
|
|
2538
|
+
/**
|
|
2539
|
+
* Add a counter-signature to an existing PDF signature.
|
|
2540
|
+
*
|
|
2541
|
+
* Finds the target signature's /Contents, computes a hash of the
|
|
2542
|
+
* existing signature value, creates a PKCS#7 counter-signature
|
|
2543
|
+
* attribute, and appends the result via incremental update.
|
|
2544
|
+
*
|
|
2545
|
+
* @param pdf The PDF bytes containing the target signature.
|
|
2546
|
+
* @param targetSignatureIndex Zero-based index of the signature to counter-sign.
|
|
2547
|
+
* @param signerInfo The counter-signer's certificate, private key, and hash algorithm.
|
|
2548
|
+
* @returns The PDF with the counter-signature appended.
|
|
2549
|
+
*
|
|
2550
|
+
* @example
|
|
2551
|
+
* ```ts
|
|
2552
|
+
* const counterSigned = await addCounterSignature(
|
|
2553
|
+
* signedPdf,
|
|
2554
|
+
* 0,
|
|
2555
|
+
* { certificate: certDer, privateKey: keyDer },
|
|
2556
|
+
* );
|
|
2557
|
+
* ```
|
|
2558
|
+
*/
|
|
2559
|
+
declare function addCounterSignature(pdf: Uint8Array, targetSignatureIndex: number, signerInfo: {
|
|
2560
|
+
certificate: Uint8Array;
|
|
2561
|
+
privateKey: Uint8Array;
|
|
2562
|
+
hashAlgorithm?: string | undefined;
|
|
2563
|
+
}): Promise<Uint8Array>;
|
|
2564
|
+
/**
|
|
2565
|
+
* Extract counter-signatures from all signatures in a PDF.
|
|
2566
|
+
*
|
|
2567
|
+
* Scans each signature's PKCS#7 structure for the counter-signature
|
|
2568
|
+
* unsigned attribute (OID 1.2.840.113549.1.9.6).
|
|
2569
|
+
*
|
|
2570
|
+
* @param pdf The PDF bytes.
|
|
2571
|
+
* @returns Array of counter-signature info objects.
|
|
2572
|
+
*
|
|
2573
|
+
* @example
|
|
2574
|
+
* ```ts
|
|
2575
|
+
* const counterSigs = getCounterSignatures(pdfBytes);
|
|
2576
|
+
* for (const cs of counterSigs) {
|
|
2577
|
+
* console.log(`Signature ${cs.targetSignatureIndex} counter-signed by ${cs.signerName}`);
|
|
2578
|
+
* }
|
|
2579
|
+
* ```
|
|
2580
|
+
*/
|
|
2581
|
+
declare function getCounterSignatures(pdf: Uint8Array): CounterSignatureInfo[];
|
|
2582
|
+
//#endregion
|
|
2583
|
+
//#region src/signature/ltvEmbed.d.ts
|
|
2584
|
+
/**
|
|
2585
|
+
* @module signature/ltvEmbed
|
|
2586
|
+
*
|
|
2587
|
+
* LTV (Long-Term Validation) embedding for PDF digital signatures.
|
|
2588
|
+
*
|
|
2589
|
+
* Adds a Document Security Store (/DSS) dictionary to the PDF catalog
|
|
2590
|
+
* containing the validation data (certificates, CRLs, OCSP responses)
|
|
2591
|
+
* required to verify signatures decades after signing.
|
|
2592
|
+
*
|
|
2593
|
+
* The DSS is appended via incremental update to preserve existing
|
|
2594
|
+
* signatures (per ISO 32000-2 SS 12.8.4.3).
|
|
2595
|
+
*
|
|
2596
|
+
* References:
|
|
2597
|
+
* - ISO 32000-2:2020 SS 12.8.4.3 (Document Security Store)
|
|
2598
|
+
* - ETSI TS 102 778-4 (PAdES Long Term Validation)
|
|
2599
|
+
* - RFC 6960 (OCSP)
|
|
2600
|
+
* - RFC 5280 (CRL)
|
|
2601
|
+
*
|
|
2602
|
+
* @packageDocumentation
|
|
2603
|
+
*/
|
|
2604
|
+
/**
|
|
2605
|
+
* Options for LTV data embedding.
|
|
2606
|
+
*/
|
|
2607
|
+
interface LtvOptions {
|
|
2608
|
+
/** Include OCSP responses in the DSS. Default: true. */
|
|
2609
|
+
includeOcsp?: boolean | undefined;
|
|
2610
|
+
/** Include CRL data in the DSS. Default: true. */
|
|
2611
|
+
includeCrl?: boolean | undefined;
|
|
2612
|
+
/** Include certificate chains in the DSS. Default: true. */
|
|
2613
|
+
includeCerts?: boolean | undefined;
|
|
2614
|
+
/** Pre-loaded OCSP responses (DER-encoded). */
|
|
2615
|
+
ocspResponses?: Uint8Array[] | undefined;
|
|
2616
|
+
/** Pre-loaded CRLs (DER-encoded). */
|
|
2617
|
+
crls?: Uint8Array[] | undefined;
|
|
2618
|
+
/** Additional certificates (DER-encoded) for the chain. */
|
|
2619
|
+
extraCertificates?: Uint8Array[] | undefined;
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Data for the Document Security Store dictionary.
|
|
2623
|
+
*/
|
|
2624
|
+
interface DssData {
|
|
2625
|
+
/** DER-encoded certificates for the chain. */
|
|
2626
|
+
certs: Uint8Array[];
|
|
2627
|
+
/** DER-encoded OCSP responses. */
|
|
2628
|
+
ocsps: Uint8Array[];
|
|
2629
|
+
/** DER-encoded CRLs. */
|
|
2630
|
+
crls: Uint8Array[];
|
|
2631
|
+
}
|
|
2632
|
+
/**
|
|
2633
|
+
* Build a DSS (Document Security Store) dictionary string for
|
|
2634
|
+
* incremental append to a PDF.
|
|
2635
|
+
*
|
|
2636
|
+
* The DSS dictionary contains:
|
|
2637
|
+
* - /Certs: array of stream references for certificates
|
|
2638
|
+
* - /OCSPs: array of stream references for OCSP responses
|
|
2639
|
+
* - /CRLs: array of stream references for CRLs
|
|
2640
|
+
*
|
|
2641
|
+
* @param data The DSS data containing certs, OCSPs, and CRLs.
|
|
2642
|
+
* @returns A string representation of the DSS dictionary content.
|
|
2643
|
+
*
|
|
2644
|
+
* @example
|
|
2645
|
+
* ```ts
|
|
2646
|
+
* const dssStr = buildDssDictionary({
|
|
2647
|
+
* certs: [certDer1, certDer2],
|
|
2648
|
+
* ocsps: [ocspResponse],
|
|
2649
|
+
* crls: [crlDer],
|
|
2650
|
+
* });
|
|
2651
|
+
* ```
|
|
2652
|
+
*/
|
|
2653
|
+
declare function buildDssDictionary(data: DssData): string;
|
|
2654
|
+
/**
|
|
2655
|
+
* Check whether a PDF already contains a Document Security Store (DSS).
|
|
2656
|
+
*
|
|
2657
|
+
* @param pdf The PDF bytes.
|
|
2658
|
+
* @returns `true` if the PDF contains a /DSS dictionary.
|
|
2659
|
+
*/
|
|
2660
|
+
declare function hasLtvData(pdf: Uint8Array): boolean;
|
|
2661
|
+
/**
|
|
2662
|
+
* Embed LTV (Long-Term Validation) data into a PDF.
|
|
2663
|
+
*
|
|
2664
|
+
* Extracts certificates from existing signatures, then appends a
|
|
2665
|
+
* Document Security Store (/DSS) dictionary to the PDF catalog via
|
|
2666
|
+
* incremental update. The DSS contains the certificate chains,
|
|
2667
|
+
* OCSP responses, and CRLs needed for future verification.
|
|
2668
|
+
*
|
|
2669
|
+
* @param pdf The PDF bytes.
|
|
2670
|
+
* @param options LTV embedding options.
|
|
2671
|
+
* @returns The PDF with embedded LTV data.
|
|
2672
|
+
*
|
|
2673
|
+
* @example
|
|
2674
|
+
* ```ts
|
|
2675
|
+
* import { embedLtvData } from 'modern-pdf-lib/signature';
|
|
2676
|
+
*
|
|
2677
|
+
* const ltvPdf = await embedLtvData(signedPdf, {
|
|
2678
|
+
* includeOcsp: true,
|
|
2679
|
+
* includeCrl: true,
|
|
2680
|
+
* includeCerts: true,
|
|
2681
|
+
* });
|
|
2682
|
+
* ```
|
|
2683
|
+
*/
|
|
2684
|
+
declare function embedLtvData(pdf: Uint8Array, options?: LtvOptions | undefined): Promise<Uint8Array>;
|
|
2685
|
+
//#endregion
|
|
2686
|
+
//#region src/signature/incrementalOptimizer.d.ts
|
|
2687
|
+
/**
|
|
2688
|
+
* @module signature/incrementalOptimizer
|
|
2689
|
+
*
|
|
2690
|
+
* Incremental save size optimization.
|
|
2691
|
+
*
|
|
2692
|
+
* When performing incremental updates on a PDF, naive implementations
|
|
2693
|
+
* re-emit every modified object even if the content is identical to
|
|
2694
|
+
* the original. This module provides object-level diffing using FNV-1a
|
|
2695
|
+
* hashing to detect truly-changed objects and deduplicates identical
|
|
2696
|
+
* updates, producing minimal incremental appendices.
|
|
2697
|
+
*
|
|
2698
|
+
* @packageDocumentation
|
|
2699
|
+
*/
|
|
2700
|
+
/**
|
|
2701
|
+
* A single object change for an incremental update.
|
|
2702
|
+
*/
|
|
2703
|
+
interface IncrementalChange {
|
|
2704
|
+
/** The PDF object number. */
|
|
2705
|
+
objectNumber: number;
|
|
2706
|
+
/** The generation number. */
|
|
2707
|
+
generationNumber: number;
|
|
2708
|
+
/** The new content for this object (raw bytes). */
|
|
2709
|
+
newContent: Uint8Array;
|
|
2710
|
+
}
|
|
2711
|
+
/**
|
|
2712
|
+
* FNV-1a 32-bit hash.
|
|
2713
|
+
*
|
|
2714
|
+
* A fast, non-cryptographic hash with good distribution properties.
|
|
2715
|
+
* Used for content comparison and deduplication.
|
|
2716
|
+
*
|
|
2717
|
+
* @param data The bytes to hash.
|
|
2718
|
+
* @returns A 32-bit unsigned hash as a hex string.
|
|
2719
|
+
*/
|
|
2720
|
+
declare function computeObjectHash(data: Uint8Array): string;
|
|
2721
|
+
/**
|
|
2722
|
+
* Find the list of object numbers whose content actually changed
|
|
2723
|
+
* between two versions of a PDF.
|
|
2724
|
+
*
|
|
2725
|
+
* Extracts all objects from both versions, hashes their content
|
|
2726
|
+
* using FNV-1a, and returns the object numbers where the hashes
|
|
2727
|
+
* differ.
|
|
2728
|
+
*
|
|
2729
|
+
* @param original The original PDF bytes.
|
|
2730
|
+
* @param modified The modified PDF bytes.
|
|
2731
|
+
* @returns Array of object numbers that have different content.
|
|
2732
|
+
*
|
|
2733
|
+
* @example
|
|
2734
|
+
* ```ts
|
|
2735
|
+
* const changed = findChangedObjects(originalPdf, modifiedPdf);
|
|
2736
|
+
* console.log(`${changed.length} objects actually changed`);
|
|
2737
|
+
* ```
|
|
2738
|
+
*/
|
|
2739
|
+
declare function findChangedObjects(original: Uint8Array, modified: Uint8Array): number[];
|
|
2740
|
+
/**
|
|
2741
|
+
* Optimize an incremental save by removing unchanged objects and
|
|
2742
|
+
* deduplicating identical updates.
|
|
2743
|
+
*
|
|
2744
|
+
* This function:
|
|
2745
|
+
* 1. Computes FNV-1a hashes of each change's content
|
|
2746
|
+
* 2. Compares against the original PDF objects to skip unchanged ones
|
|
2747
|
+
* 3. Deduplicates identical change entries (same content for same object)
|
|
2748
|
+
* 4. Builds a minimal incremental update containing only truly changed objects
|
|
2749
|
+
*
|
|
2750
|
+
* @param originalPdf The original PDF bytes.
|
|
2751
|
+
* @param changes The list of proposed changes.
|
|
2752
|
+
* @returns The optimized PDF bytes with minimal incremental update.
|
|
2753
|
+
*
|
|
2754
|
+
* @example
|
|
2755
|
+
* ```ts
|
|
2756
|
+
* import { optimizeIncrementalSave } from 'modern-pdf-lib/signature';
|
|
2757
|
+
*
|
|
2758
|
+
* const optimizedPdf = optimizeIncrementalSave(originalPdf, [
|
|
2759
|
+
* { objectNumber: 5, generationNumber: 0, newContent: newObj5 },
|
|
2760
|
+
* { objectNumber: 7, generationNumber: 0, newContent: newObj7 },
|
|
2761
|
+
* ]);
|
|
2762
|
+
* ```
|
|
2763
|
+
*/
|
|
2764
|
+
declare function optimizeIncrementalSave(originalPdf: Uint8Array, changes: IncrementalChange[]): Uint8Array;
|
|
2765
|
+
//#endregion
|
|
2766
|
+
//#region src/core/linearization.d.ts
|
|
2767
|
+
/**
|
|
2768
|
+
* @module core/linearization
|
|
2769
|
+
*
|
|
2770
|
+
* Linearization support for PDF documents (PDF spec Appendix F).
|
|
2771
|
+
*
|
|
2772
|
+
* A linearized PDF is organized so that the first page can be displayed
|
|
2773
|
+
* before the entire file is downloaded. This is sometimes called
|
|
2774
|
+
* "fast web view" or "optimized for the web".
|
|
2775
|
+
*
|
|
2776
|
+
* **Structure of a linearized PDF (per §F.2):**
|
|
2777
|
+
*
|
|
2778
|
+
* 1. Header (%PDF-1.x + binary comment)
|
|
2779
|
+
* 2. Linearization parameter dictionary (first indirect object)
|
|
2780
|
+
* 3. First-page cross-reference table and trailer
|
|
2781
|
+
* 4. Document catalog, first-page objects
|
|
2782
|
+
* 5. Primary hint stream
|
|
2783
|
+
* 6. Remaining pages' objects (part 6..11 per spec)
|
|
2784
|
+
* 7. Main (overflow) cross-reference table and trailer
|
|
2785
|
+
* 8. %%EOF
|
|
2786
|
+
*
|
|
2787
|
+
* This implementation provides:
|
|
2788
|
+
* - Detection of linearized PDFs (`isLinearized`)
|
|
2789
|
+
* - Extraction of linearization info (`getLinearizationInfo`)
|
|
2790
|
+
* - Full linearization pass (`linearizePdf`) that reorganizes objects
|
|
2791
|
+
* so the first page's objects come first, with a linearization
|
|
2792
|
+
* parameter dict, page-offset hint table, shared object hint table,
|
|
2793
|
+
* and cross-reference streams.
|
|
2794
|
+
* - Delinearization (`delinearizePdf`) that strips linearization
|
|
2795
|
+
* artifacts and produces a normal (non-linearized) PDF.
|
|
2796
|
+
*
|
|
2797
|
+
* Reference: PDF 1.7 spec, Appendix F (Linearized PDF).
|
|
2798
|
+
*/
|
|
2799
|
+
/** Options for the linearization process. */
|
|
2800
|
+
interface LinearizationOptions {
|
|
2801
|
+
/** First page to optimize for (default: 0). */
|
|
2802
|
+
firstPage?: number | undefined;
|
|
2803
|
+
}
|
|
2804
|
+
/**
|
|
2805
|
+
* Information extracted from a linearization parameter dictionary.
|
|
2806
|
+
* Maps to the entries defined in PDF spec §F.2.
|
|
2807
|
+
*/
|
|
2808
|
+
interface LinearizationInfo {
|
|
2809
|
+
/** Linearization version (e.g. 1.0). */
|
|
2810
|
+
version: number;
|
|
2811
|
+
/** File length (/L). */
|
|
2812
|
+
length: number;
|
|
2813
|
+
/** Object number of the first page's page object (/O). */
|
|
2814
|
+
primaryPage: number;
|
|
2815
|
+
/** Total page count (/N). */
|
|
2816
|
+
pageCount: number;
|
|
2817
|
+
/** Byte offset of the end of the first page section (/E). */
|
|
2818
|
+
firstPageOffset: number;
|
|
2819
|
+
}
|
|
2820
|
+
/**
|
|
2821
|
+
* Check if a PDF is linearized.
|
|
2822
|
+
*
|
|
2823
|
+
* A linearized PDF has a linearization parameter dictionary as the
|
|
2824
|
+
* very first indirect object after the header. This dictionary
|
|
2825
|
+
* contains `/Linearized` as a key.
|
|
2826
|
+
*
|
|
2827
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2828
|
+
* @returns `true` if the PDF appears to be linearized.
|
|
2829
|
+
*/
|
|
2830
|
+
declare function isLinearized(pdfBytes: Uint8Array): boolean;
|
|
2831
|
+
/**
|
|
2832
|
+
* Extract linearization information from a linearized PDF.
|
|
2833
|
+
*
|
|
2834
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2835
|
+
* @returns The linearization info, or `null` if not linearized.
|
|
2836
|
+
*/
|
|
2837
|
+
declare function getLinearizationInfo(pdfBytes: Uint8Array): LinearizationInfo | null;
|
|
2838
|
+
/**
|
|
2839
|
+
* Linearize a PDF document for fast web viewing.
|
|
2840
|
+
*
|
|
2841
|
+
* This reorganizes the PDF so that:
|
|
2842
|
+
* 1. A linearization parameter dictionary appears first (§F.2)
|
|
2843
|
+
* 2. Objects needed for the first page appear early in the file
|
|
2844
|
+
* 3. A primary hint stream describes page offsets and shared objects (§F.4)
|
|
2845
|
+
* 4. Cross-reference streams are used for all xref data (§7.5.8)
|
|
2846
|
+
*
|
|
2847
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2848
|
+
* @param options Linearization options.
|
|
2849
|
+
* @returns The linearized PDF bytes.
|
|
2850
|
+
*/
|
|
2851
|
+
declare function linearizePdf(pdfBytes: Uint8Array, options?: LinearizationOptions): Promise<Uint8Array>;
|
|
2852
|
+
/**
|
|
2853
|
+
* Remove linearization artifacts from a PDF, producing a normal
|
|
2854
|
+
* (non-linearized) PDF.
|
|
2855
|
+
*
|
|
2856
|
+
* This:
|
|
2857
|
+
* 1. Strips the linearization parameter dictionary
|
|
2858
|
+
* 2. Removes hint streams
|
|
2859
|
+
* 3. Rebuilds the xref table without linearization ordering constraints
|
|
2860
|
+
* 4. Removes any /Linearized key from the output
|
|
2861
|
+
*
|
|
2862
|
+
* If the input PDF is not linearized, it is returned unchanged.
|
|
2863
|
+
*
|
|
2864
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2865
|
+
* @returns A non-linearized PDF.
|
|
2866
|
+
*/
|
|
2867
|
+
declare function delinearizePdf(pdfBytes: Uint8Array): Promise<Uint8Array>;
|
|
2868
|
+
//#endregion
|
|
2869
|
+
//#region src/compliance/pdfA.d.ts
|
|
2870
|
+
/**
|
|
2871
|
+
* @module compliance/pdfA
|
|
2872
|
+
*
|
|
2873
|
+
* PDF/A compliance validation and enforcement.
|
|
2874
|
+
*
|
|
2875
|
+
* PDF/A is an ISO standard for long-term archival of electronic documents.
|
|
2876
|
+
* It restricts certain PDF features (e.g. encryption, JavaScript,
|
|
2877
|
+
* transparency) and mandates others (e.g. embedded fonts, XMP metadata).
|
|
2878
|
+
*
|
|
2879
|
+
* Supported conformance levels:
|
|
2880
|
+
* - **1b**: PDF/A-1b (based on PDF 1.4) — basic visual preservation
|
|
2881
|
+
* - **1a**: PDF/A-1a — adds logical structure and tagged PDF
|
|
2882
|
+
* - **2b**: PDF/A-2b (based on PDF 1.7) — allows JPEG2000, transparency
|
|
2883
|
+
* - **2a**: PDF/A-2a — adds logical structure
|
|
2884
|
+
* - **2u**: PDF/A-2u — adds Unicode mapping
|
|
2885
|
+
* - **3b**: PDF/A-3b — allows embedded files of any type
|
|
2886
|
+
* - **3a**: PDF/A-3a — adds logical structure
|
|
2887
|
+
* - **3u**: PDF/A-3u — adds Unicode mapping
|
|
2888
|
+
*
|
|
2889
|
+
* Reference: ISO 19005-1:2005, ISO 19005-2:2011, ISO 19005-3:2012.
|
|
2890
|
+
*/
|
|
2891
|
+
/** PDF/A conformance level. */
|
|
2892
|
+
type PdfALevel = '1b' | '2b' | '3b' | '1a' | '2a' | '3a' | '2u' | '3u';
|
|
2893
|
+
/** Result of a PDF/A validation check. */
|
|
2894
|
+
interface PdfAValidationResult {
|
|
2895
|
+
valid: boolean;
|
|
2896
|
+
level: PdfALevel;
|
|
2897
|
+
issues: PdfAIssue[];
|
|
2898
|
+
}
|
|
2899
|
+
/** A single PDF/A compliance issue. */
|
|
2900
|
+
interface PdfAIssue {
|
|
2901
|
+
code: string;
|
|
2902
|
+
message: string;
|
|
2903
|
+
severity: 'error' | 'warning';
|
|
2904
|
+
}
|
|
2905
|
+
/**
|
|
2906
|
+
* Validate a PDF against a specific PDF/A conformance level.
|
|
2907
|
+
*
|
|
2908
|
+
* This performs structural checks on the raw PDF bytes. It does NOT
|
|
2909
|
+
* fully render or deeply parse the PDF — it checks for the presence
|
|
2910
|
+
* or absence of features that PDF/A requires or forbids.
|
|
2911
|
+
*
|
|
2912
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2913
|
+
* @param level The target PDF/A conformance level.
|
|
2914
|
+
* @returns A validation result with any issues found.
|
|
2915
|
+
*/
|
|
2916
|
+
declare function validatePdfA(pdfBytes: Uint8Array, level: PdfALevel): PdfAValidationResult;
|
|
2917
|
+
/**
|
|
2918
|
+
* Attempt to make a PDF conform to PDF/A.
|
|
2919
|
+
*
|
|
2920
|
+
* This adds or corrects:
|
|
2921
|
+
* - XMP metadata with PDF/A identification
|
|
2922
|
+
* - File identifier (/ID) in the trailer
|
|
2923
|
+
* - Document language (if missing, defaults to "en")
|
|
2924
|
+
*
|
|
2925
|
+
* **Limitations:**
|
|
2926
|
+
* - Cannot embed fonts that are not already embedded
|
|
2927
|
+
* - Cannot remove encryption or JavaScript (throws an error)
|
|
2928
|
+
* - Cannot add structure tree for 'a' conformance
|
|
2929
|
+
* - For full PDF/A conversion, use a dedicated tool
|
|
2930
|
+
*
|
|
2931
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2932
|
+
* @param level The target PDF/A conformance level.
|
|
2933
|
+
* @returns The modified PDF bytes.
|
|
2934
|
+
*/
|
|
2935
|
+
declare function enforcePdfA(pdfBytes: Uint8Array, level: PdfALevel): Promise<Uint8Array>;
|
|
2936
|
+
//#endregion
|
|
2937
|
+
//#region src/compliance/transparencyFlattener.d.ts
|
|
2938
|
+
/**
|
|
2939
|
+
* Transparency flattener for PDF/A-1 compliance.
|
|
2940
|
+
*
|
|
2941
|
+
* PDF/A-1 (ISO 19005-1:2005) prohibits transparency features:
|
|
2942
|
+
* - ExtGState with /CA (stroke opacity) < 1.0
|
|
2943
|
+
* - ExtGState with /ca (fill opacity) < 1.0
|
|
2944
|
+
* - /SMask references (soft masks)
|
|
2945
|
+
* - /BM (blend mode) other than /Normal
|
|
2946
|
+
*
|
|
2947
|
+
* This module detects transparency usage and can modify the PDF
|
|
2948
|
+
* to remove or flatten it for PDF/A-1 compliance.
|
|
2949
|
+
*/
|
|
2950
|
+
/** Detected transparency usage in a PDF. */
|
|
2951
|
+
interface TransparencyInfo {
|
|
2952
|
+
/** Whether any transparency was found. */
|
|
2953
|
+
readonly hasTransparency: boolean;
|
|
2954
|
+
/** Number of ExtGState objects with non-1.0 CA. */
|
|
2955
|
+
readonly strokeOpacityCount: number;
|
|
2956
|
+
/** Number of ExtGState objects with non-1.0 ca. */
|
|
2957
|
+
readonly fillOpacityCount: number;
|
|
2958
|
+
/** Number of SMask references found. */
|
|
2959
|
+
readonly softMaskCount: number;
|
|
2960
|
+
/** Number of non-Normal blend mode references. */
|
|
2961
|
+
readonly blendModeCount: number;
|
|
2962
|
+
/** Detailed findings. */
|
|
2963
|
+
readonly findings: TransparencyFinding[];
|
|
2964
|
+
}
|
|
2965
|
+
/** A single transparency finding with type, value, and byte position. */
|
|
2966
|
+
interface TransparencyFinding {
|
|
2967
|
+
readonly type: 'stroke-opacity' | 'fill-opacity' | 'soft-mask' | 'blend-mode';
|
|
2968
|
+
readonly value: string;
|
|
2969
|
+
readonly position: number;
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Analyze PDF bytes for transparency usage.
|
|
2973
|
+
*
|
|
2974
|
+
* Scans the raw PDF text for ExtGState entries that use:
|
|
2975
|
+
* - `/CA <value>` where value < 1.0 (stroke opacity)
|
|
2976
|
+
* - `/ca <value>` where value < 1.0 (fill opacity)
|
|
2977
|
+
* - `/SMask <ref>` where ref is not `/None`
|
|
2978
|
+
* - `/BM /<mode>` where mode is not `Normal`
|
|
2979
|
+
*
|
|
2980
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2981
|
+
* @returns A {@link TransparencyInfo} describing any transparency found.
|
|
2982
|
+
*/
|
|
2983
|
+
declare function detectTransparency(pdfBytes: Uint8Array): TransparencyInfo;
|
|
2984
|
+
/**
|
|
2985
|
+
* Flatten transparency by modifying PDF bytes.
|
|
2986
|
+
*
|
|
2987
|
+
* This replaces:
|
|
2988
|
+
* - `/CA <value>` with `/CA 1` (where value < 1)
|
|
2989
|
+
* - `/ca <value>` with `/ca 1` (where value < 1)
|
|
2990
|
+
* - `/SMask <ref>` with `/SMask /None`
|
|
2991
|
+
* - `/BM /<mode>` with `/BM /Normal`
|
|
2992
|
+
*
|
|
2993
|
+
* **Note:** This is a "lossy" operation — semi-transparent elements
|
|
2994
|
+
* will become fully opaque. For print-quality output, manual review
|
|
2995
|
+
* is recommended.
|
|
2996
|
+
*
|
|
2997
|
+
* @param pdfBytes The raw PDF bytes.
|
|
2998
|
+
* @returns Modified PDF bytes with transparency removed.
|
|
2999
|
+
*/
|
|
3000
|
+
declare function flattenTransparency(pdfBytes: Uint8Array): Uint8Array;
|
|
3001
|
+
//#endregion
|
|
3002
|
+
//#region src/compliance/srgbIccProfile.d.ts
|
|
3003
|
+
/**
|
|
3004
|
+
* @module compliance/srgbIccProfile
|
|
3005
|
+
*
|
|
3006
|
+
* Minimal sRGB ICC profile for PDF/A output intents.
|
|
3007
|
+
*
|
|
3008
|
+
* This generates a valid ICC v2 profile (~3KB) that satisfies
|
|
3009
|
+
* PDF/A validators. It uses the standard sRGB primaries and
|
|
3010
|
+
* the sRGB tone response curve (gamma ~ 2.2).
|
|
3011
|
+
*
|
|
3012
|
+
* The sRGB color space is defined by IEC 61966-2.1 and its ICC
|
|
3013
|
+
* profile encodes the D65 white point, the three primary
|
|
3014
|
+
* colorants (red, green, blue), and the tone response curve
|
|
3015
|
+
* (TRC) for each channel.
|
|
3016
|
+
*
|
|
3017
|
+
* Reference: ICC.1:2001-04 (ICC Profile Format Specification).
|
|
3018
|
+
*/
|
|
3019
|
+
/**
|
|
3020
|
+
* Generate a minimal sRGB ICC v2 profile.
|
|
3021
|
+
*
|
|
3022
|
+
* The resulting profile is a valid ICC v2.1.0 profile containing the
|
|
3023
|
+
* minimum set of tags required for a Display profile with 'RGB ' color
|
|
3024
|
+
* space and 'XYZ ' PCS:
|
|
3025
|
+
*
|
|
3026
|
+
* - `desc` — profile description ("sRGB IEC61966-2.1")
|
|
3027
|
+
* - `cprt` — copyright notice
|
|
3028
|
+
* - `wtpt` — media white point (D50)
|
|
3029
|
+
* - `rXYZ`, `gXYZ`, `bXYZ` — red/green/blue colorant XYZ values
|
|
3030
|
+
* - `rTRC`, `gTRC`, `bTRC` — red/green/blue tone response curves (gamma 2.2)
|
|
3031
|
+
*
|
|
3032
|
+
* @returns Raw ICC profile bytes (Uint8Array).
|
|
3033
|
+
*/
|
|
3034
|
+
declare function generateSrgbIccProfile(): Uint8Array;
|
|
2227
3035
|
/**
|
|
2228
3036
|
* Pre-generated sRGB ICC profile (cached).
|
|
2229
3037
|
*
|
|
@@ -2766,6 +3574,28 @@ interface EnforcementAction {
|
|
|
2766
3574
|
*/
|
|
2767
3575
|
declare function enforcePdfAFull(pdfBytes: Uint8Array, level: PdfALevel, options?: EnforcePdfAOptions): Promise<EnforcePdfAResult>;
|
|
2768
3576
|
//#endregion
|
|
3577
|
+
//#region src/annotation/applyRedactions.d.ts
|
|
3578
|
+
/** Result of applying redactions to a document. */
|
|
3579
|
+
interface RedactionResult {
|
|
3580
|
+
/** Total number of redaction annotations that were applied. */
|
|
3581
|
+
appliedCount: number;
|
|
3582
|
+
/** Zero-based indices of pages that had redactions applied. */
|
|
3583
|
+
pages: number[];
|
|
3584
|
+
}
|
|
3585
|
+
/**
|
|
3586
|
+
* Apply a single redaction annotation identified by page and annotation
|
|
3587
|
+
* index.
|
|
3588
|
+
*
|
|
3589
|
+
* @param doc The PDF document.
|
|
3590
|
+
* @param pageIndex Zero-based page index.
|
|
3591
|
+
* @param annotIndex Zero-based annotation index within the page.
|
|
3592
|
+
* @returns A {@link RedactionResult} (appliedCount 0 or 1).
|
|
3593
|
+
* @throws RangeError if pageIndex or annotIndex is out of bounds.
|
|
3594
|
+
* @throws TypeError if the annotation at annotIndex is not a
|
|
3595
|
+
* /Redact annotation.
|
|
3596
|
+
*/
|
|
3597
|
+
declare function applyRedaction(doc: PdfDocument, pageIndex: number, annotIndex: number): RedactionResult;
|
|
3598
|
+
//#endregion
|
|
2769
3599
|
//#region src/wasm/jpeg/bridge.d.ts
|
|
2770
3600
|
/**
|
|
2771
3601
|
* @module wasm/jpeg/bridge
|
|
@@ -3523,137 +4353,529 @@ declare function computeTargetDimensions(imageWidth: number, imageHeight: number
|
|
|
3523
4353
|
/**
|
|
3524
4354
|
* @module assets/image/jpegMarkers
|
|
3525
4355
|
*
|
|
3526
|
-
* JPEG marker analysis for detecting arithmetic coding and other properties.
|
|
4356
|
+
* JPEG marker analysis for detecting arithmetic coding and other properties.
|
|
4357
|
+
*
|
|
4358
|
+
* Scans JPEG marker segments without decoding image data to determine
|
|
4359
|
+
* the coding method (Huffman vs arithmetic), progressive vs sequential
|
|
4360
|
+
* encoding, and basic frame parameters (width, height, components, bpc).
|
|
4361
|
+
*
|
|
4362
|
+
* This is useful for PDF batch optimization: arithmetic-coded JPEGs
|
|
4363
|
+
* (SOF9/SOF10/SOF11) cannot be decoded by most JPEG decoders and must
|
|
4364
|
+
* be skipped during recompression.
|
|
4365
|
+
*
|
|
4366
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
4367
|
+
*/
|
|
4368
|
+
/** Result of JPEG marker analysis. */
|
|
4369
|
+
interface JpegMarkerInfo {
|
|
4370
|
+
/** Whether the JPEG uses arithmetic coding (SOF9, SOF10, or SOF11). */
|
|
4371
|
+
readonly isArithmeticCoded: boolean;
|
|
4372
|
+
/** Whether the JPEG uses progressive encoding (SOF2 or SOF10). */
|
|
4373
|
+
readonly isProgressive: boolean;
|
|
4374
|
+
/** The SOF marker type (e.g. 0xC0 for baseline, 0xC2 for progressive). */
|
|
4375
|
+
readonly sofType: number;
|
|
4376
|
+
/** Image width in pixels. */
|
|
4377
|
+
readonly width: number;
|
|
4378
|
+
/** Image height in pixels. */
|
|
4379
|
+
readonly height: number;
|
|
4380
|
+
/** Number of color components (1=gray, 3=YCbCr, 4=CMYK). */
|
|
4381
|
+
readonly components: number;
|
|
4382
|
+
/** Bits per component (typically 8, sometimes 12). */
|
|
4383
|
+
readonly bitsPerComponent: number;
|
|
4384
|
+
}
|
|
4385
|
+
/**
|
|
4386
|
+
* Parse JPEG markers to detect arithmetic coding and other properties.
|
|
4387
|
+
* Scans marker segments without decoding image data.
|
|
4388
|
+
*
|
|
4389
|
+
* @param data - Raw JPEG bytes (must start with FF D8).
|
|
4390
|
+
* @returns Marker info, or `undefined` if not valid JPEG.
|
|
4391
|
+
*
|
|
4392
|
+
* @example
|
|
4393
|
+
* ```ts
|
|
4394
|
+
* import { analyzeJpegMarkers } from 'modern-pdf-lib';
|
|
4395
|
+
*
|
|
4396
|
+
* const info = analyzeJpegMarkers(jpegBytes);
|
|
4397
|
+
* if (info?.isArithmeticCoded) {
|
|
4398
|
+
* console.log('Cannot re-encode: arithmetic-coded JPEG');
|
|
4399
|
+
* }
|
|
4400
|
+
* ```
|
|
4401
|
+
*/
|
|
4402
|
+
declare function analyzeJpegMarkers(data: Uint8Array): JpegMarkerInfo | undefined;
|
|
4403
|
+
//#endregion
|
|
4404
|
+
//#region src/assets/image/imageMetadata.d.ts
|
|
4405
|
+
/**
|
|
4406
|
+
* @module assets/image/imageMetadata
|
|
4407
|
+
*
|
|
4408
|
+
* JPEG EXIF metadata extraction and re-injection.
|
|
4409
|
+
*
|
|
4410
|
+
* When images are recompressed (e.g. via `encodeJpegWasm()`), the encoder
|
|
4411
|
+
* produces a minimal JPEG containing only SOI + DQT + SOF + DHT + SOS.
|
|
4412
|
+
* All APP markers — including JFIF (APP0) and EXIF (APP1) — are stripped.
|
|
4413
|
+
*
|
|
4414
|
+
* This module extracts key metadata fields (orientation, DPI, copyright)
|
|
4415
|
+
* and the raw APP marker segments from the original JPEG, then re-injects
|
|
4416
|
+
* them into the recompressed output so that downstream consumers (PDF
|
|
4417
|
+
* viewers, print RIPs, image editors) see correct metadata.
|
|
4418
|
+
*
|
|
4419
|
+
* APP2 (ICC profile) markers are excluded because ICC profiles are
|
|
4420
|
+
* handled separately by `iccProfile.ts`.
|
|
4421
|
+
*
|
|
4422
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
4423
|
+
*/
|
|
4424
|
+
/**
|
|
4425
|
+
* Extracted JPEG metadata from APP markers.
|
|
4426
|
+
*/
|
|
4427
|
+
interface JpegMetadata {
|
|
4428
|
+
/** EXIF orientation tag (1-8). 1 = normal, 6 = rotated 90 CW, etc. */
|
|
4429
|
+
readonly orientation?: number;
|
|
4430
|
+
/** Horizontal DPI from EXIF or JFIF. */
|
|
4431
|
+
readonly dpiX?: number;
|
|
4432
|
+
/** Vertical DPI from EXIF or JFIF. */
|
|
4433
|
+
readonly dpiY?: number;
|
|
4434
|
+
/** Copyright string from EXIF. */
|
|
4435
|
+
readonly copyright?: string;
|
|
4436
|
+
/** Raw APP marker segments to preserve (excluding APP2/ICC). */
|
|
4437
|
+
readonly appMarkers: readonly Uint8Array[];
|
|
4438
|
+
}
|
|
4439
|
+
/**
|
|
4440
|
+
* Extract metadata from JPEG APP markers.
|
|
4441
|
+
*
|
|
4442
|
+
* Scans after the SOI (FF D8) marker for APP markers (FF E0 through FF EF).
|
|
4443
|
+
* Extracts key metadata from JFIF (APP0) and EXIF (APP1) segments, and
|
|
4444
|
+
* collects all APP marker segments as raw bytes (excluding APP2/ICC, which
|
|
4445
|
+
* is handled separately by `iccProfile.ts`).
|
|
4446
|
+
*
|
|
4447
|
+
* Scanning stops at the first non-APP marker (SOF, DQT, DHT, SOS, etc.).
|
|
4448
|
+
*
|
|
4449
|
+
* @param jpegBytes - Raw JPEG file bytes.
|
|
4450
|
+
* @returns Extracted metadata with collected APP marker segments.
|
|
4451
|
+
*
|
|
4452
|
+
* @example
|
|
4453
|
+
* ```ts
|
|
4454
|
+
* import { extractJpegMetadata } from 'modern-pdf-lib';
|
|
4455
|
+
*
|
|
4456
|
+
* const metadata = extractJpegMetadata(jpegBytes);
|
|
4457
|
+
* console.log(`Orientation: ${metadata.orientation}`);
|
|
4458
|
+
* console.log(`DPI: ${metadata.dpiX} x ${metadata.dpiY}`);
|
|
4459
|
+
* console.log(`Copyright: ${metadata.copyright}`);
|
|
4460
|
+
* ```
|
|
4461
|
+
*/
|
|
4462
|
+
declare function extractJpegMetadata(jpegBytes: Uint8Array): JpegMetadata;
|
|
4463
|
+
/**
|
|
4464
|
+
* Inject preserved APP markers into a recompressed JPEG.
|
|
4465
|
+
*
|
|
4466
|
+
* Inserts the collected APP marker segments after the SOI (FF D8) marker
|
|
4467
|
+
* and before any existing content. This restores metadata that was
|
|
4468
|
+
* stripped during recompression.
|
|
4469
|
+
*
|
|
4470
|
+
* @param jpegBytes - The recompressed JPEG bytes (starting with FF D8).
|
|
4471
|
+
* @param metadata - The metadata extracted from the original JPEG.
|
|
4472
|
+
* @returns A new Uint8Array with the APP markers injected.
|
|
4473
|
+
*
|
|
4474
|
+
* @example
|
|
4475
|
+
* ```ts
|
|
4476
|
+
* import { extractJpegMetadata, injectJpegMetadata } from 'modern-pdf-lib';
|
|
4477
|
+
*
|
|
4478
|
+
* // Before recompression, extract metadata from original
|
|
4479
|
+
* const metadata = extractJpegMetadata(originalJpeg);
|
|
4480
|
+
*
|
|
4481
|
+
* // After recompression, inject metadata back
|
|
4482
|
+
* const recompressed = encodeJpegWasm(pixels, w, h, 3, 85);
|
|
4483
|
+
* const withMetadata = injectJpegMetadata(recompressed, metadata);
|
|
4484
|
+
* ```
|
|
4485
|
+
*/
|
|
4486
|
+
declare function injectJpegMetadata(jpegBytes: Uint8Array, metadata: JpegMetadata): Uint8Array;
|
|
4487
|
+
//#endregion
|
|
4488
|
+
//#region src/assets/image/tiffCmyk.d.ts
|
|
4489
|
+
/**
|
|
4490
|
+
* @module assets/image/tiffCmyk
|
|
4491
|
+
*
|
|
4492
|
+
* TIFF CMYK color space handling for PDF embedding.
|
|
4493
|
+
*
|
|
4494
|
+
* Provides:
|
|
4495
|
+
* - CMYK-to-RGB conversion for display/rendering
|
|
4496
|
+
* - Native CMYK embedding in PDF (no conversion needed)
|
|
4497
|
+
* - CMYK TIFF detection via IFD tag inspection
|
|
4498
|
+
*
|
|
4499
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
4500
|
+
* No fs — no file system access.
|
|
4501
|
+
* No require() — ESM import only.
|
|
4502
|
+
*/
|
|
4503
|
+
/**
|
|
4504
|
+
* An IFD entry from a TIFF file, containing a tag number and its value.
|
|
4505
|
+
*/
|
|
4506
|
+
interface TiffIfdEntry {
|
|
4507
|
+
/** The TIFF tag number (e.g. 262 for PhotometricInterpretation). */
|
|
4508
|
+
readonly tag: number;
|
|
4509
|
+
/** The resolved integer value of the tag. */
|
|
4510
|
+
readonly value: number;
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* Result of embedding CMYK TIFF data for use in a PDF image XObject.
|
|
4514
|
+
*/
|
|
4515
|
+
interface TiffCmykEmbedResult {
|
|
4516
|
+
/** PDF color space — always `'DeviceCMYK'`. */
|
|
4517
|
+
readonly colorSpace: string;
|
|
4518
|
+
/** The raw CMYK pixel data (4 channels, 8 bits per component). */
|
|
4519
|
+
readonly data: Uint8Array;
|
|
4520
|
+
/** Bits per component — always `8`. */
|
|
4521
|
+
readonly bitsPerComponent: number;
|
|
4522
|
+
}
|
|
4523
|
+
/**
|
|
4524
|
+
* Convert CMYK pixel data to RGB.
|
|
4525
|
+
*
|
|
4526
|
+
* Uses the standard CMYK-to-RGB formula:
|
|
4527
|
+
* ```
|
|
4528
|
+
* R = 255 * (1 - C/255) * (1 - K/255)
|
|
4529
|
+
* G = 255 * (1 - M/255) * (1 - K/255)
|
|
4530
|
+
* B = 255 * (1 - Y/255) * (1 - K/255)
|
|
4531
|
+
* ```
|
|
4532
|
+
*
|
|
4533
|
+
* @param cmykPixels Flat array of CMYK pixel data (4 bytes per pixel: C, M, Y, K).
|
|
4534
|
+
* @param width Image width in pixels.
|
|
4535
|
+
* @param height Image height in pixels.
|
|
4536
|
+
* @returns Flat array of RGB pixel data (3 bytes per pixel: R, G, B).
|
|
4537
|
+
* @throws If the input array length does not match width * height * 4.
|
|
4538
|
+
*/
|
|
4539
|
+
declare function convertTiffCmykToRgb(cmykPixels: Uint8Array, width: number, height: number): Uint8Array;
|
|
4540
|
+
/**
|
|
4541
|
+
* Prepare CMYK pixel data for native embedding in a PDF using /DeviceCMYK.
|
|
4542
|
+
*
|
|
4543
|
+
* PDF natively supports CMYK color spaces, so no RGB conversion is
|
|
4544
|
+
* needed — the raw CMYK data can be used directly as the image stream.
|
|
4545
|
+
*
|
|
4546
|
+
* @param pixels Flat array of CMYK pixel data (4 bytes per pixel: C, M, Y, K).
|
|
4547
|
+
* @param width Image width in pixels.
|
|
4548
|
+
* @param height Image height in pixels.
|
|
4549
|
+
* @returns Embedding result with colorSpace, data, and bitsPerComponent.
|
|
4550
|
+
* @throws If the input array length does not match width * height * 4.
|
|
4551
|
+
*/
|
|
4552
|
+
declare function embedTiffCmyk(pixels: Uint8Array, width: number, height: number): TiffCmykEmbedResult;
|
|
4553
|
+
/**
|
|
4554
|
+
* Detect whether a TIFF image uses CMYK color space by inspecting IFD entries.
|
|
4555
|
+
*
|
|
4556
|
+
* A TIFF is considered CMYK when:
|
|
4557
|
+
* - PhotometricInterpretation (tag 262) has value 5 (Separated), AND
|
|
4558
|
+
* - If InkSet (tag 332) is present, its value must be 1 (CMYK inks)
|
|
4559
|
+
*
|
|
4560
|
+
* If InkSet is not present but PhotometricInterpretation is 5, the image
|
|
4561
|
+
* is assumed to be CMYK (per the TIFF specification default).
|
|
4562
|
+
*
|
|
4563
|
+
* @param ifdEntries Array of IFD entries with tag and value fields.
|
|
4564
|
+
* @returns `true` if the TIFF uses CMYK color space.
|
|
4565
|
+
*/
|
|
4566
|
+
declare function isCmykTiff(ifdEntries: Array<{
|
|
4567
|
+
tag: number;
|
|
4568
|
+
value: number;
|
|
4569
|
+
}>): boolean;
|
|
4570
|
+
//#endregion
|
|
4571
|
+
//#region src/assets/image/formatDetect.d.ts
|
|
4572
|
+
/**
|
|
4573
|
+
* @module assets/image/formatDetect
|
|
4574
|
+
*
|
|
4575
|
+
* Image format detection from magic bytes.
|
|
4576
|
+
*
|
|
4577
|
+
* Detects the following image formats by inspecting the file header:
|
|
4578
|
+
* - **PNG**: `89 50 4E 47` (first 4 bytes)
|
|
4579
|
+
* - **JPEG**: `FF D8 FF` (first 3 bytes)
|
|
4580
|
+
* - **WebP**: `52 49 46 46` (RIFF) at offset 0 + `57 45 42 50` (WEBP) at offset 8
|
|
4581
|
+
* - **TIFF LE**: `49 49 2A 00` (II\*\0) — little-endian byte order
|
|
4582
|
+
* - **TIFF BE**: `4D 4D 00 2A` (MM\0\*) — big-endian byte order
|
|
4583
|
+
*
|
|
4584
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
4585
|
+
* No fs — no file system access.
|
|
4586
|
+
* No require() — ESM import only.
|
|
4587
|
+
*/
|
|
4588
|
+
/**
|
|
4589
|
+
* Supported image format identifiers.
|
|
4590
|
+
*/
|
|
4591
|
+
type ImageFormat = 'png' | 'jpeg' | 'webp' | 'tiff' | 'unknown';
|
|
4592
|
+
/**
|
|
4593
|
+
* Detect the image format from the raw file bytes by inspecting magic bytes.
|
|
4594
|
+
*
|
|
4595
|
+
* @param data Raw image file bytes.
|
|
4596
|
+
* @returns The detected format, or `'unknown'` if unrecognized.
|
|
4597
|
+
*/
|
|
4598
|
+
declare function detectImageFormat(data: Uint8Array): ImageFormat;
|
|
4599
|
+
/**
|
|
4600
|
+
* Get a human-readable name for an image format identifier.
|
|
4601
|
+
*
|
|
4602
|
+
* @param format The format identifier string.
|
|
4603
|
+
* @returns A human-readable format name.
|
|
4604
|
+
*/
|
|
4605
|
+
declare function getImageFormatName(format: string): string;
|
|
4606
|
+
/**
|
|
4607
|
+
* Get the list of all supported image formats for embedding.
|
|
4608
|
+
*
|
|
4609
|
+
* @returns An array of format identifier strings.
|
|
4610
|
+
*/
|
|
4611
|
+
declare function getSupportedFormats(): string[];
|
|
4612
|
+
//#endregion
|
|
4613
|
+
//#region src/assets/image/webpOptimize.d.ts
|
|
4614
|
+
/**
|
|
4615
|
+
* @module assets/image/webpOptimize
|
|
4616
|
+
*
|
|
4617
|
+
* WebP optimization and conversion utilities.
|
|
4618
|
+
*
|
|
4619
|
+
* Since WebP cannot be embedded directly in PDF, these utilities
|
|
4620
|
+
* convert decoded WebP pixel data to JPEG or PNG format for embedding.
|
|
4621
|
+
*
|
|
4622
|
+
* - `recompressWebP()` — re-encode decoded pixels as JPEG
|
|
4623
|
+
* - `webpToJpeg()` — decode WebP then encode as JPEG (convenience)
|
|
4624
|
+
* - `webpToPng()` — decode WebP then encode as PNG (lossless, convenience)
|
|
4625
|
+
*
|
|
4626
|
+
* No Buffer — uses Uint8Array exclusively.
|
|
4627
|
+
* No fs — no file system access.
|
|
4628
|
+
* No require() — ESM import only.
|
|
4629
|
+
*/
|
|
4630
|
+
/**
|
|
4631
|
+
* Encode RGB/RGBA pixels as a PNG file.
|
|
4632
|
+
* @internal
|
|
4633
|
+
*/
|
|
4634
|
+
declare function encodePngFromPixels(pixels: Uint8Array, width: number, height: number, channels: number): Uint8Array;
|
|
4635
|
+
/**
|
|
4636
|
+
* Re-encode decoded WebP pixels as JPEG data for PDF embedding.
|
|
4637
|
+
*
|
|
4638
|
+
* WebP cannot be embedded directly in PDF files. This function takes
|
|
4639
|
+
* decoded pixel data (from a WebP decoder) and produces JPEG bytes
|
|
4640
|
+
* suitable for PDF embedding with /DCTDecode filter.
|
|
4641
|
+
*
|
|
4642
|
+
* @param pixels Decoded pixel data (RGB or RGBA, row-major).
|
|
4643
|
+
* @param width Image width in pixels.
|
|
4644
|
+
* @param height Image height in pixels.
|
|
4645
|
+
* @param quality JPEG quality (1-100). Default: 85.
|
|
4646
|
+
* @returns JPEG-encoded bytes.
|
|
4647
|
+
*/
|
|
4648
|
+
declare function recompressWebP(pixels: Uint8Array, width: number, height: number, quality?: number | undefined): Uint8Array;
|
|
4649
|
+
/**
|
|
4650
|
+
* Decode a WebP file and re-encode as JPEG.
|
|
4651
|
+
*
|
|
4652
|
+
* Convenience function that combines WebP decoding with JPEG encoding.
|
|
4653
|
+
* Imports the WebP decoder dynamically from the webpDecode module
|
|
4654
|
+
* (provided by v0.24.0).
|
|
4655
|
+
*
|
|
4656
|
+
* @param webpData Raw WebP file bytes.
|
|
4657
|
+
* @param quality JPEG quality (1-100). Default: 85.
|
|
4658
|
+
* @returns JPEG-encoded bytes.
|
|
4659
|
+
*/
|
|
4660
|
+
declare function webpToJpeg(webpData: Uint8Array, quality?: number | undefined): Uint8Array;
|
|
4661
|
+
/**
|
|
4662
|
+
* Decode a WebP file and re-encode as PNG.
|
|
4663
|
+
*
|
|
4664
|
+
* Convenience function that combines WebP decoding with PNG encoding.
|
|
4665
|
+
* Produces lossless output suitable for images requiring transparency
|
|
4666
|
+
* or exact color reproduction.
|
|
4667
|
+
*
|
|
4668
|
+
* @param webpData Raw WebP file bytes.
|
|
4669
|
+
* @returns PNG-encoded bytes.
|
|
4670
|
+
*/
|
|
4671
|
+
declare function webpToPng(webpData: Uint8Array): Uint8Array;
|
|
4672
|
+
//#endregion
|
|
4673
|
+
//#region src/assets/image/tiffDirectEmbed.d.ts
|
|
4674
|
+
/**
|
|
4675
|
+
* @module assets/image/tiffDirectEmbed
|
|
4676
|
+
*
|
|
4677
|
+
* Direct TIFF-to-PDF strip/tile mapping for efficient embedding.
|
|
4678
|
+
*
|
|
4679
|
+
* For certain TIFF compression types, the image data can be mapped
|
|
4680
|
+
* directly into a PDF image XObject without a full decode-re-encode
|
|
4681
|
+
* cycle:
|
|
3527
4682
|
*
|
|
3528
|
-
*
|
|
3529
|
-
*
|
|
3530
|
-
*
|
|
4683
|
+
* - **Uncompressed TIFF**: Raw pixel data is used directly with no filter.
|
|
4684
|
+
* - **Deflate-compressed TIFF**: Strips/tiles can be passed through as
|
|
4685
|
+
* FlateDecode streams.
|
|
4686
|
+
* - **JPEG-in-TIFF**: The embedded JPEG data is extracted and used
|
|
4687
|
+
* directly as a DCTDecode stream.
|
|
3531
4688
|
*
|
|
3532
|
-
* This
|
|
3533
|
-
*
|
|
3534
|
-
* be skipped during recompression.
|
|
4689
|
+
* This avoids the overhead of decompressing and recompressing image data,
|
|
4690
|
+
* resulting in faster processing and no quality loss.
|
|
3535
4691
|
*
|
|
3536
4692
|
* No Buffer — uses Uint8Array exclusively.
|
|
4693
|
+
* No fs — no file system access.
|
|
4694
|
+
* No require() — ESM import only.
|
|
3537
4695
|
*/
|
|
3538
|
-
/**
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
/**
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
4696
|
+
/**
|
|
4697
|
+
* Options for direct TIFF embedding.
|
|
4698
|
+
*/
|
|
4699
|
+
interface DirectEmbedOptions {
|
|
4700
|
+
/** Page index for multi-page TIFFs (0-based). Default: 0. */
|
|
4701
|
+
page?: number | undefined;
|
|
4702
|
+
}
|
|
4703
|
+
/**
|
|
4704
|
+
* Result of a direct TIFF embedding operation.
|
|
4705
|
+
*/
|
|
4706
|
+
interface DirectEmbedResult {
|
|
3546
4707
|
/** Image width in pixels. */
|
|
3547
4708
|
readonly width: number;
|
|
3548
4709
|
/** Image height in pixels. */
|
|
3549
4710
|
readonly height: number;
|
|
3550
|
-
/**
|
|
3551
|
-
readonly
|
|
3552
|
-
/**
|
|
4711
|
+
/** The image data for the PDF stream. */
|
|
4712
|
+
readonly data: Uint8Array;
|
|
4713
|
+
/** PDF color space name (e.g. 'DeviceRGB', 'DeviceGray', 'DeviceCMYK'). */
|
|
4714
|
+
readonly colorSpace: string;
|
|
4715
|
+
/** Bits per component (1, 2, 4, 8, or 16). */
|
|
3553
4716
|
readonly bitsPerComponent: number;
|
|
4717
|
+
/** PDF filter to use, if any (e.g. 'FlateDecode', 'DCTDecode'). */
|
|
4718
|
+
readonly filter?: string | undefined;
|
|
3554
4719
|
}
|
|
3555
4720
|
/**
|
|
3556
|
-
*
|
|
3557
|
-
*
|
|
3558
|
-
*
|
|
3559
|
-
* @param data - Raw JPEG bytes (must start with FF D8).
|
|
3560
|
-
* @returns Marker info, or `undefined` if not valid JPEG.
|
|
4721
|
+
* Check whether a TIFF file can be directly embedded in PDF without
|
|
4722
|
+
* a full decode-re-encode cycle.
|
|
3561
4723
|
*
|
|
3562
|
-
*
|
|
3563
|
-
*
|
|
3564
|
-
*
|
|
4724
|
+
* Direct embedding is supported for:
|
|
4725
|
+
* - Uncompressed TIFFs (compression = 1)
|
|
4726
|
+
* - Deflate-compressed TIFFs (compression = 8 or 32946)
|
|
4727
|
+
* - JPEG-in-TIFF (compression = 7 or 6)
|
|
3565
4728
|
*
|
|
3566
|
-
*
|
|
3567
|
-
* if
|
|
3568
|
-
* console.log('Cannot re-encode: arithmetic-coded JPEG');
|
|
3569
|
-
* }
|
|
3570
|
-
* ```
|
|
4729
|
+
* @param data Raw TIFF file bytes.
|
|
4730
|
+
* @returns `true` if the TIFF can be directly embedded.
|
|
3571
4731
|
*/
|
|
3572
|
-
declare function
|
|
3573
|
-
//#endregion
|
|
3574
|
-
//#region src/assets/image/imageMetadata.d.ts
|
|
4732
|
+
declare function canDirectEmbed(data: Uint8Array): boolean;
|
|
3575
4733
|
/**
|
|
3576
|
-
*
|
|
3577
|
-
*
|
|
3578
|
-
* JPEG EXIF metadata extraction and re-injection.
|
|
3579
|
-
*
|
|
3580
|
-
* When images are recompressed (e.g. via `encodeJpegWasm()`), the encoder
|
|
3581
|
-
* produces a minimal JPEG containing only SOI + DQT + SOF + DHT + SOS.
|
|
3582
|
-
* All APP markers — including JFIF (APP0) and EXIF (APP1) — are stripped.
|
|
4734
|
+
* Directly embed a TIFF image in a PDF image XObject.
|
|
3583
4735
|
*
|
|
3584
|
-
*
|
|
3585
|
-
*
|
|
3586
|
-
* them into the recompressed output so that downstream consumers (PDF
|
|
3587
|
-
* viewers, print RIPs, image editors) see correct metadata.
|
|
4736
|
+
* For supported compression types, this avoids the decode-re-encode
|
|
4737
|
+
* cycle by mapping TIFF strips/tiles directly to PDF stream data:
|
|
3588
4738
|
*
|
|
3589
|
-
*
|
|
3590
|
-
*
|
|
4739
|
+
* - **Uncompressed**: Raw pixel data used with no filter.
|
|
4740
|
+
* - **Deflate**: Compressed data passed through as FlateDecode.
|
|
4741
|
+
* - **JPEG-in-TIFF**: JPEG data extracted and used as DCTDecode.
|
|
3591
4742
|
*
|
|
3592
|
-
*
|
|
4743
|
+
* @param data Raw TIFF file bytes.
|
|
4744
|
+
* @param options Optional settings (page index for multi-page TIFFs).
|
|
4745
|
+
* @returns The embedding result with all data needed for a PDF image XObject.
|
|
4746
|
+
* @throws If the TIFF format does not support direct embedding.
|
|
3593
4747
|
*/
|
|
4748
|
+
declare function embedTiffDirect(data: Uint8Array, options?: DirectEmbedOptions | undefined): DirectEmbedResult;
|
|
4749
|
+
//#endregion
|
|
4750
|
+
//#region src/assets/image/webpDecode.d.ts
|
|
3594
4751
|
/**
|
|
3595
|
-
*
|
|
4752
|
+
* @module assets/image/webpDecode
|
|
4753
|
+
*
|
|
4754
|
+
* WebP image decoder — pure TypeScript, no WASM, no Buffer.
|
|
4755
|
+
*
|
|
4756
|
+
* Supports:
|
|
4757
|
+
* - VP8 (lossy) bitstream decoding with macroblock processing
|
|
4758
|
+
* - VP8L (lossless) bitstream decoding with Huffman coding, LZ77, color cache, spatial prediction
|
|
4759
|
+
* - ALPH chunk (alpha channel) with filtering and compression
|
|
4760
|
+
* - RIFF/WebP container parsing
|
|
4761
|
+
*
|
|
4762
|
+
* Magic bytes: 52 49 46 46 (RIFF) + offset 8-11: 57 45 42 50 (WEBP)
|
|
3596
4763
|
*/
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
4764
|
+
/** Decoded WebP image data. */
|
|
4765
|
+
interface WebPImage {
|
|
4766
|
+
/** Image width in pixels. */
|
|
4767
|
+
readonly width: number;
|
|
4768
|
+
/** Image height in pixels. */
|
|
4769
|
+
readonly height: number;
|
|
4770
|
+
/** Raw pixel data (RGB or RGBA). */
|
|
4771
|
+
readonly pixels: Uint8Array;
|
|
4772
|
+
/** Number of channels (3 for RGB, 4 for RGBA). */
|
|
4773
|
+
readonly channels: 3 | 4;
|
|
4774
|
+
/** Whether the image has an alpha channel. */
|
|
4775
|
+
readonly hasAlpha: boolean;
|
|
3608
4776
|
}
|
|
4777
|
+
/** Check if data is a WebP file by examining RIFF + WEBP magic bytes. */
|
|
4778
|
+
declare function isWebP(data: Uint8Array): boolean;
|
|
4779
|
+
/** Check if a WebP file contains a VP8L (lossless) bitstream. */
|
|
4780
|
+
declare function isWebPLossless(data: Uint8Array): boolean;
|
|
3609
4781
|
/**
|
|
3610
|
-
*
|
|
4782
|
+
* Decode a WebP image to raw pixel data.
|
|
3611
4783
|
*
|
|
3612
|
-
*
|
|
3613
|
-
*
|
|
3614
|
-
* collects all APP marker segments as raw bytes (excluding APP2/ICC, which
|
|
3615
|
-
* is handled separately by `iccProfile.ts`).
|
|
4784
|
+
* Supports VP8 (lossy), VP8L (lossless), and VP8+ALPH (lossy with alpha).
|
|
4785
|
+
* Auto-detects the format from chunk headers.
|
|
3616
4786
|
*
|
|
3617
|
-
*
|
|
4787
|
+
* @param data Raw WebP file bytes.
|
|
4788
|
+
* @returns Decoded image with width, height, and pixel data.
|
|
4789
|
+
*/
|
|
4790
|
+
declare function decodeWebP(data: Uint8Array): WebPImage;
|
|
4791
|
+
//#endregion
|
|
4792
|
+
//#region src/assets/image/tiffDecode.d.ts
|
|
4793
|
+
/**
|
|
4794
|
+
* @module assets/image/tiffDecode
|
|
3618
4795
|
*
|
|
3619
|
-
*
|
|
3620
|
-
* @returns Extracted metadata with collected APP marker segments.
|
|
4796
|
+
* TIFF image decoder — pure TypeScript, no WASM, no Buffer.
|
|
3621
4797
|
*
|
|
3622
|
-
*
|
|
3623
|
-
*
|
|
3624
|
-
*
|
|
4798
|
+
* Supports:
|
|
4799
|
+
* - IFD (Image File Directory) parsing with byte order detection
|
|
4800
|
+
* - Strip-based and tile-based image data extraction
|
|
4801
|
+
* - Compressions: None (1), LZW (5), JPEG-in-TIFF (6/7), Deflate (8), PackBits (32773)
|
|
4802
|
+
* - BitsPerSample: 1, 4, 8, 16
|
|
4803
|
+
* - SamplesPerPixel: 1, 3, 4
|
|
4804
|
+
* - PhotometricInterpretation: 0 (WhiteIsZero), 1 (BlackIsZero), 2 (RGB)
|
|
4805
|
+
* - Multi-page TIFF support via IFD chain
|
|
3625
4806
|
*
|
|
3626
|
-
*
|
|
3627
|
-
* console.log(`Orientation: ${metadata.orientation}`);
|
|
3628
|
-
* console.log(`DPI: ${metadata.dpiX} x ${metadata.dpiY}`);
|
|
3629
|
-
* console.log(`Copyright: ${metadata.copyright}`);
|
|
3630
|
-
* ```
|
|
4807
|
+
* Magic bytes: 49 49 (II, little-endian) or 4D 4D (MM, big-endian) + 42 (0x002A)
|
|
3631
4808
|
*/
|
|
3632
|
-
|
|
4809
|
+
/** Decoded TIFF image data. */
|
|
4810
|
+
interface TiffImage {
|
|
4811
|
+
/** Image width in pixels. */
|
|
4812
|
+
readonly width: number;
|
|
4813
|
+
/** Image height in pixels. */
|
|
4814
|
+
readonly height: number;
|
|
4815
|
+
/** Raw pixel data (normalized to 8-bit per channel). */
|
|
4816
|
+
readonly pixels: Uint8Array;
|
|
4817
|
+
/** Number of channels. */
|
|
4818
|
+
readonly channels: 1 | 3 | 4;
|
|
4819
|
+
/** Original bits per sample. */
|
|
4820
|
+
readonly bitsPerSample: number;
|
|
4821
|
+
}
|
|
4822
|
+
/** Options for TIFF decoding. */
|
|
4823
|
+
interface TiffDecodeOptions {
|
|
4824
|
+
/** Page index for multi-page TIFFs (0-based). Default: 0. */
|
|
4825
|
+
page?: number | undefined;
|
|
4826
|
+
}
|
|
4827
|
+
/** A single IFD entry (tag). */
|
|
4828
|
+
interface IfdEntry {
|
|
4829
|
+
/** Tag ID (e.g., 256 = ImageWidth). */
|
|
4830
|
+
readonly tag: number;
|
|
4831
|
+
/** Data type (1=BYTE, 2=ASCII, 3=SHORT, 4=LONG, 5=RATIONAL, etc.). */
|
|
4832
|
+
readonly type: number;
|
|
4833
|
+
/** Number of values. */
|
|
4834
|
+
readonly count: number;
|
|
4835
|
+
/** The value(s) or offset to value data. */
|
|
4836
|
+
readonly values: number[];
|
|
4837
|
+
}
|
|
4838
|
+
/** Check if data is a TIFF file by examining the byte order marker and magic number. */
|
|
4839
|
+
declare function isTiff(data: Uint8Array): boolean;
|
|
3633
4840
|
/**
|
|
3634
|
-
*
|
|
4841
|
+
* Parse a single IFD from TIFF data.
|
|
3635
4842
|
*
|
|
3636
|
-
*
|
|
3637
|
-
*
|
|
3638
|
-
*
|
|
4843
|
+
* @param data Raw TIFF bytes.
|
|
4844
|
+
* @param offset Byte offset to the IFD.
|
|
4845
|
+
* @param littleEndian Whether the TIFF uses little-endian byte order.
|
|
4846
|
+
* @returns Array of IFD entries.
|
|
4847
|
+
*/
|
|
4848
|
+
declare function parseTiffIfd(data: Uint8Array, offset: number, littleEndian: boolean): IfdEntry[];
|
|
4849
|
+
/**
|
|
4850
|
+
* Get the number of pages in a multi-page TIFF.
|
|
3639
4851
|
*
|
|
3640
|
-
* @param
|
|
3641
|
-
* @
|
|
3642
|
-
|
|
4852
|
+
* @param data Raw TIFF bytes.
|
|
4853
|
+
* @returns Number of IFDs (pages).
|
|
4854
|
+
*/
|
|
4855
|
+
declare function getTiffPageCount(data: Uint8Array): number;
|
|
4856
|
+
/**
|
|
4857
|
+
* Decode a specific page from a multi-page TIFF.
|
|
3643
4858
|
*
|
|
3644
|
-
* @
|
|
3645
|
-
*
|
|
3646
|
-
*
|
|
4859
|
+
* @param data Raw TIFF bytes.
|
|
4860
|
+
* @param pageIndex 0-based page index.
|
|
4861
|
+
* @returns Decoded image.
|
|
4862
|
+
*/
|
|
4863
|
+
declare function decodeTiffPage(data: Uint8Array, pageIndex: number): TiffImage;
|
|
4864
|
+
/**
|
|
4865
|
+
* Decode all pages from a multi-page TIFF.
|
|
3647
4866
|
*
|
|
3648
|
-
*
|
|
3649
|
-
*
|
|
4867
|
+
* @param data Raw TIFF bytes.
|
|
4868
|
+
* @returns Array of decoded images.
|
|
4869
|
+
*/
|
|
4870
|
+
declare function decodeTiffAll(data: Uint8Array): TiffImage[];
|
|
4871
|
+
/**
|
|
4872
|
+
* Decode a TIFF image.
|
|
3650
4873
|
*
|
|
3651
|
-
*
|
|
3652
|
-
*
|
|
3653
|
-
*
|
|
3654
|
-
* ```
|
|
4874
|
+
* @param data Raw TIFF bytes.
|
|
4875
|
+
* @param options Decode options (page selection).
|
|
4876
|
+
* @returns Decoded image data.
|
|
3655
4877
|
*/
|
|
3656
|
-
declare function
|
|
4878
|
+
declare function decodeTiff(data: Uint8Array, options?: TiffDecodeOptions | undefined): TiffImage;
|
|
3657
4879
|
//#endregion
|
|
3658
4880
|
//#region src/wasm/loader.d.ts
|
|
3659
4881
|
/**
|
|
@@ -4847,8 +6069,389 @@ declare class ExceededMaxLengthError extends Error {
|
|
|
4847
6069
|
readonly name = "ExceededMaxLengthError";
|
|
4848
6070
|
constructor(textLength: number, maxLength: number, fieldName: string, options?: ErrorOptions);
|
|
4849
6071
|
}
|
|
6072
|
+
//#endregion
|
|
6073
|
+
//#region src/form/formFlatten.d.ts
|
|
6074
|
+
/**
|
|
6075
|
+
* Options for form flattening operations.
|
|
6076
|
+
*/
|
|
6077
|
+
interface FlattenOptions {
|
|
6078
|
+
/**
|
|
6079
|
+
* If `true`, read-only fields are skipped and left interactive.
|
|
6080
|
+
* All other fields are flattened normally.
|
|
6081
|
+
*
|
|
6082
|
+
* Default: `false` (all fields are flattened, including read-only ones).
|
|
6083
|
+
*/
|
|
6084
|
+
preserveReadOnly?: boolean | undefined;
|
|
6085
|
+
}
|
|
6086
|
+
/**
|
|
6087
|
+
* Flatten ALL form fields into static page content.
|
|
6088
|
+
*
|
|
6089
|
+
* For each field in the document's AcroForm:
|
|
6090
|
+
* 1. Generate / retrieve the field's appearance stream
|
|
6091
|
+
* 2. Embed the appearance as a Form XObject in the page's content stream
|
|
6092
|
+
* 3. Remove the widget annotation from the page
|
|
6093
|
+
* 4. Remove the field from the AcroForm
|
|
6094
|
+
*
|
|
6095
|
+
* After all fields are processed, the /AcroForm dictionary is cleared.
|
|
6096
|
+
*
|
|
6097
|
+
* @param form The document's PdfForm.
|
|
6098
|
+
* @param options Optional flatten options.
|
|
6099
|
+
* @returns An object describing the flatten operations performed, suitable
|
|
6100
|
+
* for the caller to apply to page content streams and resources.
|
|
6101
|
+
*/
|
|
6102
|
+
declare function flattenForm(form: PdfForm, options?: FlattenOptions): FlattenFormResult;
|
|
6103
|
+
/**
|
|
6104
|
+
* Flatten a SINGLE field by name.
|
|
6105
|
+
*
|
|
6106
|
+
* Locates the field in the form, merges its appearance into the page
|
|
6107
|
+
* content, removes the widget annotation, and removes the field from
|
|
6108
|
+
* the AcroForm's /Fields array. Other fields remain interactive.
|
|
6109
|
+
*
|
|
6110
|
+
* @param form The document's PdfForm.
|
|
6111
|
+
* @param fieldName The name of the field to flatten (partial or fully-qualified).
|
|
6112
|
+
* @param options Optional flatten options.
|
|
6113
|
+
* @returns An object describing the flatten operations performed.
|
|
6114
|
+
* @throws If the field is not found.
|
|
6115
|
+
*/
|
|
6116
|
+
declare function flattenField(form: PdfForm, fieldName: string, options?: FlattenOptions): FlattenFormResult;
|
|
6117
|
+
/**
|
|
6118
|
+
* Flatten specific fields by name.
|
|
6119
|
+
*
|
|
6120
|
+
* @param form The document's PdfForm.
|
|
6121
|
+
* @param fieldNames Array of field names to flatten.
|
|
6122
|
+
* @param options Optional flatten options.
|
|
6123
|
+
* @returns An object describing the flatten operations performed.
|
|
6124
|
+
* @throws If any field name is not found.
|
|
6125
|
+
*/
|
|
6126
|
+
declare function flattenFields(form: PdfForm, fieldNames: string[], options?: FlattenOptions): FlattenFormResult;
|
|
6127
|
+
/**
|
|
6128
|
+
* Result of a form flatten operation.
|
|
6129
|
+
*
|
|
6130
|
+
* Contains the content stream operators and XObject resources that
|
|
6131
|
+
* must be applied to the page(s) to complete the flattening.
|
|
6132
|
+
*/
|
|
6133
|
+
interface FlattenFormResult {
|
|
6134
|
+
/** Content stream operators to append to the page. */
|
|
6135
|
+
contentOps: string;
|
|
6136
|
+
/** XObject name-to-stream pairs to add to page resources. */
|
|
6137
|
+
xObjects: Array<{
|
|
6138
|
+
name: string;
|
|
6139
|
+
stream: PdfStream;
|
|
6140
|
+
}>;
|
|
6141
|
+
/** Names of fields that were flattened. */
|
|
6142
|
+
flattenedFields: string[];
|
|
6143
|
+
/** Names of fields that were skipped (e.g. read-only with preserveReadOnly). */
|
|
6144
|
+
skippedFields: string[];
|
|
6145
|
+
/** Whether the AcroForm was fully removed (all fields flattened). */
|
|
6146
|
+
acroFormRemoved: boolean;
|
|
6147
|
+
}
|
|
6148
|
+
//#endregion
|
|
6149
|
+
//#region src/core/outlines.d.ts
|
|
6150
|
+
/**
|
|
6151
|
+
* An opaque handle returned by {@link addBookmark} that identifies
|
|
6152
|
+
* a bookmark in the outline tree. Used as a `parent` to create
|
|
6153
|
+
* nested bookmarks, or passed to {@link removeBookmark} to delete
|
|
6154
|
+
* an entry.
|
|
6155
|
+
*/
|
|
6156
|
+
interface BookmarkRef {
|
|
6157
|
+
/** @internal The underlying outline item. */
|
|
6158
|
+
readonly _item: PdfOutlineItem;
|
|
6159
|
+
}
|
|
6160
|
+
/**
|
|
6161
|
+
* Represents a single node in the bookmark tree, as returned by
|
|
6162
|
+
* {@link getBookmarks}.
|
|
6163
|
+
*/
|
|
6164
|
+
interface BookmarkNode {
|
|
6165
|
+
/** The displayed bookmark title. */
|
|
6166
|
+
readonly title: string;
|
|
6167
|
+
/** Zero-based page index this bookmark points to. */
|
|
6168
|
+
readonly pageIndex: number;
|
|
6169
|
+
/** Vertical position on the target page (if set). */
|
|
6170
|
+
readonly y?: number | undefined;
|
|
6171
|
+
/** Whether the title is bold. */
|
|
6172
|
+
readonly bold?: boolean | undefined;
|
|
6173
|
+
/** Whether the title is italic. */
|
|
6174
|
+
readonly italic?: boolean | undefined;
|
|
6175
|
+
/** Colour of the bookmark title (RGB, 0-1 range). */
|
|
6176
|
+
readonly color?: {
|
|
6177
|
+
readonly r: number;
|
|
6178
|
+
readonly g: number;
|
|
6179
|
+
readonly b: number;
|
|
6180
|
+
} | undefined;
|
|
6181
|
+
/** Child bookmarks. */
|
|
6182
|
+
readonly children: readonly BookmarkNode[];
|
|
6183
|
+
/** The handle for this bookmark node. */
|
|
6184
|
+
readonly ref: BookmarkRef;
|
|
6185
|
+
}
|
|
6186
|
+
/**
|
|
6187
|
+
* Options for {@link addBookmark}.
|
|
6188
|
+
*/
|
|
6189
|
+
interface AddBookmarkOptions {
|
|
6190
|
+
/** The display title for the bookmark. */
|
|
6191
|
+
title: string;
|
|
6192
|
+
/** Zero-based page index to navigate to. */
|
|
6193
|
+
pageIndex: number;
|
|
6194
|
+
/** Parent bookmark for nesting. Omit for a top-level bookmark. */
|
|
6195
|
+
parent?: BookmarkRef | undefined;
|
|
6196
|
+
/** Vertical position on the page (top coordinate for FitH). */
|
|
6197
|
+
y?: number | undefined;
|
|
6198
|
+
/** Whether the title text is bold. */
|
|
6199
|
+
bold?: boolean | undefined;
|
|
6200
|
+
/** Whether the title text is italic. */
|
|
6201
|
+
italic?: boolean | undefined;
|
|
6202
|
+
/** Colour of the bookmark title (RGB, 0-1 range). */
|
|
6203
|
+
color?: {
|
|
6204
|
+
r: number;
|
|
6205
|
+
g: number;
|
|
6206
|
+
b: number;
|
|
6207
|
+
} | undefined;
|
|
6208
|
+
/**
|
|
6209
|
+
* Whether the bookmark's children are initially expanded.
|
|
6210
|
+
* Default: `true`.
|
|
6211
|
+
*/
|
|
6212
|
+
isOpen?: boolean | undefined;
|
|
6213
|
+
}
|
|
6214
|
+
/**
|
|
6215
|
+
* Add a bookmark entry to the document's outline tree.
|
|
6216
|
+
*
|
|
6217
|
+
* @param doc The document to add the bookmark to.
|
|
6218
|
+
* @param options Bookmark configuration (title, page, nesting, style).
|
|
6219
|
+
* @returns A {@link BookmarkRef} identifying the new bookmark.
|
|
6220
|
+
*/
|
|
6221
|
+
declare function addBookmark(doc: PdfDocument, options: AddBookmarkOptions): BookmarkRef;
|
|
6222
|
+
/**
|
|
6223
|
+
* Return the bookmark tree for the document.
|
|
6224
|
+
*
|
|
6225
|
+
* Returns an array of top-level {@link BookmarkNode} objects, each
|
|
6226
|
+
* with a `children` array for nested bookmarks.
|
|
6227
|
+
*
|
|
6228
|
+
* @param doc The document to read bookmarks from.
|
|
6229
|
+
* @returns The bookmark tree.
|
|
6230
|
+
*/
|
|
6231
|
+
declare function getBookmarks(doc: PdfDocument): readonly BookmarkNode[];
|
|
6232
|
+
/**
|
|
6233
|
+
* Remove a specific bookmark from the document.
|
|
6234
|
+
*
|
|
6235
|
+
* If the bookmark has children, they are also removed.
|
|
6236
|
+
*
|
|
6237
|
+
* @param doc The document to modify.
|
|
6238
|
+
* @param ref The handle of the bookmark to remove.
|
|
6239
|
+
* @throws If the bookmark is not found in the tree.
|
|
6240
|
+
*/
|
|
6241
|
+
declare function removeBookmark(doc: PdfDocument, ref: BookmarkRef): void;
|
|
6242
|
+
/**
|
|
6243
|
+
* Remove all bookmarks from the document.
|
|
6244
|
+
*
|
|
6245
|
+
* @param doc The document to clear bookmarks from.
|
|
6246
|
+
*/
|
|
6247
|
+
declare function removeAllBookmarks(doc: PdfDocument): void;
|
|
6248
|
+
//#endregion
|
|
6249
|
+
//#region src/core/pageLabels.d.ts
|
|
6250
|
+
/**
|
|
6251
|
+
* Numbering style for page labels.
|
|
6252
|
+
*
|
|
6253
|
+
* | Value | PDF /S | Description | Example |
|
|
6254
|
+
* |------------|--------|------------------------------|----------------|
|
|
6255
|
+
* | `decimal` | `/D` | Arabic numerals | 1, 2, 3, … |
|
|
6256
|
+
* | `roman` | `/r` | Lowercase Roman numerals | i, ii, iii, … |
|
|
6257
|
+
* | `Roman` | `/R` | Uppercase Roman numerals | I, II, III, … |
|
|
6258
|
+
* | `alpha` | `/a` | Lowercase alphabetic | a, b, c, … |
|
|
6259
|
+
* | `Alpha` | `/A` | Uppercase alphabetic | A, B, C, … |
|
|
6260
|
+
*/
|
|
6261
|
+
type PageLabelStyle = 'decimal' | 'roman' | 'Roman' | 'alpha' | 'Alpha';
|
|
6262
|
+
/**
|
|
6263
|
+
* Defines a contiguous range of pages that share a labelling scheme.
|
|
6264
|
+
*
|
|
6265
|
+
* Each range starts at `startPage` (zero-based page index) and extends
|
|
6266
|
+
* to the next range's `startPage` (or the end of the document).
|
|
6267
|
+
*/
|
|
6268
|
+
interface PageLabelRange {
|
|
6269
|
+
/**
|
|
6270
|
+
* Zero-based index of the first page this label range applies to.
|
|
6271
|
+
*/
|
|
6272
|
+
startPage: number;
|
|
6273
|
+
/**
|
|
6274
|
+
* The numbering style for this range.
|
|
6275
|
+
*/
|
|
6276
|
+
style: PageLabelStyle;
|
|
6277
|
+
/**
|
|
6278
|
+
* An optional prefix string prepended to each page label.
|
|
6279
|
+
* For example, `"A-"` produces labels like "A-1", "A-2", etc.
|
|
6280
|
+
*/
|
|
6281
|
+
prefix?: string | undefined;
|
|
6282
|
+
/**
|
|
6283
|
+
* The numeric value of the first page label in this range.
|
|
6284
|
+
* Defaults to `1`.
|
|
6285
|
+
*
|
|
6286
|
+
* For example, `{ startPage: 4, style: 'decimal', start: 5 }` means
|
|
6287
|
+
* page index 4 is labelled "5", page index 5 is labelled "6", etc.
|
|
6288
|
+
*/
|
|
6289
|
+
start?: number | undefined;
|
|
6290
|
+
}
|
|
6291
|
+
/**
|
|
6292
|
+
* Set the page label ranges for the document.
|
|
6293
|
+
*
|
|
6294
|
+
* Each entry in the `labels` array defines a contiguous range of pages
|
|
6295
|
+
* that share a numbering style. Ranges must be sorted by `startPage`
|
|
6296
|
+
* in ascending order.
|
|
6297
|
+
*
|
|
6298
|
+
* @param doc The document to set page labels on.
|
|
6299
|
+
* @param labels An array of label range definitions.
|
|
6300
|
+
* @throws If `labels` is empty or ranges are not sorted.
|
|
6301
|
+
*/
|
|
6302
|
+
declare function setPageLabels(doc: PdfDocument, labels: readonly PageLabelRange[]): void;
|
|
6303
|
+
/**
|
|
6304
|
+
* Get the current page label ranges for the document.
|
|
6305
|
+
*
|
|
6306
|
+
* Returns `undefined` if no page labels have been set.
|
|
6307
|
+
*
|
|
6308
|
+
* @param doc The document to read page labels from.
|
|
6309
|
+
* @returns The page label ranges, or `undefined`.
|
|
6310
|
+
*/
|
|
6311
|
+
declare function getPageLabels(doc: PdfDocument): readonly PageLabelRange[] | undefined;
|
|
6312
|
+
/**
|
|
6313
|
+
* Remove all page labels from the document.
|
|
6314
|
+
*
|
|
6315
|
+
* @param doc The document to clear page labels from.
|
|
6316
|
+
*/
|
|
6317
|
+
declare function removePageLabels(doc: PdfDocument): void;
|
|
6318
|
+
//#endregion
|
|
6319
|
+
//#region src/batch/batchProcessor.d.ts
|
|
6320
|
+
/** Callback invoked as batch items complete. */
|
|
6321
|
+
type BatchProgressCallback = (done: number, total: number) => void;
|
|
6322
|
+
/** Options for batch processing. */
|
|
6323
|
+
interface BatchOptions {
|
|
6324
|
+
/**
|
|
6325
|
+
* Maximum number of PDFs processed concurrently.
|
|
6326
|
+
* Defaults to 4 in Node (worker threads), or `files.length` elsewhere.
|
|
6327
|
+
*/
|
|
6328
|
+
concurrency?: number | undefined;
|
|
6329
|
+
/** Progress callback invoked after each file completes. */
|
|
6330
|
+
onProgress?: BatchProgressCallback | undefined;
|
|
6331
|
+
}
|
|
6332
|
+
/** Result of a batch operation. */
|
|
6333
|
+
interface BatchResult {
|
|
6334
|
+
/** Output PDF bytes for each input file (same order). */
|
|
6335
|
+
outputs: Uint8Array[];
|
|
6336
|
+
/** Number of files that were processed successfully. */
|
|
6337
|
+
successCount: number;
|
|
6338
|
+
/** Indices of files that failed, mapped to their error. */
|
|
6339
|
+
errors: Map<number, Error>;
|
|
6340
|
+
}
|
|
6341
|
+
/**
|
|
6342
|
+
* Process multiple PDFs in parallel (or with bounded concurrency).
|
|
6343
|
+
*
|
|
6344
|
+
* Each input `Uint8Array` is loaded as a {@link PdfDocument}, the
|
|
6345
|
+
* caller-supplied `operation` is applied, and the resulting bytes
|
|
6346
|
+
* are collected.
|
|
6347
|
+
*
|
|
6348
|
+
* In Node.js, true parallelism is available via `worker_threads`
|
|
6349
|
+
* (though this implementation uses async concurrency for simplicity
|
|
6350
|
+
* and to avoid serialization overhead). In all runtimes the
|
|
6351
|
+
* concurrency limiter ensures memory pressure stays manageable.
|
|
6352
|
+
*
|
|
6353
|
+
* @param files Array of raw PDF bytes.
|
|
6354
|
+
* @param operation An async function that receives a loaded
|
|
6355
|
+
* {@link PdfDocument} and returns the processed
|
|
6356
|
+
* PDF as `Uint8Array`.
|
|
6357
|
+
* @param options Concurrency and progress options.
|
|
6358
|
+
* @returns A {@link BatchResult} with outputs, success
|
|
6359
|
+
* count, and any per-file errors.
|
|
6360
|
+
*/
|
|
6361
|
+
declare function processBatch(files: Uint8Array[], operation: (doc: PdfDocument) => Promise<Uint8Array>, options?: BatchOptions): Promise<BatchResult>;
|
|
6362
|
+
/**
|
|
6363
|
+
* Merge multiple PDFs in parallel chunks, then merge the chunks.
|
|
6364
|
+
*
|
|
6365
|
+
* For large collections this is significantly faster than sequential
|
|
6366
|
+
* merging because parsing and page-copying can overlap.
|
|
6367
|
+
*
|
|
6368
|
+
* @param files Array of raw PDF bytes to merge (in order).
|
|
6369
|
+
* @param options Concurrency and progress options.
|
|
6370
|
+
* @returns The merged PDF as `Uint8Array`.
|
|
6371
|
+
*/
|
|
6372
|
+
declare function batchMerge(files: Uint8Array[], options?: BatchOptions): Promise<Uint8Array>;
|
|
6373
|
+
/**
|
|
6374
|
+
* Flatten interactive form fields across many PDFs.
|
|
6375
|
+
*
|
|
6376
|
+
* Each PDF is loaded, its form is flattened (field values are burned
|
|
6377
|
+
* into page content), and the result is saved.
|
|
6378
|
+
*
|
|
6379
|
+
* @param files Array of raw PDF bytes.
|
|
6380
|
+
* @param options Concurrency and progress options.
|
|
6381
|
+
* @returns A {@link BatchResult} with flattened PDF outputs.
|
|
6382
|
+
*/
|
|
6383
|
+
declare function batchFlatten(files: Uint8Array[], options?: BatchOptions): Promise<BatchResult>;
|
|
6384
|
+
//#endregion
|
|
6385
|
+
//#region src/wasm/inlineWasm.d.ts
|
|
6386
|
+
/**
|
|
6387
|
+
* @module wasm/inlineWasm
|
|
6388
|
+
*
|
|
6389
|
+
* Provides runtime access to inline (base64-encoded) WASM module bytes.
|
|
6390
|
+
*
|
|
6391
|
+
* This module is the runtime companion to the build-time code generation
|
|
6392
|
+
* script `scripts/generate-inline-wasm.ts`. It imports the generated
|
|
6393
|
+
* constants from `inlineWasm.generated.ts` and exposes a single function,
|
|
6394
|
+
* {@link getInlineWasmBytes}, that decodes a module's base64 string into
|
|
6395
|
+
* a `Uint8Array` on demand.
|
|
6396
|
+
*
|
|
6397
|
+
* Design:
|
|
6398
|
+
* - The heavy lifting (reading WASM files, base64 encoding) happens at
|
|
6399
|
+
* **build time** via the code generation script.
|
|
6400
|
+
* - At **runtime**, only a single base64 decode is needed per module,
|
|
6401
|
+
* and the result is cached.
|
|
6402
|
+
* - This approach avoids shipping base64 strings in the default bundle.
|
|
6403
|
+
* The generated file is only imported when inline WASM is needed
|
|
6404
|
+
* (e.g., as a fallback when no WASM path is configured).
|
|
6405
|
+
*
|
|
6406
|
+
* @packageDocumentation
|
|
6407
|
+
*/
|
|
6408
|
+
/**
|
|
6409
|
+
* The set of all WASM module names supported by the library.
|
|
6410
|
+
*
|
|
6411
|
+
* These correspond to the crate directories under `src/wasm/`.
|
|
6412
|
+
*/
|
|
6413
|
+
declare const WASM_MODULE_NAMES: readonly ["libdeflate", "png", "ttf", "shaping", "jbig2", "jpeg"];
|
|
6414
|
+
/** Union type of all valid WASM module names. */
|
|
6415
|
+
type WasmModuleName = (typeof WASM_MODULE_NAMES)[number];
|
|
6416
|
+
/**
|
|
6417
|
+
* Retrieve the decoded WASM bytes for a given module name.
|
|
6418
|
+
*
|
|
6419
|
+
* On first call for a module, the base64 string from the generated file
|
|
6420
|
+
* is decoded into a `Uint8Array`. Subsequent calls return the cached
|
|
6421
|
+
* result.
|
|
6422
|
+
*
|
|
6423
|
+
* @param name The WASM module name (e.g., `'libdeflate'`, `'png'`).
|
|
6424
|
+
* @returns The decoded WASM binary as a `Uint8Array`.
|
|
6425
|
+
* @throws If the module name is unknown or the generated file does
|
|
6426
|
+
* not contain data for the requested module.
|
|
6427
|
+
*
|
|
6428
|
+
* @example
|
|
6429
|
+
* ```ts
|
|
6430
|
+
* const wasmBytes = getInlineWasmBytes('libdeflate');
|
|
6431
|
+
* const module = await WebAssembly.compile(wasmBytes);
|
|
6432
|
+
* ```
|
|
6433
|
+
*/
|
|
6434
|
+
declare function getInlineWasmBytes(name: string): Uint8Array;
|
|
6435
|
+
/**
|
|
6436
|
+
* Check whether a given module name is a valid WASM module name.
|
|
6437
|
+
*
|
|
6438
|
+
* @param name The name to check.
|
|
6439
|
+
* @returns `true` if the name is one of the known WASM modules.
|
|
6440
|
+
*/
|
|
6441
|
+
declare function isValidModuleName(name: string): name is WasmModuleName;
|
|
6442
|
+
/**
|
|
6443
|
+
* Check whether inline WASM data is available for a given module.
|
|
6444
|
+
*
|
|
6445
|
+
* Returns `true` if the generated file contains base64 data for the
|
|
6446
|
+
* requested module. Returns `false` if the generated file does not
|
|
6447
|
+
* exist or does not include the module.
|
|
6448
|
+
*
|
|
6449
|
+
* @param name The WASM module name.
|
|
6450
|
+
* @returns `true` if inline bytes can be retrieved for this module.
|
|
6451
|
+
*/
|
|
6452
|
+
declare function hasInlineWasmData(name: string): boolean;
|
|
4850
6453
|
declare namespace index_d_exports {
|
|
4851
|
-
export { AFRelationship, AccessibilityIssue, AnalysisReport, Angle, AnnotationFlags, AnnotationOptions, AnnotationType, AppearanceProviderFor, AssociatedFileOptions, AssociatedFileResult, BarcodeMatrix, BarcodeOptions, BarcodeReadResult, BatchOptimizeOptions, BlendMode, ButtonAppearanceOptions, ByteRangeResult, ByteWriter, CIDFontData, CIDSystemInfoData, CaretSymbol, CatalogOptions, CellContent, ChangeTracker, CheckboxAppearanceOptions, ChromaSubsampling, CmykColor, Code128Options, Code39Options, Color, ColorStop, CombedTextLayoutError, ComputeFontSizeOptions, ContentStreamOperator, CropBox, DataMatrixOptions, DataMatrixResult, DeduplicationReport, Degrees, DocumentMetadata, DocumentStructure, DownscaleOptions, DrawCircleOptions, DrawEllipseOptions, DrawImageOptions, DrawLineOptions, DrawPageOptions, DrawQrCodeOptions, DrawRectangleOptions, DrawSquareOptions, DrawSvgPathOptions, DrawTableOptions, DrawTextOptions, DropdownAppearanceOptions, BarcodeOptions as EanOptions, EmbedFontOptions, EmbedPageOptions, EmbeddedFile, EmbeddedFont, EmbeddedPdfPage, EncryptAlgorithm, EncryptDictValues, EncryptOptions, EncryptedPdfError, EnforcePdfAOptions, EnforcePdfAResult, EnforcementAction, ErrorCorrectionLevel, ExceededMaxLengthError, FieldAlreadyExistsError, FieldExistsAsNonTerminalError, FieldFlags, FieldType, FileAttachmentIcon, FontDescriptorData, FontEmbeddingResult, FontMetrics, FontNotEmbeddedError, FontRef, ForeignPageError, FreeTextAlignment, GradientFill, GrayscaleColor, IccProfile, ImageAlignment, ImageAnalysis, ImageDpi, ImageInfo, ImageOptimizeEntry, ImageOptimizeOptions, ImageRef, IncrementalSaveResult, InitWasmOptions, InvalidFieldNamePartError, ItfOptions, JpegDecodeResult, JpegMarkerInfo, JpegMetadata, LayoutCombedOptions, LayoutMultilineOptions, LayoutMultilineResult, LayoutSinglelineOptions, LayoutSinglelineResult, LineCapStyle, LineEndingStyle, LineJoinStyle, LinearGradientOptions, LinearizationOptions, LinkHighlightMode, ListboxAppearanceOptions, LoadPdfOptions, MarkedContentScope, MissingOnValueCheckError, MultiPageTableResult, NestedTableContent, NoSuchFieldError, NormalizedStop, Operand, OptimizationReport, OptimizeResult, OutlineDestination, OutlineItemOptions, OutputIntentOptions, OverflowMode, OverflowResult, PDFOperator, PageContent, PageEntry, PageRange, PageSize, PageSizes, ParseSpeeds, ParsedXmpMetadata, PatternFill, Pdf417Matrix, Pdf417Options, PdfAIssue, PdfALevel, PdfAProfile, PdfAValidationResult, PdfAXmpOptions, PdfAnnotation, PdfArray, PdfBool, PdfButtonField, PdfCaretAnnotation, PdfCheckboxField, PdfCircleAnnotation, PdfDict, PdfDocument, PdfDropdownField, PdfEncryptionHandler, PdfField, PdfFileAttachmentAnnotation, PdfForm, PdfFreeTextAnnotation, PdfHighlightAnnotation, PdfInkAnnotation, PdfLayer, PdfLayerManager, PdfLineAnnotation, PdfLinkAnnotation, PdfListboxField, PdfName, PdfNull, PdfNumber, PdfObject, PdfObjectRegistry, PdfOutlineItem, PdfOutlineTree, PdfPage, PdfParseError, PdfPermissionFlags, PdfPolyLineAnnotation, PdfPolygonAnnotation, PdfPopupAnnotation, PdfRadioGroup, PdfRedactAnnotation, PdfRef, PdfSaveOptions, PdfSignatureField, PdfSignatureInfo, PdfSquareAnnotation, PdfSquigglyAnnotation, PdfStampAnnotation, PdfStream, PdfStreamWriter, PdfStrikeOutAnnotation, PdfString, PdfStructureElement, PdfStructureTree, PdfTextAnnotation, PdfTextField, PdfUnderlineAnnotation, PdfViewerPreferences, PdfWorker, PdfWorkerOptions, PdfWriter, PresetName, PresetOptions, ProgressInfo, QrCodeMatrix, QrCodeOptions, RadialGradientFill, RadialGradientOptions, Radians, RadioAppearanceOptions, RawImageData, RecompressOptions, RedactionMark, RedactionOptions, RefResolver, RegistryEntry, RemovePageFromEmptyDocumentError, RgbColor, RichTextFieldReadError, RuntimeKind, SRGB_ICC_PROFILE, SetTitleOptions, SignOptions, SignatureAppearanceOptions, SignatureOptions, SignatureVerificationResult, SignerInfo, SoftMaskBuilder, SoftMaskRef, StandardFontName, StandardFonts, StandardStampName, StripOptions, StripResult, StrippedFeature, StructureElementOptions, StructureType, StyledBarcodeOptions, SubsetCmap, SubsetResult, SvgDrawCommand, SvgElement, SvgRenderOptions, TableCell, TableColumn, TablePreset, TableRenderResult, TableRow, TextAlignment, TextAnnotationIcon, TextAppearanceOptions, TextExtractionOptions, TextItem, TextRenderingMode, TextRun, TilingPatternOptions, TimestampResult, TransparencyFinding, TransparencyGroupOptions, TransparencyInfo, Type0FontData, UnexpectedFieldTypeError, BarcodeOptions as UpcOptions, ViewerPreferences, VisibleSignatureOptions, WasmLoaderConfig, WatermarkOptions, WidgetAnnotationHost, WidthEntry, XmpIssue, XmpValidationResult, addWatermark, addWatermarkToPage, aesDecryptCBC, aesEncryptCBC, analyzeImages, analyzeJpegMarkers, annotationFromDict, applyFillColor, applyOverflow, applyPreset, applyRedactions, applyStrokeColor, applyTablePreset, asNumber, asPDFName, asPDFNumber, attachFile, base64Decode, base64Encode, beginArtifact, beginArtifactWithType, beginLayerContent, beginMarkedContent, beginMarkedContentSequence, beginMarkedContentWithProperties, beginText, borderedPreset, buildAfArray, buildAnnotationDict, buildCatalog, buildDocumentStructure, buildEmbeddedFilesNameTree, buildGradientObjects, buildInfoDict, buildOutputIntent, buildPageTree, buildPatternObjects, buildPkcs7Signature, buildTimestampRequest, buildViewerPreferencesDict, buildXmpMetadata, calculateBarcodeDimensions, calculateEanCheckDigit, calculateUpcCheckDigit, checkAccessibility, circlePath, clearWasmCache, clipEvenOdd, clip as clipOp, closeAndStroke, closeFillAndStroke, closeFillEvenOddAndStroke, closePath as closePathOp, cmyk, code128ToOperators, code39ToOperators, colorToComponents, componentsToColor, computeCode39CheckDigit, computeFileEncryptionKey, computeFontSize, computeImageDpi, computeSignatureHash, computeTargetDimensions, concatMatrix, concatMatrix as concatTransformationMatrix, configureWasmLoader, convertToGrayscale, copyPages, countOccurrences, createAnnotation, createAssociatedFile, createMarkedContentScope, createPdf, createXmpStream, cropPage, curveToFinal, curveToInitial, curveTo as curveToOp, dataMatrixToOperators, decodeImageStream, decodeJpegWasm, decodePermissions, decodeStream, deduplicateImages, degrees, degreesToRadians, detectRuntime, detectTransparency, downscaleImage, drawImageWithMatrix, drawImageXObject, drawXObject as drawObject, drawSvgOnPage, drawXObject, ean13ToOperators, ean8ToOperators, ellipsePath, ellipsisText, embedIccProfile, embedPageAsFormXObject, embedSignature, encodeCode128, encodeCode128Values, encodeCode39, encodeContextTag, encodeDataMatrix, encodeEan13, encodeEan8, encodeInteger, encodeItf, encodeJpegWasm, encodeLength, encodeOID, encodeOctetString, encodePdf417, encodePermissions, encodePrintableString, encodeQrCode, encodeSequence, encodeSet, encodeUTCTime, encodeUpcA, encodeUtf8String, endArtifact, endLayerContent, endMarkedContent, endPath as endPathOp, endText, enforcePdfA, enforcePdfAFull, estimateJpegQuality, estimateTextWidth, extractIccProfile, extractImages, extractJpegMetadata, extractMetrics, extractText, extractTextWithPositions, extractXmpMetadata, fillAndStroke as fillAndStrokeOp, fillEvenOdd, fillEvenOddAndStroke, fill as fillOp, findSignatures, flattenTransparency, formatHexContext, formatPdfDate, generateButtonAppearance, generateCheckboxAppearance, generateCircleAppearance, generateDropdownAppearance, generateFreeTextAppearance, generateHighlightAppearance, generateInkAppearance, generateLineAppearance, generateListboxAppearance, generatePdfAXmp, generatePdfAXmpBytes, generateRadioAppearance, generateSignatureAppearance, generateSquareAppearance, generateSquigglyAppearance, generateSrgbIccProfile, generateStrikeOutAppearance, generateSymbolToUnicodeCmap, generateTextAppearance, generateUnderlineAppearance, generateWinAnsiToUnicodeCmap, generateZapfDingbatsToUnicodeCmap, getAttachments, getPageSize, getProfile, getRedactionMarks, getSignatures, getSupportedLevels, getToUnicodeCmap, grayscale, initJpegWasm, initWasm, injectJpegMetadata, insertPage, instantiateWasmModuleStreaming, isAccessible, isGrayscaleImage, isJpegWasmReady, isLinearized, isOpenTypeCFF, isTrueType, isValidLevel, isWasmDisabled, isWasmModuleCached, itfToOperators, layoutCombedText, layoutMultilineText, layoutSinglelineText, lineTo as lineToOp, linearGradient, linearizePdf, loadPdf, loadWasmModule, loadWasmModuleStreaming, markForRedaction, md5, mergePdfs, minimalPreset, movePage, moveText as moveTextOp, moveTextSetLeading, moveTo as moveToOp, nextLine as nextLineOp, optimizeAllImages, optimizeImage, parseContentStream, parseIccColorSpace, parseIccDescription, parseSvg, parseSvgColor, parseSvgPath, parseSvgTransform, parseTimestampResponse, parseViewerPreferences, parseXmpMetadata$1 as parseXmpMetadata, parseXmpMetadata as parseXmpPdfAMetadata, pdf417ToOperators, restoreState as popGraphicsState, prepareForSigning, professionalPreset, provideWasmBytes, saveState as pushGraphicsState, qrCodeToOperators, radialGradient, radians, radiansToDegrees, rc4, readBarcode, readCode128, readCode39, readEan13, readEan8, recompressImage, rectangle as rectangleOp, removePage, removePages, renderMultiPageTable, renderStyledBarcode, renderTable, requestTimestamp, resetWasmLoader, resizePage, restoreState, reversePages, rgb, rotateAllPages, rotate as rotateOp, rotatePage, rotationMatrix, saveDocumentIncremental, saveIncremental, saveState, scale as scaleOp, serializePdf, setCharacterSpacing as setCharacterSpacingOp, setCharacterSpacing as setCharacterSqueeze, setColorSpace, setDashPattern as setDashPatternOp, setFillColor, setFillColorCmyk, setFillColorGray, setFillColorRgb, setFillingColor, setFlatness, setFont as setFontAndSize, setFont as setFontOp, setFontSize as setFontSizeOp, setGraphicsState as setGraphicsStateOp, setLeading as setLeadingOp, setLineCap as setLineCapOp, setLeading as setLineHeight, setLineJoin as setLineJoinOp, setLineWidth as setLineWidthOp, setMiterLimit, setStrokeColor, setStrokeColorCmyk, setStrokeColorGray, setStrokeColorRgb, setStrokeColorSpace, setStrokingColor, setTextMatrix as setTextMatrixOp, setTextRenderingMode as setTextRenderingModeOp, setTextRise as setTextRiseOp, setWordSpacing as setWordSpacingOp, sha256, sha384, sha512, showTextArray, showTextHex, showTextNextLine, showText as showTextOp, showTextWithSpacing, shrinkFontSize, signPdf, skew as skewOp, splitPdf, stripProhibitedFeatures, stripedPreset, stroke as strokeOp, summarizeIssues, svgToPdfOperators, tilingPattern, translate as translateOp, truncateText, upcAToOperators, validatePdfA, validateXmpMetadata, valuesToModules, verifyOwnerPassword, verifySignature, verifySignatures, verifyUserPassword, wrapInMarkedContent, wrapText };
|
|
6454
|
+
export { AFRelationship, AccessibilityIssue, AddBookmarkOptions, AnalysisReport, AnalyzeImagesOptions, Angle, AnnotationFlags, AnnotationOptions, AnnotationType, AppearanceProviderFor, AppendOptions, AssociatedFileOptions, AssociatedFileResult, BarcodeMatrix, BarcodeOptions, BarcodeReadResult, BatchOptimizeOptions, BatchOptions, BatchProgressCallback, BatchResult, BlendMode, BookmarkNode, BookmarkRef, ButtonAppearanceOptions, ByteRangeResult, ByteWriter, CIDFontData, CIDSystemInfoData, CaretSymbol, CatalogOptions, CellContent, ChangeTracker, CheckboxAppearanceOptions, ChromaSubsampling, CmykColor, Code128Options, Code39Options, Color, ColorStop, CombedTextLayoutError, ComputeFontSizeOptions, ContentStreamOperator, CounterSignatureInfo, CropBox, DataMatrixOptions, DataMatrixResult, DeduplicationReport, Degrees, DiffEntry, DirectEmbedOptions, DirectEmbedResult, DocumentDiff, DocumentMetadata, DocumentStructure, DownscaleOptions, DrawCircleOptions, DrawEllipseOptions, DrawImageOptions, DrawLineOptions, DrawPageOptions, DrawQrCodeOptions, DrawRectangleOptions, DrawSquareOptions, DrawSvgPathOptions, DrawTableOptions, DrawTextOptions, DropdownAppearanceOptions, DssData, BarcodeOptions as EanOptions, EmbedFontOptions, EmbedPageOptions, EmbeddedFile, EmbeddedFont, EmbeddedPdfPage, EncryptAlgorithm, EncryptDictValues, EncryptOptions, EncryptedPdfError, EnforcePdfAOptions, EnforcePdfAResult, EnforcementAction, ErrorCorrectionLevel, ExceededMaxLengthError, FieldAlreadyExistsError, FieldExistsAsNonTerminalError, FieldFlags, FieldLockInfo, FieldLockOptions, FieldType, FileAttachmentIcon, FlattenFormResult, FlattenOptions, FontDescriptorData, FontEmbeddingResult, FontMetrics, FontNotEmbeddedError, FontRef, ForeignPageError, FreeTextAlignment, GradientFill, GrayscaleColor, IccProfile, IfdEntry, ImageAlignment, ImageAnalysis, ImageDpi, ImageFormat, ImageInfo, ImageOptimizeEntry, ImageOptimizeOptions, ImageRef, IncrementalChange, IncrementalObject, IncrementalSaveOptions, IncrementalSaveResult, InitWasmOptions, InvalidFieldNamePartError, ItfOptions, JpegDecodeResult, JpegMarkerInfo, JpegMetadata, JpegWasmModule, LayoutCombedOptions, LayoutMultilineOptions, LayoutMultilineResult, LayoutSinglelineOptions, LayoutSinglelineResult, LineCapStyle, LineEndingStyle, LineJoinStyle, LinearGradientOptions, LinearizationInfo, LinearizationOptions, LinkHighlightMode, ListboxAppearanceOptions, LoadPdfOptions, LtvOptions, MarkedContentScope, MdpPermission, MissingOnValueCheckError, ModificationReport, ModificationViolation, ModificationViolationType, MultiPageTableResult, NestedTableContent, NoSuchFieldError, NormalizedStop, Operand, OptimizationReport, OptimizeResult, OutlineDestination, OutlineItemOptions, OutputIntentOptions, OverflowMode, OverflowResult, PDFOperator, PageContent, PageEntry, PageLabelRange, PageLabelStyle, PageRange, PageSize, PageSizes, ParseSpeeds, ParsedXmpMetadata, PatternFill, Pdf417Matrix, Pdf417Options, PdfAIssue, PdfALevel, PdfAProfile, PdfAValidationResult, PdfAXmpOptions, PdfAnnotation, PdfArray, PdfBool, PdfButtonField, PdfCaretAnnotation, PdfCheckboxField, PdfCircleAnnotation, PdfDict, PdfDocument, PdfDropdownField, PdfEncryptionHandler, PdfField, PdfFileAttachmentAnnotation, PdfForm, PdfFreeTextAnnotation, PdfHighlightAnnotation, PdfInkAnnotation, PdfLayer, PdfLayerManager, PdfLineAnnotation, PdfLinkAnnotation, PdfListboxField, PdfName, PdfNull, PdfNumber, PdfObject, PdfObjectRegistry, PdfOutlineItem, PdfOutlineTree, PdfPage, PdfParseError, PdfPermissionFlags, PdfPolyLineAnnotation, PdfPolygonAnnotation, PdfPopupAnnotation, PdfRadioGroup, PdfRedactAnnotation, PdfRef, PdfSaveOptions, PdfSignatureField, PdfSignatureInfo, PdfSquareAnnotation, PdfSquigglyAnnotation, PdfStampAnnotation, PdfStream, PdfStreamWriter, PdfStrikeOutAnnotation, PdfString, PdfStructureElement, PdfStructureTree, PdfTextAnnotation, PdfTextField, PdfUaEnforcementResult, PdfUaError, PdfUaLevel, PdfUaValidationResult, PdfUaWarning, PdfUnderlineAnnotation, PdfViewerPreferences, PdfWorker, PdfWorkerOptions, PdfWriter, PrepareAppearanceOptions, PresetName, PresetOptions, ProgressInfo, QrCodeMatrix, QrCodeOptions, RadialGradientFill, RadialGradientOptions, Radians, RadioAppearanceOptions, RawImageData, RecompressOptions, RedactionMark, RedactionOptions, RedactionResult, RefResolver, RegistryEntry, RemovePageFromEmptyDocumentError, RgbColor, RichTextFieldReadError, RuntimeKind, SRGB_ICC_PROFILE, SetTitleOptions, SignOptions, SignatureAppearanceOptions, SignatureByteRange, SignatureChainEntry, SignatureChainResult, SignatureOptions, SignatureVerificationResult, SignerInfo, SoftMaskBuilder, SoftMaskRef, StandardFontName, StandardFonts, StandardStampName, StripOptions, StripResult, StrippedFeature, StructureElementOptions, StructureType, StyledBarcodeOptions, SubsetCmap, SubsetResult, SvgDrawCommand, SvgElement, SvgRenderOptions, TableCell, TableColumn, TablePreset, TableRenderResult, TableRow, TextAlignment, TextAnnotationIcon, TextAppearanceOptions, TextExtractionOptions, TextItem, TextRenderingMode, TextRun, TiffCmykEmbedResult, TiffDecodeOptions, TiffIfdEntry, TiffImage, TilingPatternOptions, TimestampResult, TrailerInfo, TransparencyFinding, TransparencyGroupOptions, TransparencyInfo, Type0FontData, UnexpectedFieldTypeError, BarcodeOptions as UpcOptions, ViewerPreferences, VisibleSignatureOptions, WasmLoaderConfig, WasmModuleName, WatermarkOptions, WebPImage, WidgetAnnotationHost, WidthEntry, XmpIssue, XmpValidationResult, addBookmark, addCounterSignature, addFieldLock, addWatermark, addWatermarkToPage, aesDecryptCBC, aesEncryptCBC, analyzeImages, analyzeJpegMarkers, annotationFromDict, appendIncrementalUpdate, applyFillColor, applyOverflow, applyPreset, applyRedaction, applyRedactions, applyStrokeColor, applyTablePreset, asNumber, asPDFName, asPDFNumber, attachFile, base64Decode, base64Encode, batchFlatten, batchMerge, beginArtifact, beginArtifactWithType, beginLayerContent, beginMarkedContent, beginMarkedContentSequence, beginMarkedContentWithProperties, beginText, borderedPreset, buildAfArray, buildAnnotationDict, buildCatalog, buildDocMdpReference, buildDocumentStructure, buildDssDictionary, buildEmbeddedFilesNameTree, buildFieldLockDict, buildGradientObjects, buildInfoDict, buildOutputIntent, buildPageTree, buildPatternObjects, buildPkcs7Signature, buildTimestampRequest, buildViewerPreferencesDict, buildXmpMetadata, calculateBarcodeDimensions, calculateEanCheckDigit, calculateUpcCheckDigit, canDirectEmbed, checkAccessibility, circlePath, clearWasmCache, clipEvenOdd, clip as clipOp, closeAndStroke, closeFillAndStroke, closeFillEvenOddAndStroke, closePath as closePathOp, cmyk, code128ToOperators, code39ToOperators, colorToComponents, componentsToColor, computeCode39CheckDigit, computeFileEncryptionKey, computeFontSize, computeImageDpi, computeObjectHash, computeSignatureHash, computeTargetDimensions, concatMatrix, concatMatrix as concatTransformationMatrix, configureWasmLoader, convertTiffCmykToRgb, convertToGrayscale, copyPages, countOccurrences, createAnnotation, createAssociatedFile, createMarkedContentScope, createPdf, createXmpStream, cropPage, curveToFinal, curveToInitial, curveTo as curveToOp, dataMatrixToOperators, decodeImageStream, decodeJpegWasm, decodePermissions, decodeStream, decodeTiff, decodeTiffAll, decodeTiffPage, decodeWebP, deduplicateImages, degrees, degreesToRadians, delinearizePdf, detectImageFormat, detectModifications, detectRuntime, detectTransparency, diffSignedContent, downscaleImage, drawImageWithMatrix, drawImageXObject, drawXObject as drawObject, drawSvgOnPage, drawXObject, ean13ToOperators, ean8ToOperators, ellipsePath, ellipsisText, embedIccProfile, embedLtvData, embedPageAsFormXObject, embedSignature, embedTiffCmyk, embedTiffDirect, encodeCode128, encodeCode128Values, encodeCode39, encodeContextTag, encodeDataMatrix, encodeEan13, encodeEan8, encodeInteger, encodeItf, encodeJpegWasm, encodeLength, encodeOID, encodeOctetString, encodePdf417, encodePermissions, encodePngFromPixels, encodePrintableString, encodeQrCode, encodeSequence, encodeSet, encodeUTCTime, encodeUpcA, encodeUtf8String, endArtifact, endLayerContent, endMarkedContent, endPath as endPathOp, endText, enforcePdfA, enforcePdfAFull, enforcePdfUa, estimateJpegQuality, estimateTextWidth, extractIccProfile, extractImages, extractJpegMetadata, extractMetrics, extractText, extractTextWithPositions, extractXmpMetadata, fillAndStroke as fillAndStrokeOp, fillEvenOdd, fillEvenOddAndStroke, fill as fillOp, findChangedObjects, findExistingSignatures, findSignatures, flattenField, flattenFields, flattenForm, flattenTransparency, formatHexContext, formatPdfDate, generateButtonAppearance, generateCheckboxAppearance, generateCircleAppearance, generateDropdownAppearance, generateFreeTextAppearance, generateHighlightAppearance, generateInkAppearance, generateLineAppearance, generateListboxAppearance, generatePdfAXmp, generatePdfAXmpBytes, generateRadioAppearance, generateSignatureAppearance, generateSquareAppearance, generateSquigglyAppearance, generateSrgbIccProfile, generateStrikeOutAppearance, generateSymbolToUnicodeCmap, generateTextAppearance, generateUnderlineAppearance, generateWinAnsiToUnicodeCmap, generateZapfDingbatsToUnicodeCmap, getAttachments, getBookmarks, getCertificationLevel, getCounterSignatures, getFieldLocks, getImageFormatName, getInlineWasmBytes, getLinearizationInfo, getPageLabels, getPageSize, getProfile, getRedactionMarks, getSignatures, getSupportedFormats, getSupportedLevels, getTiffPageCount, getToUnicodeCmap, grayscale, hasInlineWasmData, hasLtvData, initJpegWasm, initWasm, injectJpegMetadata, insertPage, instantiateWasmModuleStreaming, isAccessible, isCmykTiff, isGrayscaleImage, isJpegWasmReady, isLinearized, isOpenTypeCFF, isTiff, isTrueType, isValidLevel, isValidModuleName, isWasmDisabled, isWasmModuleCached, isWebP, isWebPLossless, itfToOperators, layoutCombedText, layoutMultilineText, layoutSinglelineText, lineTo as lineToOp, linearGradient, linearizePdf, loadPdf, loadWasmModule, loadWasmModuleStreaming, markForRedaction, md5, mergePdfs, minimalPreset, movePage, moveText as moveTextOp, moveTextSetLeading, moveTo as moveToOp, nextLine as nextLineOp, optimizeAllImages, optimizeImage, optimizeIncrementalSave, parseContentStream, parseExistingTrailer, parseIccColorSpace, parseIccDescription, parseSvg, parseSvgColor, parseSvgPath, parseSvgTransform, parseTiffIfd, parseTimestampResponse, parseViewerPreferences, parseXmpMetadata$1 as parseXmpMetadata, parseXmpMetadata as parseXmpPdfAMetadata, pdf417ToOperators, restoreState as popGraphicsState, prepareForSigning, processBatch, professionalPreset, provideWasmBytes, saveState as pushGraphicsState, qrCodeToOperators, radialGradient, radians, radiansToDegrees, rc4, readBarcode, readCode128, readCode39, readEan13, readEan8, recompressImage, recompressWebP, rectangle as rectangleOp, removeAllBookmarks, removeBookmark, removePage, removePageLabels, removePages, renderMultiPageTable, renderStyledBarcode, renderTable, requestTimestamp, resetWasmLoader, resizePage, restoreState, reversePages, rgb, rotateAllPages, rotate as rotateOp, rotatePage, rotationMatrix, saveDocumentIncremental, saveIncremental, saveIncrementalWithSignaturePreservation, saveState, scale as scaleOp, serializePdf, setCertificationLevel, setCharacterSpacing as setCharacterSpacingOp, setCharacterSpacing as setCharacterSqueeze, setColorSpace, setDashPattern as setDashPatternOp, setFillColor, setFillColorCmyk, setFillColorGray, setFillColorRgb, setFillingColor, setFlatness, setFont as setFontAndSize, setFont as setFontOp, setFontSize as setFontSizeOp, setGraphicsState as setGraphicsStateOp, setLeading as setLeadingOp, setLineCap as setLineCapOp, setLeading as setLineHeight, setLineJoin as setLineJoinOp, setLineWidth as setLineWidthOp, setMiterLimit, setPageLabels, setStrokeColor, setStrokeColorCmyk, setStrokeColorGray, setStrokeColorRgb, setStrokeColorSpace, setStrokingColor, setTextMatrix as setTextMatrixOp, setTextRenderingMode as setTextRenderingModeOp, setTextRise as setTextRiseOp, setWordSpacing as setWordSpacingOp, sha256, sha384, sha512, showTextArray, showTextHex, showTextNextLine, showText as showTextOp, showTextWithSpacing, shrinkFontSize, signPdf, skew as skewOp, splitPdf, stripProhibitedFeatures, stripedPreset, stroke as strokeOp, summarizeIssues, svgToPdfOperators, tilingPattern, translate as translateOp, truncateText, upcAToOperators, validateByteRangeIntegrity, validatePdfA, validatePdfUa, validateSignatureChain, validateXmpMetadata, valuesToModules, verifyOwnerPassword, verifySignature, verifySignatures, verifyUserPassword, webpToJpeg, webpToPng, wrapInMarkedContent, wrapText };
|
|
4852
6455
|
}
|
|
4853
6456
|
/**
|
|
4854
6457
|
* Options for WASM module initialization.
|
|
@@ -4900,5 +6503,5 @@ interface InitWasmOptions {
|
|
|
4900
6503
|
*/
|
|
4901
6504
|
declare function initWasm(options?: string | URL | InitWasmOptions): Promise<void>;
|
|
4902
6505
|
//#endregion
|
|
4903
|
-
export {
|
|
4904
|
-
//# sourceMappingURL=index-
|
|
6506
|
+
export { PresetOptions as $, PdfSquareAnnotation as $a, IncrementalSaveOptions as $i, DeduplicationReport as $n, nextLine as $o, generateZapfDingbatsToUnicodeCmap as $r, configureWasmLoader as $t, flattenForm as A, generateCircleAppearance as Aa, addCounterSignature as Ai, detectImageFormat as An, summarizeIssues as Ao, generatePdfAXmpBytes as Ar, moveTo as As, encodeEan13 as At, NoSuchFieldError as B, PdfFileAttachmentAnnotation as Ba, ModificationReport as Bi, injectJpegMetadata as Bn, beginMarkedContentSequence as Bo, createAssociatedFile as Br, isTrueType as Bs, code128ToOperators as Bt, getBookmarks as C, encodeUtf8String as Ca, optimizeIncrementalSave as Ci, canDirectEmbed as Cn, PdfUaLevel as Co, applyRedaction as Cr, ellipsePath as Cs, encodeDataMatrix as Ct, FlattenOptions as D, embedSignature as Da, embedLtvData as Di, webpToJpeg as Dn, validatePdfUa as Do, enforcePdfAFull as Dr, fillEvenOdd as Ds, calculateEanCheckDigit as Dt, FlattenFormResult as E, computeSignatureHash as Ea, buildDssDictionary as Ei, recompressWebP as En, enforcePdfUa as Eo, EnforcementAction as Er, fillAndStroke as Es, upcAToOperators as Et, FieldExistsAsNonTerminalError as F, generateSquareAppearance as Fa, FieldLockInfo as Fi, convertTiffCmykToRgb as Fn, PDFOperator as Fo, stripProhibitedFeatures as Fr, setLineJoin as Fs, Code39Options as Ft, OverflowResult as G, PdfInkAnnotation as Ga, buildDocMdpReference as Gi, computeTargetDimensions as Gn, wrapInMarkedContent as Go, parseXmpMetadata as Gr, BarcodeOptions as Gt, RichTextFieldReadError as H, PdfCaretAnnotation as Ha, ModificationViolationType as Hi, analyzeJpegMarkers as Hn, createMarkedContentScope as Ho, XmpIssue as Hr, IncrementalSaveResult as Hs, encodeCode128Values as Ht, FontNotEmbeddedError as I, generateSquigglyAppearance as Ia, FieldLockOptions as Ii, embedTiffCmyk as In, MarkedContentScope as Io, AFRelationship as Ir, setLineWidth as Is, code39ToOperators as It, estimateTextWidth as J, LineEndingStyle as Ja, SignatureChainEntry as Ji, extractIccProfile as Jn, drawXObject as Jo, getProfile as Jr, PdfWorker as Jt, applyOverflow as K, PdfStampAnnotation as Ka, getCertificationLevel as Ki, IccProfile as Kn, drawImageWithMatrix as Ko, validateXmpMetadata as Kr, base64Decode as Kt, ForeignPageError as L, generateStrikeOutAppearance as La, addFieldLock as Li, isCmykTiff as Ln, beginArtifact as Lo, AssociatedFileOptions as Lr, setMiterLimit as Ls, computeCode39CheckDigit as Lt, EncryptedPdfError as M, generateHighlightAppearance as Ma, DiffEntry as Mi, getSupportedFormats as Mn, createXmpStream as Mo, StripResult as Mr, setDashPattern as Ms, ItfOptions as Mt, ExceededMaxLengthError as N, generateInkAppearance as Na, DocumentDiff as Ni, TiffCmykEmbedResult as Nn, parseXmpMetadata$1 as No, StrippedFeature as Nr, setFlatness as Ns, encodeItf as Nt, flattenField as O, findSignatures as Oa, hasLtvData as Oi, webpToPng as On, checkAccessibility as Oo, PdfAXmpOptions as Or, fillEvenOddAndStroke as Os, ean13ToOperators as Ot, FieldAlreadyExistsError as P, generateLineAppearance as Pa, diffSignedContent as Pi, TiffIfdEntry as Pn, PdfStreamWriter as Po, countOccurrences as Pr, setLineCap as Ps, itfToOperators as Pt, PresetName as Q, PdfPolygonAnnotation as Qa, IncrementalObject as Qi, isGrayscaleImage as Qn, moveTextSetLeading as Qo, generateWinAnsiToUnicodeCmap as Qr, clearWasmCache as Qt, InvalidFieldNamePartError as R, generateUnderlineAppearance as Ra, buildFieldLockDict as Ri, JpegMetadata as Rn, beginArtifactWithType as Ro, AssociatedFileResult as Rr, stroke as Rs, encodeCode39 as Rt, addBookmark as S, encodeUTCTime as Sa, findChangedObjects as Si, DirectEmbedResult as Sn, PdfUaError as So, RedactionResult as Sr, curveToInitial as Ss, dataMatrixToOperators as St, removeBookmark as T, PrepareAppearanceOptions as Ta, LtvOptions as Ti, encodePngFromPixels as Tn, PdfUaWarning as To, EnforcePdfAResult as Tr, fill as Ts, encodeUpcA as Tt, UnexpectedFieldTypeError as U, PdfPopupAnnotation as Ua, detectModifications as Ui, ImageDpi as Un, endArtifact as Uo, XmpValidationResult as Ur, saveDocumentIncremental as Us, valuesToModules as Ut, RemovePageFromEmptyDocumentError as V, CaretSymbol as Va, ModificationViolation as Vi, JpegMarkerInfo as Vn, beginMarkedContentWithProperties as Vo, ParsedXmpMetadata as Vr, ChangeTracker as Vs, encodeCode128 as Vt, OverflowMode as W, PdfRedactAnnotation as Wa, MdpPermission as Wi, computeImageDpi as Wn, endMarkedContent as Wo, extractXmpMetadata as Wr, saveIncremental as Ws, BarcodeMatrix as Wt, truncateText as X, PdfLineAnnotation as Xa, validateSignatureChain as Xi, parseIccDescription as Xn, endText as Xo, isValidLevel as Xr, RuntimeKind as Xt, shrinkFontSize as Y, PdfCircleAnnotation as Ya, SignatureChainResult as Yi, parseIccColorSpace as Yn, beginText as Yo, getSupportedLevels as Yr, PdfWorkerOptions as Yt, wrapText as Z, PdfPolyLineAnnotation as Za, AppendOptions as Zi, convertToGrayscale as Zn, moveText as Zo, generateSymbolToUnicodeCmap as Zr, WasmLoaderConfig as Zt, removePageLabels as _, encodeOID as _a, getLinearizationInfo as _i, WebPImage as _n, EncryptDictValues as _o, JpegWasmModule as _r, closeFillAndStroke as _s, Pdf417Options as _t, getInlineWasmBytes as a, saveIncrementalWithSignaturePreservation as aa, TransparencyFinding as ai, loadWasmModuleStreaming as an, PdfFreeTextAnnotation as ao, optimizeAllImages as ar, setTextRenderingMode as as, professionalPreset as at, BookmarkNode as b, encodeSequence as ba, IncrementalChange as bi, isWebPLossless as bn, verifyUserPassword as bo, initJpegWasm as br, curveTo as bs, DataMatrixOptions as bt, BatchOptions as c, buildTimestampRequest as ca, flattenTransparency as ci, IfdEntry as cn, PdfTextAnnotation as co, OptimizeResult as cr, showText as cs, readBarcode as ct, batchFlatten as d, SignatureOptions as da, PdfAValidationResult as di, decodeTiff as dn, sha384 as do, downscaleImage as dr, showTextNextLine as ds, readEan13 as dt, SignatureByteRange as ea, getToUnicodeCmap as ei, detectRuntime as en, PdfHighlightAnnotation as eo, deduplicateImages as er, setCharacterSpacing as es, TablePreset as et, batchMerge as f, SignerInfo as fa, enforcePdfA as fi, decodeTiffAll as fn, sha512 as fo, estimateJpegQuality as fr, showTextWithSpacing as fs, readEan8 as ft, getPageLabels as g, encodeLength as ga, delinearizePdf as gi, parseTiffIfd as gn, md5 as go, JpegDecodeResult as gr, closeAndStroke as gs, Pdf417Matrix as gt, PageLabelStyle as h, encodeInteger as ha, LinearizationOptions as hi, isTiff as hn, rc4 as ho, ChromaSubsampling as hr, clipEvenOdd as hs, renderStyledBarcode as ht, WasmModuleName as i, parseExistingTrailer as ia, generateSrgbIccProfile as ii, loadWasmModule as in, FreeTextAlignment as io, ProgressInfo as ir, setTextMatrix as is, minimalPreset as it, CombedTextLayoutError as j, generateFreeTextAppearance as ja, getCounterSignatures as ji, getImageFormatName as jn, buildXmpMetadata as jo, StripOptions as jr, rectangle as js, encodeEan8 as jt, flattenFields as k, prepareForSigning as ka, CounterSignatureInfo as ki, ImageFormat as kn, isAccessible as ko, generatePdfAXmp as kr, lineTo as ks, ean8ToOperators as kt, BatchProgressCallback as l, parseTimestampResponse as la, PdfAIssue as li, TiffDecodeOptions as ln, TextAnnotationIcon as lo, RawImageData as lr, showTextArray as ls, readCode128 as lt, PageLabelRange as m, encodeContextTag as ma, LinearizationInfo as mi, getTiffPageCount as mn, aesEncryptCBC as mo, recompressImage as mr, clip as ms, calculateBarcodeDimensions as mt, index_d_exports as n, appendIncrementalUpdate as na, buildOutputIntent as ni, isWasmDisabled as nn, PdfStrikeOutAnnotation as no, ImageOptimizeEntry as nr, setFontSize as ns, applyTablePreset as nt, hasInlineWasmData as o, validateByteRangeIntegrity as oa, TransparencyInfo as oi, provideWasmBytes as on, LinkHighlightMode as oo, DownscaleOptions as or, setTextRise as os, stripedPreset as ot, processBatch as p, buildPkcs7Signature as pa, validatePdfA as pi, decodeTiffPage as pn, aesDecryptCBC as po, optimizeImage as pr, circlePath as ps, StyledBarcodeOptions as pt, ellipsisText as q, StandardStampName as qa, setCertificationLevel as qi, embedIccProfile as qn, drawImageXObject as qo, PdfAProfile as qr, base64Encode as qt, initWasm as r, findExistingSignatures as ra, SRGB_ICC_PROFILE as ri, isWasmModuleCached as rn, PdfUnderlineAnnotation as ro, OptimizationReport as rr, setLeading as rs, borderedPreset as rt, isValidModuleName as s, TimestampResult as sa, detectTransparency as si, resetWasmLoader as sn, PdfLinkAnnotation as so, ImageOptimizeOptions as sr, setWordSpacing as ss, BarcodeReadResult as st, InitWasmOptions as t, TrailerInfo as ta, OutputIntentOptions as ti, instantiateWasmModuleStreaming as tn, PdfSquigglyAnnotation as to, BatchOptimizeOptions as tr, setFont as ts, applyPreset as tt, BatchResult as u, requestTimestamp as ua, PdfALevel as ui, TiffImage as un, sha256 as uo, RecompressOptions as ur, showTextHex as us, readCode39 as ut, setPageLabels as v, encodeOctetString as va, isLinearized as vi, decodeWebP as vn, computeFileEncryptionKey as vo, decodeJpegWasm as vr, closeFillEvenOddAndStroke as vs, encodePdf417 as vt, removeAllBookmarks as w, ByteRangeResult as wa, DssData as wi, embedTiffDirect as wn, PdfUaValidationResult as wo, EnforcePdfAOptions as wr, endPath as ws, calculateUpcCheckDigit as wt, BookmarkRef as x, encodeSet as xa, computeObjectHash as xi, DirectEmbedOptions as xn, PdfUaEnforcementResult as xo, isJpegWasmReady as xr, curveToFinal as xs, DataMatrixResult as xt, AddBookmarkOptions as y, encodePrintableString as ya, linearizePdf as yi, isWebP as yn, verifyOwnerPassword as yo, encodeJpegWasm as yr, closePath as ys, pdf417ToOperators as yt, MissingOnValueCheckError as z, FileAttachmentIcon as za, getFieldLocks as zi, extractJpegMetadata as zn, beginMarkedContent as zo, buildAfArray as zr, isOpenTypeCFF as zs, Code128Options as zt };
|
|
6507
|
+
//# sourceMappingURL=index-xfJP6Ycm.d.cts.map
|