@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,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfTextAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfTextAnnot
|
|
11
|
+
|
|
12
|
+
> Sticky-note annotation — ISO 32000-2 §12.5.6.4.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfTextAnnot` | **Source** `packages/front/office/pdf/src/annot/text.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Text`: a sticky note. Subtype-specific entries are `/Open` (initial
|
|
17
|
+
pop-up state), `/Name` (icon — `Note`, `Comment`, `Help`, `Insert`, `Key`,
|
|
18
|
+
`NewParagraph`, `Paragraph`), `/State` and `/StateModel`. Everything from
|
|
19
|
+
`typeBaseAnnot` is inherited; every other entry — including the markup entries
|
|
20
|
+
`/T`, `/Subj`, `/RC`, `/CreationDate`, `/IRT`, `/RT`, `/Popup` — lands in
|
|
21
|
+
`_extras`.
|
|
22
|
+
|
|
23
|
+
## Resolve
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const text = runtime.resolve('pdfTextAnnot');
|
|
27
|
+
// Returns: { typeTextAnnot }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| Method | Signature | Returns |
|
|
33
|
+
|--------|-----------|---------|
|
|
34
|
+
| `typeTextAnnot` | `(dict) => TextAnnot` | Base record plus `open`, `iconName`, `state`, `stateModel`. |
|
|
35
|
+
|
|
36
|
+
`state` and `stateModel` are the raw `Uint8Array` payloads of the PDF strings;
|
|
37
|
+
`open` defaults to `false` and `iconName` to `null`.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Type a sticky note
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const t = runtime.resolve('pdfTextAnnot').typeTextAnnot(dict);
|
|
45
|
+
t.iconName; // 'Note'
|
|
46
|
+
t.open; // false by default
|
|
47
|
+
t._extras.T; // /T (author) — typed string object
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Through the dispatcher
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
const annot = runtime.resolve('pdfAnnot');
|
|
54
|
+
const a = annot.typeAnnot(dict, { Text: runtime.resolve('pdfTextAnnot').typeTextAnnot });
|
|
55
|
+
if (a.kind === 'Text') { /* … */ }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
| Code | Class | When |
|
|
61
|
+
|------|-------|------|
|
|
62
|
+
| `pdf/annot/not-dict` | `ParseError` | Inherited from `typeBaseAnnot`. |
|
|
63
|
+
| `pdf/annot/bad-type` | `ParseError` | Inherited from `typeBaseAnnot`. |
|
|
64
|
+
| `pdf/annot/text/bad-subtype` | `ParseError` | `/Subtype` present and not `/Text`. |
|
|
65
|
+
|
|
66
|
+
## See also
|
|
67
|
+
|
|
68
|
+
- [`pdfAnnot`](./annot.md)
|
|
69
|
+
- [`pdfPopupAnnot`](./popup.md) — the associated `/Popup`.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfWidgetAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfWidgetAnnot
|
|
11
|
+
|
|
12
|
+
> Widget annotation (form field visual) — ISO 32000-2 §12.5.6.19.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfWidgetAnnot` | **Source** `packages/front/office/pdf/src/annot/widget.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Widget`: the visual half of an AcroForm field (§12.7), frequently
|
|
17
|
+
merged into the field dictionary itself. Subtype-specific entries: `/H`
|
|
18
|
+
(highlight mode), `/MK` (appearance characteristics —
|
|
19
|
+
`BC`/`BG`/`CA`/`R`/`IF`/`I`/`RI`/`IX`/`TP`), `/A` and `/AA` (action plus trigger
|
|
20
|
+
events) and `/Parent` (link back into the field tree). `/BS` belongs to the base
|
|
21
|
+
record.
|
|
22
|
+
|
|
23
|
+
## Resolve
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const w = runtime.resolve('pdfWidgetAnnot');
|
|
27
|
+
// Returns: { typeWidgetAnnot }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| Method | Signature | Returns |
|
|
33
|
+
|--------|-----------|---------|
|
|
34
|
+
| `typeWidgetAnnot` | `(dict) => WidgetAnnot` | Base record plus `h`, `mk`, `action`, `aa`, `parent`. |
|
|
35
|
+
|
|
36
|
+
`/A` is surfaced as `action` (only when it is a dictionary); `parent` is
|
|
37
|
+
`{ num, gen }` when `/Parent` is an indirect reference, `null` otherwise.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Visual rendering of a text field
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const w = runtime.resolve('pdfWidgetAnnot').typeWidgetAnnot(dict);
|
|
45
|
+
w.mk?.entries.BC; // border colour
|
|
46
|
+
w.mk?.entries.BG; // background colour
|
|
47
|
+
w.h; // 'I' (invert) | 'N' | 'O' | 'P' | 'T'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Action triggers
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
w.aa?.entries.K; // keystroke action
|
|
54
|
+
w.aa?.entries.V; // validate action
|
|
55
|
+
w.aa?.entries.F; // format action
|
|
56
|
+
w.action; // /A — activation action dictionary
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Errors
|
|
60
|
+
|
|
61
|
+
| Code | Class | When |
|
|
62
|
+
|------|-------|------|
|
|
63
|
+
| `pdf/annot/widget/bad-subtype` | `ParseError` | `/Subtype` present and not `/Widget`. |
|
|
64
|
+
|
|
65
|
+
## See also
|
|
66
|
+
|
|
67
|
+
- [`pdfAnnot`](./annot.md)
|
|
68
|
+
- [`pdfAcroForm`](../form/acroform.md) · [`pdfFieldTree`](../form/fieldTree.md)
|
|
69
|
+
- [`pdfAction`](../action/action.md)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Associated Files — PDF 2.0 / PDF20_AN002-AF annex
|
|
2
|
+
|
|
3
|
+
| Module | Returns | Deps | Description |
|
|
4
|
+
|--------|----------|------|-------------|
|
|
5
|
+
| [`pdfAssociatedFiles`](./associatedFiles.md) | `{ typeAssociatedFiles }` | `pdfErrors`, `pdfParser` | `/AF` array, PDF 2.0. |
|
|
6
|
+
|
|
7
|
+
## See also
|
|
8
|
+
|
|
9
|
+
- [Embedded](../embedded/README.md)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfAssociatedFiles
|
|
3
|
+
category: pdf/associatedFiles
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfAssociatedFiles
|
|
11
|
+
|
|
12
|
+
> Associated Files — PDF 2.0 (PDF20_AN002-AF annex).
|
|
13
|
+
|
|
14
|
+
**Module** `pdfAssociatedFiles` | **Source** `packages/front/office/pdf/src/associatedFiles/associatedFiles.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
PDF 2.0's *Associated Files* mechanism (§14.13) lets *any* PDF object (Catalog, page, annotation, image XObject, structure element, …) attach a file spec via `/AF`, tagged with the file spec's own `/AFRelationship`. This module types an `/AF` array (one or more file spec entries).
|
|
17
|
+
|
|
18
|
+
Standard `/AFRelationship` values: `Source` (this PDF is derived from the source), `Data` (data used by the object), `Alternative` (alternate rendering), `Supplement` (supplementary info), `EncryptedPayload`, `FormData` (PDF 2.0), `Schema`, `Unspecified`.
|
|
19
|
+
|
|
20
|
+
**The returned file spec is the raw parser dict node, not a `pdfFileSpec.typeFileSpec()` result** — call `typeFileSpec` yourself on `.filespec` if you need the convenience accessors (`.uf`, `.f`, …).
|
|
21
|
+
|
|
22
|
+
## Resolve
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const af = runtime.resolve('pdfAssociatedFiles');
|
|
26
|
+
// Returns: { typeAssociatedFiles }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Method | Signature | Returns |
|
|
32
|
+
|---------|-----------|----------|
|
|
33
|
+
| `typeAssociatedFiles` | `(arr, resolveRef?) => AssociatedFile[]` | List of associated-file records. |
|
|
34
|
+
|
|
35
|
+
### Shape `AssociatedFile`
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
// entry successfully resolved to a dict:
|
|
39
|
+
{ filespec: PdfDict, relationship: string | null, standard: boolean, ref?: { num, gen } }
|
|
40
|
+
|
|
41
|
+
// entry is an unresolved ref and no resolveRef was supplied:
|
|
42
|
+
{ ref: PdfRef, resolved: false }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
### AF on the Catalog
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
const af = runtime.resolve('pdfAssociatedFiles');
|
|
51
|
+
const fileSpecModule = runtime.resolve('pdfFileSpec');
|
|
52
|
+
const files = af.typeAssociatedFiles(catalog.af, doc._raw.resolve);
|
|
53
|
+
for (const f of files) {
|
|
54
|
+
f.relationship; // 'Source' | 'Data' | …
|
|
55
|
+
const fs = fileSpecModule.typeFileSpec(f.filespec);
|
|
56
|
+
fs.uf; // filename
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### AF on an image (PDF/A-3, PDF/A-4)
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
const files = af.typeAssociatedFiles(stream.dict.entries.AF, resolveRef);
|
|
64
|
+
// Source data attached to the image
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Errors
|
|
68
|
+
|
|
69
|
+
| Code | Class | When |
|
|
70
|
+
|------|--------|------|
|
|
71
|
+
| `pdf/af/not-array` | `ParseError` | Argument is not an array. |
|
|
72
|
+
| `pdf/af/bad-entry` | `ParseError` | An entry resolves to neither a dict nor a ref. |
|
|
73
|
+
| `pdf/af/bad-relationship` | `ParseError` | `/AFRelationship` is not a name. |
|
|
74
|
+
|
|
75
|
+
## See also
|
|
76
|
+
|
|
77
|
+
- [`pdfFileSpec`](../embedded/fileSpec.md) · [`pdfEmbeddedFile`](../embedded/embeddedFile.md)
|
|
78
|
+
- [`pdfCatalog`](../document/catalog.md) · [`pdfPage`](../document/page.md)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Bundles — pre-wired pdf API factories
|
|
2
|
+
|
|
3
|
+
Three module descriptors re-export the core PDF API with different subsets of extras wired in. Each declares its dependencies (core `pdf` + extras) and is resolved through a `ModuleRuntime`; the factory wires the extras into `pdf` via `.use(...)` and returns the enriched instance with `.read()`, `.write()`, `.use()`, and a namespace per wired extra.
|
|
4
|
+
|
|
5
|
+
| Bundle | Extras | When to choose |
|
|
6
|
+
|--------|--------|---------------|
|
|
7
|
+
| [`pdfLargeBundle`](./pdf-large.md) | P0 + P1 | Standard production: the common PDF 2.0 features. No linearization-dictionary builder, no 3D, no legacy 1.7. |
|
|
8
|
+
| [`pdfFullBundle`](./pdf-full.md) | P0 + P1 + P2 + P3 | Every PDF 2.0 extra. Adds the linearization-dictionary builder, 3D/RichMedia, JBIG2 segment-header read, Info lint, misc tail, sandbox. |
|
|
9
|
+
| [`pdfLegacyBundle`](./pdf-legacy.md) | full + `legacy-*` | Legacy 1.7 ingestion. Adds XFA read, RC4 decryption helpers, LZW / CCITT fax decode and DCT / JPX passthrough, Sound/Movie/Screen typing. |
|
|
10
|
+
|
|
11
|
+
Each bundle's extras are listed literally in its descriptor's `dependencies`
|
|
12
|
+
and enumerated on its page.
|
|
13
|
+
|
|
14
|
+
These three descriptors are the **source-side** bundles. The committed `dist/` build additionally crosses them with a Read / Read+Write family axis — see [Committed `dist/` bundle matrix](./dist-matrix.md) for the eight roots, the `-rw` naming scheme and the write inventory. Every `-rw` root also ships the signature verifier `pdfSignature` beside the signer, so a Read+Write bundle can verify what it signs; no Read root carries it.
|
|
15
|
+
|
|
16
|
+
Bundles are `{ name, dependencies, factory }` descriptors — consumption is exclusively declarative via `ModuleRuntime`. The three bundle descriptors are reachable through the root `bundle` array (as above) or through their own subpath exports (`@awacloud/pdf/pdf-large`, `@awacloud/pdf/pdf-full`, `@awacloud/pdf/pdf-legacy`); they are **not** re-exported from the package root by binding name, so `import { pdfLargeBundle } from '@awacloud/pdf'` is `undefined`. The same holds for every `extras` descriptor.
|
|
17
|
+
|
|
18
|
+
## Common pattern
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { ModuleRuntime } from '@awacloud/fw/core/runtime.js';
|
|
22
|
+
import { fw_require, pkg_require, modules, extras, bundle } from '@awacloud/pdf';
|
|
23
|
+
|
|
24
|
+
const rt = new ModuleRuntime();
|
|
25
|
+
for (const m of fw_require) rt.register(m);
|
|
26
|
+
for (const m of pkg_require) rt.register(m);
|
|
27
|
+
for (const m of modules) rt.register(m);
|
|
28
|
+
for (const m of extras) rt.register(m);
|
|
29
|
+
for (const m of bundle) rt.register(m);
|
|
30
|
+
|
|
31
|
+
const api = rt.resolve('pdfLargeBundle');
|
|
32
|
+
const doc = api.read(bytes); // PDF 2.0 read
|
|
33
|
+
const out = api.write(doc); // PDF 2.0 write
|
|
34
|
+
|
|
35
|
+
// Extras are reachable by their own name
|
|
36
|
+
api.pdfSigPades.detectPadesProfile(sigDict, ctx);
|
|
37
|
+
|
|
38
|
+
// Adding a custom extra
|
|
39
|
+
api.use({
|
|
40
|
+
name: 'myExt',
|
|
41
|
+
register() { return { myExt: { /* … */ } }; }
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Decision
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Ingesting only PDF 2.0?
|
|
49
|
+
├── strict + simple → pdf-large
|
|
50
|
+
└── strict + complete (linearization dictionary, 3D, JBIG2 headers, Info lint) → pdf-full
|
|
51
|
+
|
|
52
|
+
Ingesting PDF 1.7 (XFA, RC4, LZW, Sound/Movie)?
|
|
53
|
+
└── → pdf-legacy (write still emits a %PDF-2.0 header; legacy content is not converted)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Common errors
|
|
57
|
+
|
|
58
|
+
| Code | Class | When |
|
|
59
|
+
|------|--------|------|
|
|
60
|
+
| `pdf/use/bad-extension` | `ContractError` | `.use()` is called with an object missing `name`/`register` (thrown by the core `pdf` orchestrator itself; every bundle inherits it). |
|
|
61
|
+
| `pdf/filters/missing-lzw` | `ParseError` | `pdf-legacy` only — `pdfLegacyDeprecatedFilters` constructed without a valid `@awacloud/fw` `lzw` factory output. |
|
|
62
|
+
|
|
63
|
+
## See also
|
|
64
|
+
|
|
65
|
+
- [Committed `dist/` bundle matrix](./dist-matrix.md)
|
|
66
|
+
- [Extras](../extra/README.md)
|
|
67
|
+
- [`pdf`](../pdf.md)
|
|
68
|
+
- [API index](../README.md)
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: pdf/bundles
|
|
3
|
+
status: complete
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Committed `dist/` bundle matrix
|
|
7
|
+
|
|
8
|
+
> Two bundle families — Read and Read+Write — across the four size segments.
|
|
9
|
+
|
|
10
|
+
This page is a reference page for the committed `dist/` build, not a module
|
|
11
|
+
page: no descriptor is named `dist-matrix`.
|
|
12
|
+
|
|
13
|
+
**Generated by** `packages/front/office/pdf/tools/generate-bundles.mjs` | **Surfaces** `dist/build/` (fw-mode) + `dist/standalone/` (framework-free) | **Since** 2026-08-04
|
|
14
|
+
|
|
15
|
+
The committed build is a matrix of two independent axes:
|
|
16
|
+
|
|
17
|
+
- **size segmentation** (frozen): `pdf` (bare core), `pdf-large`, `pdf-full`,
|
|
18
|
+
`pdf-legacy` — the extras layered on top of the core;
|
|
19
|
+
- **capability family** (this page): **Read** and **Read+Write**.
|
|
20
|
+
|
|
21
|
+
Both axes cross with the two path-discriminated surfaces (`dist/build/` and
|
|
22
|
+
`dist/standalone/`), so every cell ships a `.js` / `.min.js` / `.meta.json`
|
|
23
|
+
triplet: 8 roots × 2 surfaces × 3 files = 48 files, plus the single
|
|
24
|
+
`dist/build/index.js` fw-mode barrel.
|
|
25
|
+
|
|
26
|
+
## Naming scheme
|
|
27
|
+
|
|
28
|
+
The discriminator is a trailing **`-rw` segment on the root name**; the
|
|
29
|
+
**absence** of a discriminator marks the Read family. The four historical root
|
|
30
|
+
names are frozen — renaming them to `pdf-read.js` etc. would have *removed* a
|
|
31
|
+
published name, which the additive doctrine forbids.
|
|
32
|
+
|
|
33
|
+
| Family | Root names | Path |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Read | `pdf`, `pdf-large`, `pdf-full`, `pdf-legacy` | `@awacloud/pdf/{build,standalone}/<root>.js` |
|
|
36
|
+
| Read+Write | `pdf-rw`, `pdf-large-rw`, `pdf-full-rw`, `pdf-legacy-rw` | `@awacloud/pdf/{build,standalone}/<root>.js` |
|
|
37
|
+
|
|
38
|
+
Generated export names follow the surface suffix already in force:
|
|
39
|
+
`pdfRwBundled` / `pdfRwPackage`, `pdfLargeRwBundled` / `pdfLargeRwPackage`, and
|
|
40
|
+
so on.
|
|
41
|
+
|
|
42
|
+
## The matrix
|
|
43
|
+
|
|
44
|
+
Module counts are the `meta.json` `modules` closure (identical on both
|
|
45
|
+
surfaces); byte sizes are the `standalone` / `build` dev sizes.
|
|
46
|
+
|
|
47
|
+
| Segment | Read root | modules | Read+Write root | modules | Δ |
|
|
48
|
+
|---|---|---|---|---|---|
|
|
49
|
+
| bare core | `pdf` | 21 | `pdf-rw` | 35 | +14 |
|
|
50
|
+
| large | `pdf-large` | 43 | `pdf-large-rw` | 57 | +14 |
|
|
51
|
+
| full | `pdf-full` | 49 | `pdf-full-rw` | 63 | +14 |
|
|
52
|
+
| legacy | `pdf-legacy` | 54 | `pdf-legacy-rw` | 68 | +14 |
|
|
53
|
+
|
|
54
|
+
The composition is **strictly additive**: every Read root is a subset of its
|
|
55
|
+
Read+Write twin, and adding the Read+Write family left the four Read roots
|
|
56
|
+
unchanged.
|
|
57
|
+
|
|
58
|
+
## Write inventory
|
|
59
|
+
|
|
60
|
+
The Read+Write delta is the **write inventory** — the write-path modules that
|
|
61
|
+
are separable from the `pdf` orchestrator core — plus the
|
|
62
|
+
[verification surface](#verification-surface):
|
|
63
|
+
|
|
64
|
+
| Module | Surface | In every `-rw` root |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `pdfBuilder` | `builder()` | yes |
|
|
67
|
+
| `pdfIncrementalWriter` | `appendIncremental()` | yes |
|
|
68
|
+
| `pdfXrefStreamWriter` | `writeXrefStreamDocument()` | yes (required in every `-rw` root) |
|
|
69
|
+
| `pdfEncryptedWriter` | `writeEncryptedDocument()` | yes |
|
|
70
|
+
| `pdfSign` | `sign()` | yes |
|
|
71
|
+
| `pdfDssBuilder` | `buildDss()` | yes (transitive via `pdfSign`) |
|
|
72
|
+
|
|
73
|
+
Their closure also pulls in `pdfFlate`, `pdfAesGcm`, `pdfStandardV4/V5/V6`,
|
|
74
|
+
`pdfSigOids`, `pdfByteRange`, `pdfSha1` — all classified **shared** (each
|
|
75
|
+
exposes both directions, e.g. `encode`/`decode`, `encryptStream`/
|
|
76
|
+
`decryptStream`).
|
|
77
|
+
|
|
78
|
+
### Two documented exclusions
|
|
79
|
+
|
|
80
|
+
- **`pdfSerializer` and `pdfWriter` are core-embedded.** They are write-path
|
|
81
|
+
(`serializeObject`, `writeDocument`) but are declared dependencies of
|
|
82
|
+
`src/pdf.js` itself — `pdf.write()` is part of the core facade. They cannot
|
|
83
|
+
be factored out without changing `src/pdf.js`, so they are *not* part of the
|
|
84
|
+
composable inventory and the Read-family purity lock is stated against the
|
|
85
|
+
six modules above.
|
|
86
|
+
- **`pdfFontEmbed` is write-path but not shippable in a bundle.** Its four
|
|
87
|
+
declared dependencies (`embedSubsetForPdf`, `embedFontDescriptor`,
|
|
88
|
+
`embedCidSystemInfo`, `embedToUnicodeBuilder`) come from `pkg_require`
|
|
89
|
+
(`@awacloud/fonts`), which the generator's local registry
|
|
90
|
+
(`buildLocalRegistry(modules, extras)`) does not see — including it makes
|
|
91
|
+
`topoLocal` throw `Unknown module : embedSubsetForPdf`. Font embedding
|
|
92
|
+
therefore stays an fw-runtime-only capability.
|
|
93
|
+
|
|
94
|
+
## Verification surface
|
|
95
|
+
|
|
96
|
+
A bundle that can `sign()` can also verify: every `-rw` root ships the
|
|
97
|
+
read-path signature verifier beside the signer.
|
|
98
|
+
|
|
99
|
+
| Module | Surface | In every `-rw` root | In a Read root |
|
|
100
|
+
|---|---|---|---|
|
|
101
|
+
| `pdfSignature` | `verifySignature()`, `verifyAllSignatures()` | yes | no |
|
|
102
|
+
|
|
103
|
+
`pdfSignature` is a **read** module, not part of the write inventory; the
|
|
104
|
+
generator lists it separately (`VERIFY_SURFACE` in
|
|
105
|
+
`tools/generate-bundles.mjs`) so the inventory above stays exactly the set of
|
|
106
|
+
separable write modules.
|
|
107
|
+
|
|
108
|
+
It rides the Read+Write family, not the Read family, because the four Read
|
|
109
|
+
roots are byte-frozen: adding it left them, their `.meta.json` and the
|
|
110
|
+
`dist/build/index.js` barrel byte-identical. Its crypto closure already ships
|
|
111
|
+
through `pdfSign`, so it adds **no** `@awacloud/fw` dependency and no other
|
|
112
|
+
module — only `pdfSignature` itself joins each `-rw` closure. Measured cost
|
|
113
|
+
per `-rw` root: **+21.8 KB** minified (for example `build/pdf-rw.min.js`
|
|
114
|
+
121,323 → 143,156 bytes, +18.0 %; `standalone/pdf-legacy-rw.min.js`
|
|
115
|
+
336,801 → 358,735 bytes, +6.5 %) and **+6.4 KB** after gzip -9.
|
|
116
|
+
|
|
117
|
+
An invoked `-rw` factory exposes the verifier on the returned core:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import { pdfRwBundled } from '@awacloud/pdf/standalone/pdf-rw.js';
|
|
121
|
+
|
|
122
|
+
const core = pdfRwBundled.factory();
|
|
123
|
+
core.usedExtension('pdfSignature'); // → true
|
|
124
|
+
const { signatures, timestamps } = core.pdfSignature.verifyAllSignatures(bytes);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Module classification
|
|
128
|
+
|
|
129
|
+
All 95 `src/main.js#modules` factories were classified from their **resolved
|
|
130
|
+
API** (a fresh `ModuleRuntime` per module — the shared `pdf` singleton
|
|
131
|
+
order-poisons `Object.keys`):
|
|
132
|
+
|
|
133
|
+
| Class | Count | Rule |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| read | 68 | the returned API only parses, types, walks or verifies existing bytes |
|
|
136
|
+
| write | 9 | the returned API emits or assembles PDF output |
|
|
137
|
+
| shared | 18 | the returned API works both directions, or is a pure table/primitive |
|
|
138
|
+
|
|
139
|
+
The per-module table is the composition's contract; it is kept in the
|
|
140
|
+
source monorepo and is not published. The write and verification modules it
|
|
141
|
+
selects are listed above.
|
|
142
|
+
|
|
143
|
+
## Notes
|
|
144
|
+
|
|
145
|
+
- **The Read+Write family is a `dist/` composition only.** Its four bundle
|
|
146
|
+
plan entries live in `tools/generate-bundles.mjs`, not in
|
|
147
|
+
`src/main.js#bundle`, so `runtime.resolve('pdfRwBundle')` is *not* a
|
|
148
|
+
supported call. On an `@awacloud/fw` runtime, register the write modules
|
|
149
|
+
from the `modules` array (or the `dist/build/index.js` barrel) directly.
|
|
150
|
+
- **Invocability.** Every `dist/standalone` root is invocable with no
|
|
151
|
+
arguments, the layered ones included: the generator wraps each layered
|
|
152
|
+
entry in the `{ name, register }` envelope that `pdf.use()` requires, so
|
|
153
|
+
`pdfLargeBundled.factory()` or `pdfRwBundled.factory()` returns a core with
|
|
154
|
+
its extras registered (`core.usedExtension(name)`). The `dist/build`
|
|
155
|
+
roots need an `@awacloud/fw` runtime to inject their declared
|
|
156
|
+
dependencies.
|
|
157
|
+
- Regeneration is idempotent: `bun run gen:bundles` re-emits byte-identical
|
|
158
|
+
output (no build stamp; every bundle opens with the `/*! … */` licence
|
|
159
|
+
banner at byte 0).
|
|
160
|
+
|
|
161
|
+
## See also
|
|
162
|
+
|
|
163
|
+
- [Bundles](./README.md)
|
|
164
|
+
- [`pdfLargeBundle`](./pdf-large.md) · [`pdfFullBundle`](./pdf-full.md) · [`pdfLegacyBundle`](./pdf-legacy.md)
|
|
165
|
+
- [API index](../README.md)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfFullBundle
|
|
3
|
+
category: pdf/bundles
|
|
4
|
+
dependencies: [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]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfFullBundle
|
|
11
|
+
|
|
12
|
+
> Full strict PDF 2.0 bundle — `pdfLargeBundle`'s 21 extras + 6 more.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfFullBundle` | **Source** `packages/front/office/pdf/src/bundles/pdf-full.js` | **Deps** `pdf` + the 27 extras enumerated under [Extras wired](#extras-wired) (28 names total, listed literally in the frontmatter `dependencies`) | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
A module descriptor — declares the core plus every P0/P1/P2/P3 extra **except** the `legacy-*` family (27 extras total, one flat list — the source does not distinguish a separate "sandbox tail" tier). The runtime resolves the dependencies; the factory wires them into `pdf` via `.use(...)`. Fits callers that need every PDF 2.0 extra. For PDF 1.7 reading use [`pdfLegacyBundle`](./pdf-legacy.md).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { ModuleRuntime } from '@awacloud/fw/core/runtime.js';
|
|
22
|
+
import { fw_require, pkg_require, modules, extras, bundle } from '@awacloud/pdf';
|
|
23
|
+
|
|
24
|
+
const rt = new ModuleRuntime();
|
|
25
|
+
for (const m of fw_require) rt.register(m);
|
|
26
|
+
for (const m of pkg_require) rt.register(m);
|
|
27
|
+
for (const m of modules) rt.register(m);
|
|
28
|
+
for (const m of extras) rt.register(m);
|
|
29
|
+
for (const m of bundle) rt.register(m);
|
|
30
|
+
|
|
31
|
+
const api = rt.resolve('pdfFullBundle');
|
|
32
|
+
const doc = api.read(pdfBytes);
|
|
33
|
+
const out = api.write(doc);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The `extras` and `bundle` descriptors are **not** re-exported from the package root by binding name — `import { pdfFullBundle } from '@awacloud/pdf'` is `undefined`. Register the arrays as above, or import the single descriptor from its own subpath export (`import { pdfFullBundle } from '@awacloud/pdf/pdf-full';`).
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
| Export | Description |
|
|
41
|
+
|--------|-------------|
|
|
42
|
+
| `pdfFullBundle` | Descriptor `{ name, dependencies, factory }`. Resolved by `ModuleRuntime` → `pdf` instance wired with all 27 P0-P3 extras. |
|
|
43
|
+
|
|
44
|
+
The resolved instance is the core `pdf` object (`src/pdf.js`) with the 27 extras merged in — it carries `pdf`'s own 5 members plus one property per wired extra name:
|
|
45
|
+
|
|
46
|
+
| Member | Signature | Description |
|
|
47
|
+
|--------|-----------|--------------|
|
|
48
|
+
| `read` | `(bytes: Uint8Array) => doc` | Full document read. |
|
|
49
|
+
| `header` | `(bytes: Uint8Array) => { version, end }` | Header-only read, no xref/catalog walk. |
|
|
50
|
+
| `write` | `(doc) => Uint8Array` | PDF 2.0 write. |
|
|
51
|
+
| `use` | `(ext) => api` | Extension hook (idempotent by name); this is how the bundle factory wires each extra. |
|
|
52
|
+
| `usedExtension` | `(name: string) => boolean` | Whether an extension name has already been applied via `.use()`. The bundle factory calls `.use({ name, register })` once per wired extra (e.g. `'pdfSandbox'`), so `api.usedExtension('pdfSandbox')` is `true` right after resolve — `api.usedExtension('pdfFullBundle')` is `false`, since the bundle's own descriptor name is never itself passed to `.use()`. |
|
|
53
|
+
|
|
54
|
+
## Extras wired
|
|
55
|
+
|
|
56
|
+
Items 1-21 are [`pdfLargeBundle`](./pdf-large.md)'s extras, re-listed here so every member of the resolved instance is documented on this page; items 22-27 are `pdf-full`'s own additions.
|
|
57
|
+
|
|
58
|
+
| # | Extra | Phase | Status |
|
|
59
|
+
|---|-------|-------|--------|
|
|
60
|
+
| 1 | [`pdfContentOpsExtended`](../extra/content-ops-extended.md) | P0 | read |
|
|
61
|
+
| 2 | [`pdfFontCidTyped`](../extra/font-cid-typed.md) | P0 | read |
|
|
62
|
+
| 3 | [`pdfFontColorTagging`](../extra/font-color-tagging.md) | P0 | read |
|
|
63
|
+
| 4 | [`pdfTaggedPdfTyped`](../extra/tagged-pdf-typed.md) | P0 | read |
|
|
64
|
+
| 5 | [`pdfAnnotExtended`](../extra/annot-extended.md) | P0 | read |
|
|
65
|
+
| 6 | [`pdfAOutputIntent`](../extra/pdf-a-output-intent.md) | P0 | lint |
|
|
66
|
+
| 7 | [`pdfUaTagged`](../extra/pdf-ua-tagged.md) | P0 | lint |
|
|
67
|
+
| 8 | [`pdfFormActionsExtended`](../extra/form-actions-extended.md) | P1 | read |
|
|
68
|
+
| 9 | [`pdfColorSpacesExtended`](../extra/color-spaces-extended.md) | P1 | read |
|
|
69
|
+
| 10 | [`pdfShadingTyped`](../extra/shading-typed.md) | P1 | read |
|
|
70
|
+
| 11 | [`pdfTransparencyTyped`](../extra/transparency-typed.md) | P1 | read |
|
|
71
|
+
| 12 | [`pdfSigPades`](../extra/sig-pades.md) | P1 | read |
|
|
72
|
+
| 13 | [`pdfSigAesGcm`](../extra/sig-aes-gcm.md) | P1 | read |
|
|
73
|
+
| 14 | [`pdfDocumentParts`](../extra/document-parts.md) | P1 | read |
|
|
74
|
+
| 15 | [`pdfRedactionIso32005`](../extra/redaction-iso32005.md) | P1 | read |
|
|
75
|
+
| 16 | [`pdfXPrepress`](../extra/pdf-x-prepress.md) | P1 | lint |
|
|
76
|
+
| 17 | [`pdfWellTagged`](../extra/well-tagged-pdf.md) | P1 | lint |
|
|
77
|
+
| 18 | [`pdfOptionalContentExtended`](../extra/optional-content-extended.md) | P1 | read |
|
|
78
|
+
| 19 | [`pdfEmbeddedFilesPortfolio`](../extra/embedded-files-portfolio.md) | P1 | read |
|
|
79
|
+
| 20 | [`pdfAssociatedFiles2`](../extra/associated-files.md) | P1 | read |
|
|
80
|
+
| 21 | [`pdfXmpExtended`](../extra/xmp-extended.md) | P1 | read |
|
|
81
|
+
| 22 | [`pdfLinearizationWrite`](../extra/linearization-write.md) | P2 | write |
|
|
82
|
+
| 23 | [`pdf3dRichMedia`](../extra/3d-richmedia.md) | P2 | read |
|
|
83
|
+
| 24 | [`pdfJbig2Read`](../extra/jbig2-read.md) | P2 | read (partial) |
|
|
84
|
+
| 25 | [`pdfMisc`](../extra/misc.md) | P3 | read |
|
|
85
|
+
| 26 | [`pdfInfoDictDeprecated`](../extra/info-dict-deprecated.md) | P3 | lint |
|
|
86
|
+
| 27 | [`pdfSandbox`](../extra/pdf-sandbox.md) | P3 | opt-in audit hook |
|
|
87
|
+
|
|
88
|
+
## When to choose
|
|
89
|
+
|
|
90
|
+
- `pdf-large` — minimal: the common PDF 2.0 features.
|
|
91
|
+
- **`pdf-full`** — every PDF 2.0 extra. Choose it when the linearization-dictionary builder, 3D/RichMedia, JBIG2 segment-header read, or Info-dict lint are required.
|
|
92
|
+
- `pdf-legacy` — full + PDF 1.7 read (XFA, RC4, LZW, …).
|
|
93
|
+
|
|
94
|
+
## Examples
|
|
95
|
+
|
|
96
|
+
### Bootstrap
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
const api = rt.resolve('pdfFullBundle');
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Header only
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
api.header(bytes); // { version: '2.0', end: <offset> } — no xref/catalog walk
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Checking a wired extra
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
api.usedExtension('pdfSandbox'); // true — wired by the bundle factory
|
|
112
|
+
api.usedExtension('not-a-real-extra'); // false
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Emitting a linearized dict
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
const dict = api.pdfLinearizationWrite.buildLinearizedDict({
|
|
119
|
+
Linearized: 1.0, L: 50000, H: [200, 500],
|
|
120
|
+
O: 5, E: 4000, N: 10, T: 48000
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Enumerating a JBIG2 stream
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
const segs = api.pdfJbig2Read.parseSegments(jbig2Bytes);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Info → XMP audit
|
|
131
|
+
|
|
132
|
+
```js
|
|
133
|
+
const r = api.pdfInfoDictDeprecated.lint({ version: 2.0, info, xmpPresent: false });
|
|
134
|
+
r.warnings;
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Errors
|
|
138
|
+
|
|
139
|
+
| Code | Class | When |
|
|
140
|
+
|------|--------|------|
|
|
141
|
+
| `pdf/use/bad-extension` | `ContractError` | `.use()` is called with an object missing `name`/`register` (thrown by the core `pdf` orchestrator, not specific to bundles). |
|
|
142
|
+
|
|
143
|
+
## See also
|
|
144
|
+
|
|
145
|
+
- [`pdf-large`](./pdf-large.md)
|
|
146
|
+
- [`pdf-legacy`](./pdf-legacy.md)
|
|
147
|
+
- [Bundles index](./README.md)
|
|
148
|
+
- [Extras index](../extra/README.md)
|