@awacloud/pdf 0.0.0-stage → 1.0.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/CHANGELOG.md +609 -0
- package/LICENSE +661 -0
- package/NOTICE +77 -0
- package/README.md +363 -2
- package/dist/build/index.js +21 -0
- package/dist/build/pdf-full-rw.js +10972 -0
- package/dist/build/pdf-full-rw.meta.json +105 -0
- package/dist/build/pdf-full-rw.min.js +53 -0
- package/dist/build/pdf-full.js +6078 -0
- package/dist/build/pdf-full.meta.json +90 -0
- package/dist/build/pdf-full.min.js +32 -0
- package/dist/build/pdf-large-rw.js +10367 -0
- package/dist/build/pdf-large-rw.meta.json +99 -0
- package/dist/build/pdf-large-rw.min.js +53 -0
- package/dist/build/pdf-large.js +5473 -0
- package/dist/build/pdf-large.meta.json +84 -0
- package/dist/build/pdf-large.min.js +32 -0
- package/dist/build/pdf-legacy-rw.js +12402 -0
- package/dist/build/pdf-legacy-rw.meta.json +110 -0
- package/dist/build/pdf-legacy-rw.min.js +53 -0
- package/dist/build/pdf-legacy.js +7508 -0
- package/dist/build/pdf-legacy.meta.json +95 -0
- package/dist/build/pdf-legacy.min.js +32 -0
- package/dist/build/pdf-rw.js +7578 -0
- package/dist/build/pdf-rw.meta.json +77 -0
- package/dist/build/pdf-rw.min.js +53 -0
- package/dist/build/pdf.js +2684 -0
- package/dist/build/pdf.meta.json +62 -0
- package/dist/build/pdf.min.js +32 -0
- package/dist/standalone/pdf-full-rw.js +16798 -0
- package/dist/standalone/pdf-full-rw.meta.json +78 -0
- package/dist/standalone/pdf-full-rw.min.js +56 -0
- package/dist/standalone/pdf-full.js +11904 -0
- package/dist/standalone/pdf-full.meta.json +63 -0
- package/dist/standalone/pdf-full.min.js +35 -0
- package/dist/standalone/pdf-large-rw.js +16193 -0
- package/dist/standalone/pdf-large-rw.meta.json +72 -0
- package/dist/standalone/pdf-large-rw.min.js +56 -0
- package/dist/standalone/pdf-large.js +11299 -0
- package/dist/standalone/pdf-large.meta.json +57 -0
- package/dist/standalone/pdf-large.min.js +35 -0
- package/dist/standalone/pdf-legacy-rw.js +18228 -0
- package/dist/standalone/pdf-legacy-rw.meta.json +83 -0
- package/dist/standalone/pdf-legacy-rw.min.js +56 -0
- package/dist/standalone/pdf-legacy.js +13334 -0
- package/dist/standalone/pdf-legacy.meta.json +68 -0
- package/dist/standalone/pdf-legacy.min.js +35 -0
- package/dist/standalone/pdf-rw.js +13404 -0
- package/dist/standalone/pdf-rw.meta.json +50 -0
- package/dist/standalone/pdf-rw.min.js +56 -0
- package/dist/standalone/pdf.js +8510 -0
- package/dist/standalone/pdf.meta.json +35 -0
- package/dist/standalone/pdf.min.js +35 -0
- package/docs/README.md +53 -0
- package/docs/api/README.md +38 -0
- package/docs/api/_shared/README.md +91 -0
- package/docs/api/action/README.md +29 -0
- package/docs/api/action/action.md +81 -0
- package/docs/api/action/goTo.md +66 -0
- package/docs/api/action/launch.md +58 -0
- package/docs/api/action/named.md +55 -0
- package/docs/api/action/uri.md +54 -0
- package/docs/api/annot/README.md +53 -0
- package/docs/api/annot/annot.md +114 -0
- package/docs/api/annot/fileAttach.md +53 -0
- package/docs/api/annot/freeText.md +68 -0
- package/docs/api/annot/ink.md +69 -0
- package/docs/api/annot/link.md +74 -0
- package/docs/api/annot/markup.md +83 -0
- package/docs/api/annot/popup.md +52 -0
- package/docs/api/annot/projection.md +56 -0
- package/docs/api/annot/redact.md +67 -0
- package/docs/api/annot/square.md +87 -0
- package/docs/api/annot/stamp.md +54 -0
- package/docs/api/annot/text.md +69 -0
- package/docs/api/annot/widget.md +69 -0
- package/docs/api/associatedFiles/README.md +9 -0
- package/docs/api/associatedFiles/associatedFiles.md +78 -0
- package/docs/api/bundles/README.md +68 -0
- package/docs/api/bundles/dist-matrix.md +165 -0
- package/docs/api/bundles/pdf-full.md +148 -0
- package/docs/api/bundles/pdf-large.md +144 -0
- package/docs/api/bundles/pdf-legacy.md +169 -0
- package/docs/api/content/README.md +29 -0
- package/docs/api/content/color.md +99 -0
- package/docs/api/content/graphics.md +114 -0
- package/docs/api/content/images.md +124 -0
- package/docs/api/content/ops.md +100 -0
- package/docs/api/content/stream.md +107 -0
- package/docs/api/content/text.md +98 -0
- package/docs/api/crypto/README.md +29 -0
- package/docs/api/crypto/aesGcm.md +72 -0
- package/docs/api/crypto/permissions.md +79 -0
- package/docs/api/crypto/security.md +98 -0
- package/docs/api/crypto/standardV4.md +104 -0
- package/docs/api/crypto/standardV5.md +84 -0
- package/docs/api/crypto/standardV6.md +93 -0
- package/docs/api/destination/README.md +9 -0
- package/docs/api/destination/destination.md +79 -0
- package/docs/api/document/README.md +29 -0
- package/docs/api/document/builder.md +281 -0
- package/docs/api/document/catalog.md +98 -0
- package/docs/api/document/document.md +187 -0
- package/docs/api/document/encryptedWriter.md +149 -0
- package/docs/api/document/incrementalWriter.md +148 -0
- package/docs/api/document/page.md +99 -0
- package/docs/api/document/pages.md +82 -0
- package/docs/api/document/resources.md +102 -0
- package/docs/api/document/writer.md +157 -0
- package/docs/api/document/xrefStreamWriter.md +122 -0
- package/docs/api/embedded/README.md +13 -0
- package/docs/api/embedded/collection.md +80 -0
- package/docs/api/embedded/embeddedFile.md +86 -0
- package/docs/api/embedded/fileSpec.md +87 -0
- package/docs/api/errors.md +110 -0
- package/docs/api/extra/3d-richmedia.md +76 -0
- package/docs/api/extra/README.md +99 -0
- package/docs/api/extra/annot-extended.md +71 -0
- package/docs/api/extra/associated-files.md +70 -0
- package/docs/api/extra/ccitt-fax-decoder.md +74 -0
- package/docs/api/extra/color-spaces-extended.md +72 -0
- package/docs/api/extra/content-ops-extended.md +82 -0
- package/docs/api/extra/document-parts.md +69 -0
- package/docs/api/extra/embedded-files-portfolio.md +87 -0
- package/docs/api/extra/font-cid-typed.md +77 -0
- package/docs/api/extra/font-color-tagging.md +76 -0
- package/docs/api/extra/form-actions-extended.md +75 -0
- package/docs/api/extra/info-dict-deprecated.md +72 -0
- package/docs/api/extra/jbig2-read.md +80 -0
- package/docs/api/extra/legacy-deprecated-annots.md +89 -0
- package/docs/api/extra/legacy-deprecated-filters.md +78 -0
- package/docs/api/extra/legacy-rc4-read.md +74 -0
- package/docs/api/extra/legacy-xfa-read.md +65 -0
- package/docs/api/extra/linearization-write.md +71 -0
- package/docs/api/extra/misc.md +93 -0
- package/docs/api/extra/optional-content-extended.md +83 -0
- package/docs/api/extra/pdf-a-output-intent.md +65 -0
- package/docs/api/extra/pdf-sandbox.md +76 -0
- package/docs/api/extra/pdf-ua-tagged.md +63 -0
- package/docs/api/extra/pdf-x-prepress.md +65 -0
- package/docs/api/extra/redaction-iso32005.md +65 -0
- package/docs/api/extra/shading-typed.md +73 -0
- package/docs/api/extra/sig-aes-gcm.md +69 -0
- package/docs/api/extra/sig-pades.md +103 -0
- package/docs/api/extra/tagged-pdf-typed.md +78 -0
- package/docs/api/extra/transparency-typed.md +74 -0
- package/docs/api/extra/well-tagged-pdf.md +61 -0
- package/docs/api/extra/xmp-extended.md +65 -0
- package/docs/api/font/README.md +25 -0
- package/docs/api/font/embed.md +157 -0
- package/docs/api/font/encoding.md +95 -0
- package/docs/api/font/font.md +97 -0
- package/docs/api/font/type3.md +89 -0
- package/docs/api/form/README.md +35 -0
- package/docs/api/form/acroform.md +88 -0
- package/docs/api/form/appearance.md +87 -0
- package/docs/api/form/button.md +97 -0
- package/docs/api/form/choice.md +96 -0
- package/docs/api/form/fieldTree.md +93 -0
- package/docs/api/form/signature.md +90 -0
- package/docs/api/form/text.md +88 -0
- package/docs/api/linearization/README.md +11 -0
- package/docs/api/linearization/linearization.md +81 -0
- package/docs/api/main.md +116 -0
- package/docs/api/metadata/README.md +10 -0
- package/docs/api/metadata/info.md +70 -0
- package/docs/api/metadata/xmp.md +62 -0
- package/docs/api/ocg/README.md +23 -0
- package/docs/api/ocg/config.md +95 -0
- package/docs/api/ocg/ocg.md +77 -0
- package/docs/api/outline/README.md +11 -0
- package/docs/api/outline/outline.md +107 -0
- package/docs/api/pdf.md +152 -0
- package/docs/api/prepress/README.md +10 -0
- package/docs/api/prepress/outputIntent.md +79 -0
- package/docs/api/prepress/pageBoundary.md +75 -0
- package/docs/api/sig/README.md +32 -0
- package/docs/api/sig/byteRange.md +120 -0
- package/docs/api/sig/certChain.md +84 -0
- package/docs/api/sig/dss.md +111 -0
- package/docs/api/sig/oids.md +76 -0
- package/docs/api/sig/sha1.md +72 -0
- package/docs/api/sig/sign.md +317 -0
- package/docs/api/sig/signature.md +178 -0
- package/docs/api/sig/timestamp.md +84 -0
- package/docs/api/syntax/README.md +29 -0
- package/docs/api/syntax/crossRefStream.md +115 -0
- package/docs/api/syntax/filters/README.md +50 -0
- package/docs/api/syntax/filters/ascii85.md +76 -0
- package/docs/api/syntax/filters/asciiHex.md +73 -0
- package/docs/api/syntax/filters/dispatch.md +125 -0
- package/docs/api/syntax/filters/flate.md +134 -0
- package/docs/api/syntax/filters/runLength.md +78 -0
- package/docs/api/syntax/objStream.md +88 -0
- package/docs/api/syntax/parser-obj.md +97 -0
- package/docs/api/syntax/parser.md +151 -0
- package/docs/api/syntax/serializer.md +109 -0
- package/docs/api/syntax/tokenizer.md +104 -0
- package/docs/api/syntax/trailer.md +85 -0
- package/docs/api/syntax/xref.md +139 -0
- package/docs/api/tagged/README.md +25 -0
- package/docs/api/tagged/classMap.md +67 -0
- package/docs/api/tagged/markedContent.md +62 -0
- package/docs/api/tagged/parentTree.md +67 -0
- package/docs/api/tagged/roleMap.md +67 -0
- package/docs/api/tagged/structElement.md +76 -0
- package/docs/api/tagged/structTree.md +75 -0
- package/docs/guide/coverage.md +113 -0
- package/docs/guide/crypto.md +121 -0
- package/docs/guide/extending.md +76 -0
- package/docs/guide/getting-started.md +75 -0
- package/docs/guide/legacy-1.7.md +42 -0
- package/docs/guide/pades-integration.md +579 -0
- package/docs/guide/read-pdf.md +89 -0
- package/package.json +97 -4
- package/src/_shared/index.js +179 -0
- package/src/action/action.js +119 -0
- package/src/action/goTo.js +89 -0
- package/src/action/launch.js +61 -0
- package/src/action/named.js +54 -0
- package/src/action/uri.js +51 -0
- package/src/annot/annot.js +212 -0
- package/src/annot/fileAttach.js +55 -0
- package/src/annot/freeText.js +82 -0
- package/src/annot/ink.js +77 -0
- package/src/annot/link.js +77 -0
- package/src/annot/markup.js +91 -0
- package/src/annot/popup.js +53 -0
- package/src/annot/projection.js +52 -0
- package/src/annot/redact.js +87 -0
- package/src/annot/square.js +132 -0
- package/src/annot/stamp.js +48 -0
- package/src/annot/text.js +54 -0
- package/src/annot/widget.js +61 -0
- package/src/associatedFiles/associatedFiles.js +86 -0
- package/src/bundles/pdf-full.js +91 -0
- package/src/bundles/pdf-large.js +81 -0
- package/src/bundles/pdf-legacy.js +107 -0
- package/src/content/color.js +114 -0
- package/src/content/graphics.js +192 -0
- package/src/content/images.js +160 -0
- package/src/content/ops.js +137 -0
- package/src/content/stream.js +154 -0
- package/src/content/text.js +125 -0
- package/src/crypto/aesGcm.js +123 -0
- package/src/crypto/permissions.js +112 -0
- package/src/crypto/security.js +327 -0
- package/src/crypto/standardV4.js +443 -0
- package/src/crypto/standardV5.js +306 -0
- package/src/crypto/standardV6.js +334 -0
- package/src/destination/destination.js +183 -0
- package/src/document/builder.js +618 -0
- package/src/document/catalog.js +100 -0
- package/src/document/document.js +472 -0
- package/src/document/encryptedWriter.js +554 -0
- package/src/document/incrementalWriter.js +514 -0
- package/src/document/page.js +131 -0
- package/src/document/pages.js +103 -0
- package/src/document/resources.js +146 -0
- package/src/document/writer.js +211 -0
- package/src/document/xrefStreamWriter.js +353 -0
- package/src/embedded/collection.js +102 -0
- package/src/embedded/embeddedFile.js +99 -0
- package/src/embedded/fileSpec.js +137 -0
- package/src/errors.js +78 -0
- package/src/extra/3d-richmedia.js +171 -0
- package/src/extra/annot-extended.js +200 -0
- package/src/extra/associated-files.js +131 -0
- package/src/extra/ccitt-fax-decoder.js +776 -0
- package/src/extra/color-spaces-extended.js +196 -0
- package/src/extra/content-ops-extended.js +153 -0
- package/src/extra/document-parts.js +149 -0
- package/src/extra/embedded-files-portfolio.js +234 -0
- package/src/extra/font-cid-typed.js +185 -0
- package/src/extra/font-color-tagging.js +144 -0
- package/src/extra/form-actions-extended.js +196 -0
- package/src/extra/info-dict-deprecated.js +137 -0
- package/src/extra/jbig2-read.js +169 -0
- package/src/extra/legacy-deprecated-annots.js +198 -0
- package/src/extra/legacy-deprecated-filters.js +167 -0
- package/src/extra/legacy-rc4-read.js +235 -0
- package/src/extra/legacy-xfa-read.js +104 -0
- package/src/extra/linearization-write.js +97 -0
- package/src/extra/misc.js +217 -0
- package/src/extra/optional-content-extended.js +142 -0
- package/src/extra/pdf-a-output-intent.js +112 -0
- package/src/extra/pdf-sandbox.js +88 -0
- package/src/extra/pdf-ua-tagged.js +116 -0
- package/src/extra/pdf-x-prepress.js +114 -0
- package/src/extra/redaction-iso32005.js +136 -0
- package/src/extra/shading-typed.js +222 -0
- package/src/extra/sig-aes-gcm.js +135 -0
- package/src/extra/sig-pades.js +242 -0
- package/src/extra/tagged-pdf-typed.js +203 -0
- package/src/extra/transparency-typed.js +135 -0
- package/src/extra/well-tagged-pdf.js +138 -0
- package/src/extra/xmp-extended.js +190 -0
- package/src/font/embed.js +480 -0
- package/src/font/encoding.js +92 -0
- package/src/font/font.js +101 -0
- package/src/font/type3.js +75 -0
- package/src/form/acroform.js +94 -0
- package/src/form/appearance.js +90 -0
- package/src/form/button.js +105 -0
- package/src/form/choice.js +152 -0
- package/src/form/fieldTree.js +120 -0
- package/src/form/signature.js +100 -0
- package/src/form/text.js +101 -0
- package/src/linearization/linearization.js +107 -0
- package/src/main.js +411 -0
- package/src/metadata/info.js +87 -0
- package/src/metadata/xmp.js +62 -0
- package/src/ocg/config.js +156 -0
- package/src/ocg/ocg.js +124 -0
- package/src/outline/outline.js +157 -0
- package/src/pdf.js +133 -0
- package/src/prepress/outputIntent.js +118 -0
- package/src/prepress/pageBoundary.js +108 -0
- package/src/sig/byteRange.js +306 -0
- package/src/sig/certChain.js +247 -0
- package/src/sig/dss.js +317 -0
- package/src/sig/oids.js +157 -0
- package/src/sig/sha1.js +142 -0
- package/src/sig/sign.js +1899 -0
- package/src/sig/signature.js +1441 -0
- package/src/sig/timestamp.js +236 -0
- package/src/syntax/crossRefStream.js +133 -0
- package/src/syntax/filters/ascii85.js +122 -0
- package/src/syntax/filters/asciiHex.js +83 -0
- package/src/syntax/filters/dispatch.js +176 -0
- package/src/syntax/filters/flate.js +316 -0
- package/src/syntax/filters/runLength.js +96 -0
- package/src/syntax/objStream.js +99 -0
- package/src/syntax/parser-obj.js +52 -0
- package/src/syntax/parser.js +321 -0
- package/src/syntax/serializer.js +221 -0
- package/src/syntax/tokenizer.js +290 -0
- package/src/syntax/trailer.js +76 -0
- package/src/syntax/xref.js +341 -0
- package/src/tagged/classMap.js +81 -0
- package/src/tagged/markedContent.js +123 -0
- package/src/tagged/parentTree.js +126 -0
- package/src/tagged/roleMap.js +107 -0
- package/src/tagged/structElement.js +138 -0
- package/src/tagged/structTree.js +94 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Projection (3D-view) annotation per ISO 32000-2:2020
|
|
8
|
+
* §13.6.6.2 (Projections), and legacy Movie/Sound annotations
|
|
9
|
+
* (Annex H, deprecated in PDF 2.0 but still parsed for completeness).
|
|
10
|
+
*
|
|
11
|
+
* Projection subtype-specific entries:
|
|
12
|
+
* /V dict|name — 3D-view (or referenced view name)
|
|
13
|
+
* /B dict — 3D-state (background, etc.)
|
|
14
|
+
*
|
|
15
|
+
* @module pdf/annot/projection
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Module factory.
|
|
20
|
+
*/
|
|
21
|
+
import { pdfErrors } from '../errors.js';
|
|
22
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
23
|
+
import { pdfAnnot } from './annot.js';
|
|
24
|
+
|
|
25
|
+
export const pdfProjectionAnnot = {
|
|
26
|
+
name: 'pdfProjectionAnnot',
|
|
27
|
+
dependencies: ['pdfErrors', 'pdfParser', 'pdfAnnot'],
|
|
28
|
+
deps: [pdfErrors, pdfParser, pdfAnnot],
|
|
29
|
+
factory(errors, parser, annot) {
|
|
30
|
+
const { ParseError } = errors;
|
|
31
|
+
const { isType } = parser;
|
|
32
|
+
const { typeBaseAnnot, captureExtras } = annot;
|
|
33
|
+
|
|
34
|
+
const KNOWN = new Set(['V', 'B']);
|
|
35
|
+
|
|
36
|
+
function typeProjectionAnnot(dict) {
|
|
37
|
+
const base = typeBaseAnnot(dict);
|
|
38
|
+
if (base.subtype && base.subtype !== 'Projection') {
|
|
39
|
+
throw new ParseError('pdf/annot/projection/bad-subtype',
|
|
40
|
+
'/Subtype must be /Projection',
|
|
41
|
+
{ context: { actual: base.subtype } });
|
|
42
|
+
}
|
|
43
|
+
const e = dict.entries;
|
|
44
|
+
base.v = e.V || null;
|
|
45
|
+
base.b = isType(e.B, 'dict') ? e.B : null;
|
|
46
|
+
captureExtras(base, dict, KNOWN);
|
|
47
|
+
return base;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return { typeProjectionAnnot };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Redact annotation (ISO 32000-2 §12.5.6.21) — read-side typing only; applying a redaction (content removal) is not implemented.
|
|
8
|
+
*
|
|
9
|
+
* Subtype-specific entries:
|
|
10
|
+
* /QuadPoints array of numbers (multiple of 8) — redaction regions
|
|
11
|
+
* /IC array — interior color (post-redaction fill)
|
|
12
|
+
* /RO stream — replacement appearance for the redacted area
|
|
13
|
+
* /OverlayText string — text overlaid after applying the redaction
|
|
14
|
+
* /Repeat boolean — repeat overlay text to fill the region
|
|
15
|
+
* /DA string — default appearance for /OverlayText
|
|
16
|
+
* /Q int — quadding for /OverlayText
|
|
17
|
+
*
|
|
18
|
+
* @module pdf/annot/redact
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Module factory.
|
|
23
|
+
*/
|
|
24
|
+
import { pdfErrors } from '../errors.js';
|
|
25
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
26
|
+
import { pdfAnnot } from './annot.js';
|
|
27
|
+
|
|
28
|
+
export const pdfRedactAnnot = {
|
|
29
|
+
name: 'pdfRedactAnnot',
|
|
30
|
+
dependencies: ['pdfErrors', 'pdfParser', 'pdfAnnot'],
|
|
31
|
+
deps: [pdfErrors, pdfParser, pdfAnnot],
|
|
32
|
+
factory(errors, parser, annot) {
|
|
33
|
+
const { ParseError } = errors;
|
|
34
|
+
const { isType } = parser;
|
|
35
|
+
const { typeBaseAnnot, captureExtras } = annot;
|
|
36
|
+
|
|
37
|
+
const KNOWN = new Set([
|
|
38
|
+
'QuadPoints', 'IC', 'RO', 'OverlayText', 'Repeat', 'DA', 'Q'
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
function typeRedactAnnot(dict) {
|
|
42
|
+
const base = typeBaseAnnot(dict);
|
|
43
|
+
if (base.subtype && base.subtype !== 'Redact') {
|
|
44
|
+
throw new ParseError('pdf/annot/redact/bad-subtype',
|
|
45
|
+
'/Subtype must be /Redact',
|
|
46
|
+
{ context: { actual: base.subtype } });
|
|
47
|
+
}
|
|
48
|
+
const e = dict.entries;
|
|
49
|
+
base.quadPoints = toNumArray(e.QuadPoints, 'pdf/annot/redact/bad-quadpoints');
|
|
50
|
+
if (base.quadPoints && base.quadPoints.length % 8 !== 0) {
|
|
51
|
+
throw new ParseError('pdf/annot/redact/bad-quadpoints',
|
|
52
|
+
'/QuadPoints length must be a multiple of 8',
|
|
53
|
+
{ context: { length: base.quadPoints.length } });
|
|
54
|
+
}
|
|
55
|
+
base.ic = toNumArray(e.IC, 'pdf/annot/redact/bad-ic');
|
|
56
|
+
base.ro = e.RO || null;
|
|
57
|
+
base.overlayText = isType(e.OverlayText, 'string') ? e.OverlayText.value : null;
|
|
58
|
+
base.repeat = isType(e.Repeat, 'bool') ? !!e.Repeat.value : false;
|
|
59
|
+
base.da = isType(e.DA, 'string') ? e.DA.value : null;
|
|
60
|
+
base.q = (e.Q && (e.Q.type === 'int' || e.Q.type === 'real'))
|
|
61
|
+
? (e.Q.value | 0) : 0;
|
|
62
|
+
captureExtras(base, dict, KNOWN);
|
|
63
|
+
return base;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function toNumArray(v, errCode) {
|
|
67
|
+
if (!v) return null;
|
|
68
|
+
if (v.type !== 'array') {
|
|
69
|
+
throw new ParseError(errCode,
|
|
70
|
+
'expected an array of numbers',
|
|
71
|
+
{ context: { kind: v.type } });
|
|
72
|
+
}
|
|
73
|
+
const out = [];
|
|
74
|
+
for (const it of v.items) {
|
|
75
|
+
if (!it || (it.type !== 'int' && it.type !== 'real')) {
|
|
76
|
+
throw new ParseError(errCode,
|
|
77
|
+
'array entries must be numbers',
|
|
78
|
+
{ context: { kind: it && it.type } });
|
|
79
|
+
}
|
|
80
|
+
out.push(it.value);
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { typeRedactAnnot };
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Shape annotations per ISO 32000-2:2020 §12.5.6.7–9.
|
|
8
|
+
*
|
|
9
|
+
* Subtypes handled: Square, Circle, Line, Polygon, PolyLine.
|
|
10
|
+
*
|
|
11
|
+
* Common-ish entries:
|
|
12
|
+
* /BS border style dict (already on base; explicit here)
|
|
13
|
+
* /IC interior color array
|
|
14
|
+
* /LE line-ending styles array of 2 names
|
|
15
|
+
*
|
|
16
|
+
* Square/Circle: /RD (rectangle differences).
|
|
17
|
+
* Line: /L (x1,y1,x2,y2), /LL, /LLE, /Cap, /CP, /Measure, /IT.
|
|
18
|
+
* Polygon/PolyLine: /Vertices, /Measure, /IT, /Path.
|
|
19
|
+
*
|
|
20
|
+
* @module pdf/annot/square
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Module factory.
|
|
25
|
+
*/
|
|
26
|
+
import { pdfErrors } from '../errors.js';
|
|
27
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
28
|
+
import { pdfAnnot } from './annot.js';
|
|
29
|
+
|
|
30
|
+
export const pdfShapeAnnot = {
|
|
31
|
+
name: 'pdfShapeAnnot',
|
|
32
|
+
dependencies: ['pdfErrors', 'pdfParser', 'pdfAnnot'],
|
|
33
|
+
deps: [pdfErrors, pdfParser, pdfAnnot],
|
|
34
|
+
factory(errors, parser, annot) {
|
|
35
|
+
const { ParseError } = errors;
|
|
36
|
+
const { isType } = parser;
|
|
37
|
+
const { typeBaseAnnot, captureExtras } = annot;
|
|
38
|
+
|
|
39
|
+
const VALID = new Set(['Square', 'Circle', 'Line', 'Polygon', 'PolyLine']);
|
|
40
|
+
const KNOWN = new Set([
|
|
41
|
+
'RD', 'IC', 'L', 'LE', 'LL', 'LLE', 'Cap', 'CP', 'Measure', 'IT',
|
|
42
|
+
'Vertices', 'Path'
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
function typeShapeAnnot(dict, expected) {
|
|
46
|
+
if (!VALID.has(expected)) {
|
|
47
|
+
throw new ParseError('pdf/annot/shape/bad-expected',
|
|
48
|
+
'unsupported shape subtype',
|
|
49
|
+
{ context: { expected } });
|
|
50
|
+
}
|
|
51
|
+
const base = typeBaseAnnot(dict);
|
|
52
|
+
if (base.subtype && base.subtype !== expected) {
|
|
53
|
+
throw new ParseError('pdf/annot/shape/bad-subtype',
|
|
54
|
+
'/Subtype mismatch for shape typer',
|
|
55
|
+
{ context: { expected, actual: base.subtype } });
|
|
56
|
+
}
|
|
57
|
+
const e = dict.entries;
|
|
58
|
+
|
|
59
|
+
base.ic = toNumArray(e.IC, 'pdf/annot/shape/bad-ic');
|
|
60
|
+
|
|
61
|
+
if (expected === 'Square' || expected === 'Circle') {
|
|
62
|
+
base.rd = toNumArray(e.RD, 'pdf/annot/shape/bad-rd');
|
|
63
|
+
}
|
|
64
|
+
if (expected === 'Line') {
|
|
65
|
+
base.l = toNumArray(e.L, 'pdf/annot/shape/bad-l');
|
|
66
|
+
base.le = toNameArray(e.LE, 'pdf/annot/shape/bad-le');
|
|
67
|
+
base.ll = toNum(e.LL, null);
|
|
68
|
+
base.lle = toNum(e.LLE, null);
|
|
69
|
+
base.cap = isType(e.Cap, 'bool') ? !!e.Cap.value : false;
|
|
70
|
+
base.cp = isType(e.CP, 'name') ? e.CP.value : null;
|
|
71
|
+
base.it = isType(e.IT, 'name') ? e.IT.value : null;
|
|
72
|
+
base.measure = isType(e.Measure, 'dict') ? e.Measure : null;
|
|
73
|
+
}
|
|
74
|
+
if (expected === 'Polygon' || expected === 'PolyLine') {
|
|
75
|
+
base.vertices = toNumArray(e.Vertices, 'pdf/annot/shape/bad-vertices');
|
|
76
|
+
base.le = toNameArray(e.LE, 'pdf/annot/shape/bad-le');
|
|
77
|
+
base.it = isType(e.IT, 'name') ? e.IT.value : null;
|
|
78
|
+
base.measure = isType(e.Measure, 'dict') ? e.Measure : null;
|
|
79
|
+
base.path = isType(e.Path, 'array') ? e.Path : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
captureExtras(base, dict, KNOWN);
|
|
83
|
+
return base;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function toNumArray(v, errCode) {
|
|
87
|
+
if (!v) return null;
|
|
88
|
+
if (v.type !== 'array') {
|
|
89
|
+
throw new ParseError(errCode,
|
|
90
|
+
'expected an array of numbers',
|
|
91
|
+
{ context: { kind: v.type } });
|
|
92
|
+
}
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const it of v.items) {
|
|
95
|
+
if (!it || (it.type !== 'int' && it.type !== 'real')) {
|
|
96
|
+
throw new ParseError(errCode,
|
|
97
|
+
'array entries must be numbers',
|
|
98
|
+
{ context: { kind: it && it.type } });
|
|
99
|
+
}
|
|
100
|
+
out.push(it.value);
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function toNameArray(v, errCode) {
|
|
106
|
+
if (!v) return null;
|
|
107
|
+
if (v.type !== 'array') {
|
|
108
|
+
throw new ParseError(errCode,
|
|
109
|
+
'expected an array of names',
|
|
110
|
+
{ context: { kind: v.type } });
|
|
111
|
+
}
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const it of v.items) {
|
|
114
|
+
if (!it || it.type !== 'name') {
|
|
115
|
+
throw new ParseError(errCode,
|
|
116
|
+
'array entries must be names',
|
|
117
|
+
{ context: { kind: it && it.type } });
|
|
118
|
+
}
|
|
119
|
+
out.push(it.value);
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function toNum(v, dflt) {
|
|
125
|
+
if (!v) return dflt;
|
|
126
|
+
if (v.type !== 'int' && v.type !== 'real') return dflt;
|
|
127
|
+
return v.value;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return { typeShapeAnnot };
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Rubber-stamp annotation per ISO 32000-2:2020 §12.5.6.12.
|
|
8
|
+
*
|
|
9
|
+
* Subtype-specific entries:
|
|
10
|
+
* /Name name — icon name (Approved, Confidential, Draft, …)
|
|
11
|
+
*
|
|
12
|
+
* @module pdf/annot/stamp
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Module factory.
|
|
17
|
+
*/
|
|
18
|
+
import { pdfErrors } from '../errors.js';
|
|
19
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
20
|
+
import { pdfAnnot } from './annot.js';
|
|
21
|
+
|
|
22
|
+
export const pdfStampAnnot = {
|
|
23
|
+
name: 'pdfStampAnnot',
|
|
24
|
+
dependencies: ['pdfErrors', 'pdfParser', 'pdfAnnot'],
|
|
25
|
+
deps: [pdfErrors, pdfParser, pdfAnnot],
|
|
26
|
+
factory(errors, parser, annot) {
|
|
27
|
+
const { ParseError } = errors;
|
|
28
|
+
const { isType } = parser;
|
|
29
|
+
const { typeBaseAnnot, captureExtras } = annot;
|
|
30
|
+
|
|
31
|
+
const KNOWN = new Set(['Name']);
|
|
32
|
+
|
|
33
|
+
function typeStampAnnot(dict) {
|
|
34
|
+
const base = typeBaseAnnot(dict);
|
|
35
|
+
if (base.subtype && base.subtype !== 'Stamp') {
|
|
36
|
+
throw new ParseError('pdf/annot/stamp/bad-subtype',
|
|
37
|
+
'/Subtype must be /Stamp',
|
|
38
|
+
{ context: { actual: base.subtype } });
|
|
39
|
+
}
|
|
40
|
+
const e = dict.entries;
|
|
41
|
+
base.iconName = isType(e.Name, 'name') ? e.Name.value : null;
|
|
42
|
+
captureExtras(base, dict, KNOWN);
|
|
43
|
+
return base;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return { typeStampAnnot };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Text (sticky-note) annotation per ISO 32000-2:2020 §12.5.6.4.
|
|
8
|
+
*
|
|
9
|
+
* Subtype-specific entries:
|
|
10
|
+
* /Open boolean — pop-up window initial state
|
|
11
|
+
* /Name name — icon name (e.g. Note, Comment, Help)
|
|
12
|
+
* /State string — annotation state (e.g. Marked, Unmarked)
|
|
13
|
+
* /StateModel string — model the state belongs to
|
|
14
|
+
*
|
|
15
|
+
* @module pdf/annot/text
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Module factory.
|
|
20
|
+
*/
|
|
21
|
+
import { pdfErrors } from '../errors.js';
|
|
22
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
23
|
+
import { pdfAnnot } from './annot.js';
|
|
24
|
+
|
|
25
|
+
export const pdfTextAnnot = {
|
|
26
|
+
name: 'pdfTextAnnot',
|
|
27
|
+
dependencies: ['pdfErrors', 'pdfParser', 'pdfAnnot'],
|
|
28
|
+
deps: [pdfErrors, pdfParser, pdfAnnot],
|
|
29
|
+
factory(errors, parser, annot) {
|
|
30
|
+
const { ParseError } = errors;
|
|
31
|
+
const { isType } = parser;
|
|
32
|
+
const { typeBaseAnnot, captureExtras } = annot;
|
|
33
|
+
|
|
34
|
+
const KNOWN = new Set(['Open', 'Name', 'State', 'StateModel']);
|
|
35
|
+
|
|
36
|
+
function typeTextAnnot(dict) {
|
|
37
|
+
const base = typeBaseAnnot(dict);
|
|
38
|
+
if (base.subtype && base.subtype !== 'Text') {
|
|
39
|
+
throw new ParseError('pdf/annot/text/bad-subtype',
|
|
40
|
+
'/Subtype must be /Text',
|
|
41
|
+
{ context: { actual: base.subtype } });
|
|
42
|
+
}
|
|
43
|
+
const e = dict.entries;
|
|
44
|
+
base.open = isType(e.Open, 'bool') ? !!e.Open.value : false;
|
|
45
|
+
base.iconName = isType(e.Name, 'name') ? e.Name.value : null;
|
|
46
|
+
base.state = isType(e.State, 'string') ? e.State.value : null;
|
|
47
|
+
base.stateModel = isType(e.StateModel, 'string') ? e.StateModel.value : null;
|
|
48
|
+
captureExtras(base, dict, KNOWN);
|
|
49
|
+
return base;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return { typeTextAnnot };
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Widget annotation per ISO 32000-2:2020 §12.5.6.19.
|
|
8
|
+
*
|
|
9
|
+
* Widgets are the annotation side of form fields. This typer addresses
|
|
10
|
+
* only the annotation entries — field typing lives in `pdf/form/*`.
|
|
11
|
+
*
|
|
12
|
+
* Subtype-specific entries:
|
|
13
|
+
* /H name — highlight mode (N, I, O, P, T)
|
|
14
|
+
* /MK dict — appearance characteristics
|
|
15
|
+
* /A dict — action triggered when activated
|
|
16
|
+
* /AA dict — additional actions
|
|
17
|
+
* /BS dict — border style (on base)
|
|
18
|
+
* /Parent ref — parent field (hierarchical)
|
|
19
|
+
*
|
|
20
|
+
* @module pdf/annot/widget
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Module factory.
|
|
25
|
+
*/
|
|
26
|
+
import { pdfErrors } from '../errors.js';
|
|
27
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
28
|
+
import { pdfAnnot } from './annot.js';
|
|
29
|
+
|
|
30
|
+
export const pdfWidgetAnnot = {
|
|
31
|
+
name: 'pdfWidgetAnnot',
|
|
32
|
+
dependencies: ['pdfErrors', 'pdfParser', 'pdfAnnot'],
|
|
33
|
+
deps: [pdfErrors, pdfParser, pdfAnnot],
|
|
34
|
+
factory(errors, parser, annot) {
|
|
35
|
+
const { ParseError } = errors;
|
|
36
|
+
const { isType } = parser;
|
|
37
|
+
const { typeBaseAnnot, captureExtras } = annot;
|
|
38
|
+
|
|
39
|
+
const KNOWN = new Set(['H', 'MK', 'A', 'AA', 'Parent']);
|
|
40
|
+
|
|
41
|
+
function typeWidgetAnnot(dict) {
|
|
42
|
+
const base = typeBaseAnnot(dict);
|
|
43
|
+
if (base.subtype && base.subtype !== 'Widget') {
|
|
44
|
+
throw new ParseError('pdf/annot/widget/bad-subtype',
|
|
45
|
+
'/Subtype must be /Widget',
|
|
46
|
+
{ context: { actual: base.subtype } });
|
|
47
|
+
}
|
|
48
|
+
const e = dict.entries;
|
|
49
|
+
base.h = isType(e.H, 'name') ? e.H.value : null;
|
|
50
|
+
base.mk = isType(e.MK, 'dict') ? e.MK : null;
|
|
51
|
+
base.action = isType(e.A, 'dict') ? e.A : null;
|
|
52
|
+
base.aa = isType(e.AA, 'dict') ? e.AA : null;
|
|
53
|
+
base.parent = e.Parent && e.Parent.type === 'ref'
|
|
54
|
+
? { num: e.Parent.num, gen: e.Parent.gen } : null;
|
|
55
|
+
captureExtras(base, dict, KNOWN);
|
|
56
|
+
return base;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { typeWidgetAnnot };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Associated Files typing per ISO 32000-2:2020 annex
|
|
8
|
+
* "PDF20_AN002 — Associated Files".
|
|
9
|
+
*
|
|
10
|
+
* PDF 2.0 introduces `/AF`, an array of indirect references to File
|
|
11
|
+
* Specification dicts, attachable to the Catalog, a Page, an XObject,
|
|
12
|
+
* a Form Field, an Annotation, a Mark, or a Structure Element. Each
|
|
13
|
+
* referenced filespec must carry an `/AFRelationship` name.
|
|
14
|
+
*
|
|
15
|
+
* Standard relationships: Source, Data, Alternative, Supplement,
|
|
16
|
+
* EncryptedPayload, FormData, Schema, Unspecified.
|
|
17
|
+
*
|
|
18
|
+
* @module pdf/associatedFiles/associatedFiles
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Module factory.
|
|
23
|
+
*/
|
|
24
|
+
import { pdfErrors } from '../errors.js';
|
|
25
|
+
import { pdfParser } from '../syntax/parser.js';
|
|
26
|
+
|
|
27
|
+
export const pdfAssociatedFiles = {
|
|
28
|
+
name: 'pdfAssociatedFiles',
|
|
29
|
+
dependencies: ['pdfErrors', 'pdfParser'],
|
|
30
|
+
deps: [pdfErrors, pdfParser],
|
|
31
|
+
factory(errors, parser) {
|
|
32
|
+
const { ParseError } = errors;
|
|
33
|
+
const { isType } = parser;
|
|
34
|
+
|
|
35
|
+
const STANDARD = new Set([
|
|
36
|
+
'Source', 'Data', 'Alternative', 'Supplement',
|
|
37
|
+
'EncryptedPayload', 'FormData', 'Schema', 'Unspecified'
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
function typeAssociatedFiles(arr, resolveRef) {
|
|
41
|
+
if (!isType(arr, 'array')) {
|
|
42
|
+
throw new ParseError('pdf/af/not-array',
|
|
43
|
+
'/AF must be an array',
|
|
44
|
+
{ context: { type: arr && arr.type } });
|
|
45
|
+
}
|
|
46
|
+
const out = [];
|
|
47
|
+
for (let i = 0; i < arr.items.length; i++) {
|
|
48
|
+
const it = arr.items[i];
|
|
49
|
+
let dict = it;
|
|
50
|
+
if (it.type === 'ref') {
|
|
51
|
+
if (typeof resolveRef !== 'function') {
|
|
52
|
+
out.push({ ref: it, resolved: false });
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
dict = resolveRef(it);
|
|
56
|
+
}
|
|
57
|
+
if (!isType(dict, 'dict')) {
|
|
58
|
+
throw new ParseError('pdf/af/bad-entry',
|
|
59
|
+
'/AF entries must resolve to a dict',
|
|
60
|
+
{ context: { index: i, type: dict && dict.type } });
|
|
61
|
+
}
|
|
62
|
+
const rel = dict.entries.AFRelationship;
|
|
63
|
+
let relValue = null, standard = false;
|
|
64
|
+
if (rel) {
|
|
65
|
+
if (rel.type !== 'name') {
|
|
66
|
+
throw new ParseError('pdf/af/bad-relationship',
|
|
67
|
+
'/AFRelationship must be a name',
|
|
68
|
+
{ context: { index: i, type: rel.type } });
|
|
69
|
+
}
|
|
70
|
+
relValue = rel.value;
|
|
71
|
+
standard = STANDARD.has(relValue);
|
|
72
|
+
}
|
|
73
|
+
const rec = {
|
|
74
|
+
filespec: dict,
|
|
75
|
+
relationship: relValue,
|
|
76
|
+
standard
|
|
77
|
+
};
|
|
78
|
+
if (it.type === 'ref') rec.ref = { num: it.num, gen: it.gen };
|
|
79
|
+
out.push(rec);
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return { typeAssociatedFiles };
|
|
85
|
+
}
|
|
86
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
+
// Dual-licensed; see the NOTICE file for licensing and any additional terms.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview `@awacloud/pdf/bundles/pdf-full` — full PDF 2.0 strict bundle.
|
|
8
|
+
*
|
|
9
|
+
* Pure fw factory descriptor. Declares the core `pdf` orchestrator and
|
|
10
|
+
* every P0/P1/P2/P3 extra **except** the `legacy-*` family as
|
|
11
|
+
* dependencies. The runtime resolves every dependency transitively and
|
|
12
|
+
* passes the already-constructed instances to the factory, which wires
|
|
13
|
+
* them into the `pdf` core via `pdf.use(...)` and returns the enriched
|
|
14
|
+
* instance.
|
|
15
|
+
*
|
|
16
|
+
* Consumption is exclusively declarative — register the descriptor in a
|
|
17
|
+
* `ModuleRuntime` and call `runtime.resolve('pdfFullBundle')`.
|
|
18
|
+
*
|
|
19
|
+
* Suitable for callers that need 100% PDF 2.0 strict coverage. For
|
|
20
|
+
* PDF 1.7 read support + 1.7→2.0 conversion, use `pdf-legacy` instead.
|
|
21
|
+
*
|
|
22
|
+
* @module pdf/bundles/pdf-full
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { pdf } from '../pdf.js';
|
|
26
|
+
import { pdfContentOpsExtended } from '../extra/content-ops-extended.js';
|
|
27
|
+
import { pdfFontCidTyped } from '../extra/font-cid-typed.js';
|
|
28
|
+
import { pdfFontColorTagging } from '../extra/font-color-tagging.js';
|
|
29
|
+
import { pdfTaggedPdfTyped } from '../extra/tagged-pdf-typed.js';
|
|
30
|
+
import { pdfAnnotExtended } from '../extra/annot-extended.js';
|
|
31
|
+
import { pdfAOutputIntent } from '../extra/pdf-a-output-intent.js';
|
|
32
|
+
import { pdfUaTagged } from '../extra/pdf-ua-tagged.js';
|
|
33
|
+
import { pdfFormActionsExtended } from '../extra/form-actions-extended.js';
|
|
34
|
+
import { pdfColorSpacesExtended } from '../extra/color-spaces-extended.js';
|
|
35
|
+
import { pdfShadingTyped } from '../extra/shading-typed.js';
|
|
36
|
+
import { pdfTransparencyTyped } from '../extra/transparency-typed.js';
|
|
37
|
+
import { pdfSigPades } from '../extra/sig-pades.js';
|
|
38
|
+
import { pdfSigAesGcm } from '../extra/sig-aes-gcm.js';
|
|
39
|
+
import { pdfDocumentParts } from '../extra/document-parts.js';
|
|
40
|
+
import { pdfRedactionIso32005 } from '../extra/redaction-iso32005.js';
|
|
41
|
+
import { pdfXPrepress } from '../extra/pdf-x-prepress.js';
|
|
42
|
+
import { pdfWellTagged } from '../extra/well-tagged-pdf.js';
|
|
43
|
+
import { pdfOptionalContentExtended } from '../extra/optional-content-extended.js';
|
|
44
|
+
import { pdfEmbeddedFilesPortfolio } from '../extra/embedded-files-portfolio.js';
|
|
45
|
+
import { pdfAssociatedFiles2 } from '../extra/associated-files.js';
|
|
46
|
+
import { pdfXmpExtended } from '../extra/xmp-extended.js';
|
|
47
|
+
import { pdfLinearizationWrite } from '../extra/linearization-write.js';
|
|
48
|
+
import { pdf3dRichMedia } from '../extra/3d-richmedia.js';
|
|
49
|
+
import { pdfJbig2Read } from '../extra/jbig2-read.js';
|
|
50
|
+
import { pdfMisc } from '../extra/misc.js';
|
|
51
|
+
import { pdfInfoDictDeprecated } from '../extra/info-dict-deprecated.js';
|
|
52
|
+
import { pdfSandbox } from '../extra/pdf-sandbox.js';
|
|
53
|
+
|
|
54
|
+
export const pdfFullBundle = {
|
|
55
|
+
name: 'pdfFullBundle',
|
|
56
|
+
dependencies: [
|
|
57
|
+
'pdf',
|
|
58
|
+
'pdfContentOpsExtended', 'pdfFontCidTyped', 'pdfFontColorTagging',
|
|
59
|
+
'pdfTaggedPdfTyped', 'pdfAnnotExtended', 'pdfAOutputIntent', 'pdfUaTagged',
|
|
60
|
+
'pdfFormActionsExtended', 'pdfColorSpacesExtended', 'pdfShadingTyped',
|
|
61
|
+
'pdfTransparencyTyped', 'pdfSigPades', 'pdfSigAesGcm', 'pdfDocumentParts',
|
|
62
|
+
'pdfRedactionIso32005', 'pdfXPrepress', 'pdfWellTagged',
|
|
63
|
+
'pdfOptionalContentExtended', 'pdfEmbeddedFilesPortfolio',
|
|
64
|
+
'pdfAssociatedFiles2', 'pdfXmpExtended',
|
|
65
|
+
'pdfLinearizationWrite', 'pdf3dRichMedia', 'pdfJbig2Read', 'pdfMisc',
|
|
66
|
+
'pdfInfoDictDeprecated', 'pdfSandbox'
|
|
67
|
+
],
|
|
68
|
+
deps: [pdf, pdfContentOpsExtended, pdfFontCidTyped, pdfFontColorTagging, pdfTaggedPdfTyped, pdfAnnotExtended, pdfAOutputIntent, pdfUaTagged, pdfFormActionsExtended, pdfColorSpacesExtended, pdfShadingTyped, pdfTransparencyTyped, pdfSigPades, pdfSigAesGcm, pdfDocumentParts, pdfRedactionIso32005, pdfXPrepress, pdfWellTagged, pdfOptionalContentExtended, pdfEmbeddedFilesPortfolio, pdfAssociatedFiles2, pdfXmpExtended, pdfLinearizationWrite, pdf3dRichMedia, pdfJbig2Read, pdfMisc, pdfInfoDictDeprecated, pdfSandbox],
|
|
69
|
+
factory(pdf, ...instances) {
|
|
70
|
+
const names = [
|
|
71
|
+
'pdfContentOpsExtended', 'pdfFontCidTyped', 'pdfFontColorTagging',
|
|
72
|
+
'pdfTaggedPdfTyped', 'pdfAnnotExtended', 'pdfAOutputIntent', 'pdfUaTagged',
|
|
73
|
+
'pdfFormActionsExtended', 'pdfColorSpacesExtended', 'pdfShadingTyped',
|
|
74
|
+
'pdfTransparencyTyped', 'pdfSigPades', 'pdfSigAesGcm', 'pdfDocumentParts',
|
|
75
|
+
'pdfRedactionIso32005', 'pdfXPrepress', 'pdfWellTagged',
|
|
76
|
+
'pdfOptionalContentExtended', 'pdfEmbeddedFilesPortfolio',
|
|
77
|
+
'pdfAssociatedFiles2', 'pdfXmpExtended',
|
|
78
|
+
'pdfLinearizationWrite', 'pdf3dRichMedia', 'pdfJbig2Read', 'pdfMisc',
|
|
79
|
+
'pdfInfoDictDeprecated', 'pdfSandbox'
|
|
80
|
+
];
|
|
81
|
+
for (let i = 0; i < names.length; i++) {
|
|
82
|
+
const name = names[i];
|
|
83
|
+
const inst = instances[i];
|
|
84
|
+
pdf.use({
|
|
85
|
+
name,
|
|
86
|
+
register() { return { [name]: inst }; }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return pdf;
|
|
90
|
+
}
|
|
91
|
+
};
|