@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,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdf3dRichMedia
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdf3dRichMedia
|
|
11
|
+
|
|
12
|
+
> 3D (§13.6.2) and RichMedia (§13.6.3) annotations — ISO 32000-2.
|
|
13
|
+
|
|
14
|
+
**Module** `pdf3dRichMedia` | **Source** `packages/front/office/pdf/src/extra/3d-richmedia.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
`/Subtype /3D` → references a 3D stream via `/3DD`, default view (`/3DV`), activation (`/3DA`), interactive flag (`/3DI`). `/Subtype /RichMedia` → `/RichMediaContent` with `/Assets`, `/Configurations`, `/Views`, and `/RichMediaSettings`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdf3dRichMedia');
|
|
22
|
+
// Returns: { type3DAnnot, type3DActivation, typeRichMediaAnnot,
|
|
23
|
+
// typeRichMediaContent, classifyRmInstanceState,
|
|
24
|
+
// RM_INSTANCE_STATES, ACTIVATION_CONDITIONS }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| Member | Signature | Returns |
|
|
30
|
+
|--------|-----------|---------|
|
|
31
|
+
| `type3DAnnot` | `(dict) => ThreeDAnnot` | `{ threeDD, threeDV, threeDA, threeDI, threeDB, raw, _extras }`. |
|
|
32
|
+
| `type3DActivation` | `(dict) => Activation` | `/3DA` fields `{ a, ais, d, dis, tb, np, raw }`. |
|
|
33
|
+
| `typeRichMediaAnnot` | `(dict) => RichMediaAnnot` | `{ content, settings, raw, _extras }`. |
|
|
34
|
+
| `typeRichMediaContent` | `(dict) => Content` | `{ assets, configurations, views, raw }`. |
|
|
35
|
+
| `classifyRmInstanceState` | `(name: string) => 'active' \| 'loaded' \| 'uninstantiated' \| null` | Looks up `RM_INSTANCE_STATES`. |
|
|
36
|
+
| `RM_INSTANCE_STATES` | frozen catalog | `{ A: 'active', L: 'loaded', U: 'uninstantiated' }`. |
|
|
37
|
+
| `ACTIVATION_CONDITIONS` | frozen catalog | `{ XA: 'explicit activate', PO: 'page open', PV: 'page visible' }`. |
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### 3D annotation
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const ext = runtime.resolve('pdf3dRichMedia');
|
|
45
|
+
const a = ext.type3DAnnot(annotDict);
|
|
46
|
+
a.threeDD; // ref to the 3D stream
|
|
47
|
+
a.threeDA.a; // 'PO' (activation condition)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### RichMedia content
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
const c = ext.typeRichMediaContent(contentDict);
|
|
54
|
+
c.assets; // raw /Assets entry
|
|
55
|
+
c.configurations; // raw /Configurations entry
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
| Code | Class | When |
|
|
61
|
+
|------|-------|------|
|
|
62
|
+
| `pdf/extra/3d/not-dict` | `ParseError` | Not a dict. |
|
|
63
|
+
| `pdf/extra/3d/bad-subtype` | `ParseError` | `/Subtype` is not `/3D`. |
|
|
64
|
+
| `pdf/extra/3d/missing-3dd` | `ParseError` | `/3DD` absent. |
|
|
65
|
+
| `pdf/extra/3d/act/not-dict` | `ParseError` | Activation is not a dict. |
|
|
66
|
+
| `pdf/extra/rm/not-dict` | `ParseError` | Not a dict. |
|
|
67
|
+
| `pdf/extra/rm/bad-subtype` | `ParseError` | `/Subtype` is not `/RichMedia`. |
|
|
68
|
+
| `pdf/extra/rm/missing-content` | `ParseError` | `/RichMediaContent` absent. |
|
|
69
|
+
| `pdf/extra/rm/content/not-dict` | `ParseError` | Content is not a dict. |
|
|
70
|
+
| `pdf/extra/rm/state/bad` | `ParseError` | State is not a string. |
|
|
71
|
+
|
|
72
|
+
## See also
|
|
73
|
+
|
|
74
|
+
- [`pdfAnnotExtended`](./annot-extended.md)
|
|
75
|
+
- [`pdfAnnot`](../annot/annot.md)
|
|
76
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Extras — L3+ opt-in coverage
|
|
2
|
+
|
|
3
|
+
Optional modules beyond core PDF 2.0. Each is a `{ name, dependencies, factory }` descriptor, consumable directly via `runtime.resolve(name)` or through `pdfApi.use(...)`. Grouped by phase priority.
|
|
4
|
+
|
|
5
|
+
## P0 — critical coverage (7)
|
|
6
|
+
|
|
7
|
+
| Module | Status | Description |
|
|
8
|
+
|--------|--------|-------------|
|
|
9
|
+
| [`pdfContentOpsExtended`](./content-ops-extended.md) | read | Extended gstate operators + full ExtGState catalog §8.4.5. |
|
|
10
|
+
| [`pdfFontCidTyped`](./font-cid-typed.md) | read | CIDFont, CSI, `/W`, predefined CMaps §9.7. |
|
|
11
|
+
| [`pdfFontColorTagging`](./font-color-tagging.md) | read | Color fonts (COLR/CPAL/sbix/SVG) §9.8.2. |
|
|
12
|
+
| [`pdfTaggedPdfTyped`](./tagged-pdf-typed.md) | read | Structural attribute owners §14.8.5. |
|
|
13
|
+
| [`pdfAnnotExtended`](./annot-extended.md) | read | Watermark/3D/RichMedia/Sound/Movie/Screen §12.5.6. |
|
|
14
|
+
| [`pdfAOutputIntent`](./pdf-a-output-intent.md) | lint | PDF/A detection + basic lint. |
|
|
15
|
+
| [`pdfUaTagged`](./pdf-ua-tagged.md) | lint | PDF/UA-1/2 linter. |
|
|
16
|
+
|
|
17
|
+
## P1 — extended coverage (14)
|
|
18
|
+
|
|
19
|
+
| Module | Status | Description |
|
|
20
|
+
|--------|--------|-------------|
|
|
21
|
+
| [`pdfFormActionsExtended`](./form-actions-extended.md) | read | Extended actions §12.6.4. |
|
|
22
|
+
| [`pdfColorSpacesExtended`](./color-spaces-extended.md) | read | Typed color spaces §8.6. |
|
|
23
|
+
| [`pdfShadingTyped`](./shading-typed.md) | read | Shadings 1-7 + Functions 0/2/3/4 §8.7.4 / §7.10. |
|
|
24
|
+
| [`pdfTransparencyTyped`](./transparency-typed.md) | read | Transparency Group + Soft Mask + blend modes §11. |
|
|
25
|
+
| [`pdfSigPades`](./sig-pades.md) | read | PAdES profile + DSS + Reference §12.8.4.3. |
|
|
26
|
+
| [`pdfSigAesGcm`](./sig-aes-gcm.md) | read | AES-GCM crypt filter ISO/TS 32003. |
|
|
27
|
+
| [`pdfDocumentParts`](./document-parts.md) | read | DPartRoot/DPart/DPM ISO/TS 32004. |
|
|
28
|
+
| [`pdfRedactionIso32005`](./redaction-iso32005.md) | read | Redaction workflow ISO/TS 32005. |
|
|
29
|
+
| [`pdfXPrepress`](./pdf-x-prepress.md) | lint | PDF/X profiles ISO 15930. |
|
|
30
|
+
| [`pdfWellTagged`](./well-tagged-pdf.md) | lint | WTPDF 1.0 best-practices. |
|
|
31
|
+
| [`pdfOptionalContentExtended`](./optional-content-extended.md) | read | OCG VE + Order tree + RBGroups §8.11. |
|
|
32
|
+
| [`pdfEmbeddedFilesPortfolio`](./embedded-files-portfolio.md) | read | Portfolio `/Schema`/`/Sort`/`/Navigator`. |
|
|
33
|
+
| [`pdfAssociatedFiles2`](./associated-files.md) | read | Extended `/AF`, PDF 2.0. |
|
|
34
|
+
| [`pdfXmpExtended`](./xmp-extended.md) | read | XMP packet extractor. |
|
|
35
|
+
|
|
36
|
+
## P2 — PDF 2.0 long tail (3)
|
|
37
|
+
|
|
38
|
+
| Module | Status | Description |
|
|
39
|
+
|--------|--------|-------------|
|
|
40
|
+
| [`pdfLinearizationWrite`](./linearization-write.md) | write | Linearization Parameter Dict (Annex F). |
|
|
41
|
+
| [`pdf3dRichMedia`](./3d-richmedia.md) | read | Detailed 3D/RichMedia §13.6. |
|
|
42
|
+
| [`pdfJbig2Read`](./jbig2-read.md) | read (partial) | JBIG2 segment headers — decode not implemented. |
|
|
43
|
+
|
|
44
|
+
## P3 — Catalog + Info tail, sandbox (3)
|
|
45
|
+
|
|
46
|
+
| Module | Status | Description |
|
|
47
|
+
|--------|--------|-------------|
|
|
48
|
+
| [`pdfMisc`](./misc.md) | read | SpiderInfo/Threads/Legal/Requirements/Perms/NeedsRendering. |
|
|
49
|
+
| [`pdfInfoDictDeprecated`](./info-dict-deprecated.md) | lint | Deprecated Info dict → XMP mapping. |
|
|
50
|
+
| [`pdfSandbox`](./pdf-sandbox.md) | lint | Active-content (Launch/JavaScript/SubmitForm/…) sandbox linter. |
|
|
51
|
+
|
|
52
|
+
## Legacy — PDF 1.7 read + deprecated filters (5)
|
|
53
|
+
|
|
54
|
+
| Module | Status | Description |
|
|
55
|
+
|--------|--------|-------------|
|
|
56
|
+
| [`pdfLegacyXfaRead`](./legacy-xfa-read.md) | read-only | Opaque `/XFA` packets. |
|
|
57
|
+
| [`pdfLegacyRc4Read`](./legacy-rc4-read.md) | read-only | RC4 v2/v3 password + decrypt. |
|
|
58
|
+
| [`pdfCcittFaxDecoder`](./ccitt-fax-decoder.md) | read + write | Full CCITT Group 3/Group 4 (T.4/T.6) codec. |
|
|
59
|
+
| [`pdfLegacyDeprecatedFilters`](./legacy-deprecated-filters.md) | read | LZW + CCITT (via `pdfCcittFaxDecoder`) + DCT + JPX. |
|
|
60
|
+
| [`pdfLegacyDeprecatedAnnots`](./legacy-deprecated-annots.md) | read | Sound/Movie/Screen in detail. |
|
|
61
|
+
|
|
62
|
+
## Common pattern
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { ModuleRuntime } from '@awacloud/fw/core/runtime.js';
|
|
66
|
+
import { fw_require, pkg_require, modules, extras, bundle } from '@awacloud/pdf';
|
|
67
|
+
|
|
68
|
+
const rt = new ModuleRuntime();
|
|
69
|
+
for (const m of fw_require) rt.register(m);
|
|
70
|
+
for (const m of pkg_require) rt.register(m);
|
|
71
|
+
for (const m of modules) rt.register(m);
|
|
72
|
+
for (const m of extras) rt.register(m);
|
|
73
|
+
for (const m of bundle) rt.register(m);
|
|
74
|
+
|
|
75
|
+
const ext = rt.resolve('pdfContentOpsExtended');
|
|
76
|
+
ext.typeExtGState(dict);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Unlike the `modules` array, `extras` entries are **not** part of the package
|
|
80
|
+
root's additive re-export list (`import { pdfContentOpsExtended } from
|
|
81
|
+
'@awacloud/pdf'` does not exist) — each extra is only reachable through the
|
|
82
|
+
`extras` array above, through `ModuleRuntime`, or through its own
|
|
83
|
+
`./extra/*` export subpath. A sibling composer that wants to avoid building a
|
|
84
|
+
runtime can import the extra directly by subpath and resolve its declared
|
|
85
|
+
`dependencies` (always core `modules` members, reachable from the package
|
|
86
|
+
root) itself:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
import { pdfContentOpsExtended } from '@awacloud/pdf/extra/content-ops-extended';
|
|
90
|
+
import { pdfErrors, pdfParserObj } from '@awacloud/pdf';
|
|
91
|
+
|
|
92
|
+
const ext = pdfContentOpsExtended.factory(pdfErrors.factory(), pdfParserObj.factory());
|
|
93
|
+
ext.typeExtGState(dict);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## See also
|
|
97
|
+
|
|
98
|
+
- [Bundles](../bundles/README.md)
|
|
99
|
+
- [API index](../README.md)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfAnnotExtended
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfAnnotExtended
|
|
11
|
+
|
|
12
|
+
> Extended annotation subtypes (Watermark, 3D, RichMedia, …) — ISO 32000-2 §12.5.6.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfAnnotExtended` | **Source** `packages/front/office/pdf/src/extra/annot-extended.js` | **Deps** `pdfErrors`, `pdfParserObj`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Extends `pdfAnnot` with: Watermark (§12.5.6.22), 3D (§13.6), RichMedia (§13.6.2), Sound (§12.5.6.16 legacy), Movie (§12.5.6.17 legacy), Screen (§12.5.6.18), PrinterMark (§12.5.6.20), TrapNet (§12.5.6.21), extended FreeText (§12.5.6.6, `/RC`, `/DS`, `/LE`). Composes the core `typeBaseAnnot`/`captureExtras`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfAnnotExtended');
|
|
22
|
+
// Returns: { typeAnnotExtended, typeWatermarkAnnot, type3DAnnot,
|
|
23
|
+
// typeRichMediaAnnot, typeSoundAnnot, typeMovieAnnot,
|
|
24
|
+
// typeScreenAnnot, typePrinterMarkAnnot, typeTrapNetAnnot,
|
|
25
|
+
// typeFreeTextExtended, FREETEXT_LINE_ENDINGS }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
| Member | Signature | Returns |
|
|
31
|
+
|--------|-----------|---------|
|
|
32
|
+
| `typeAnnotExtended` | `(dict) => Annot` | Dispatches on `/Subtype`. |
|
|
33
|
+
| `typeWatermarkAnnot` | `(dict) => Annot` | `/FixedPrint`. |
|
|
34
|
+
| `type3DAnnot` | `(dict) => Annot` | Surfaces to `pdf3dRichMedia`. |
|
|
35
|
+
| `typeRichMediaAnnot` | `(dict) => Annot` | Same. |
|
|
36
|
+
| `typeSoundAnnot` / `typeMovieAnnot` / `typeScreenAnnot` | `(dict) => Annot` | Legacy multimedia. |
|
|
37
|
+
| `typePrinterMarkAnnot` / `typeTrapNetAnnot` | `(dict) => Annot` | Prepress §12.5.6.20–21. |
|
|
38
|
+
| `typeFreeTextExtended` | `(dict) => Annot` | FreeText with `/RC`, `/DS`, `/LE`. |
|
|
39
|
+
| `FREETEXT_LINE_ENDINGS` | frozen array | `Square`, `Circle`, `Diamond`, `OpenArrow`, `ClosedArrow`, `None`, `Butt`, `ROpenArrow`, `RClosedArrow`, `Slash`. |
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Extended dispatcher
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const ext = runtime.resolve('pdfAnnotExtended');
|
|
47
|
+
const a = ext.typeAnnotExtended(annotDict);
|
|
48
|
+
a.kind; // 'Watermark' | '3D' | 'RichMedia' | …
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### FreeText with `/LE`
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const ft = ext.typeFreeTextExtended(dict);
|
|
55
|
+
ft.le; // 'OpenArrow' or ['OpenArrow', 'ClosedArrow']
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
| Code | Class | When |
|
|
61
|
+
|------|-------|------|
|
|
62
|
+
| `pdf/extra/annot-ext/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
63
|
+
| `pdf/extra/annot-ext/unsupported` | `ParseError` | `/Subtype` outside the extended coverage. |
|
|
64
|
+
| `pdf/extra/annot-ext/unreachable` | `ParseError` | Unreachable branch (defensive). |
|
|
65
|
+
|
|
66
|
+
## See also
|
|
67
|
+
|
|
68
|
+
- [`pdfAnnot`](../annot/annot.md)
|
|
69
|
+
- [`pdf3dRichMedia`](./3d-richmedia.md)
|
|
70
|
+
- [`pdfLegacyDeprecatedAnnots`](./legacy-deprecated-annots.md)
|
|
71
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfAssociatedFiles2
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfAssociatedFiles2
|
|
11
|
+
|
|
12
|
+
> Extended `/AF` (Associated Files) — PDF 2.0 / PDF20_AN002-AF.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfAssociatedFiles2` | **Source** `packages/front/office/pdf/src/extra/associated-files.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
PDF 2.0 allows `/AF` on the Catalog, Page, XObject (Form), Mark, StructElem, Annot, or DParams. Each item references a File Specification that MUST carry `/AFRelationship`. Vocabulary: `Source`, `Data`, `Alternative`, `Supplement`, `EncryptedPayload`, `FormData`, `Schema`, `Unspecified`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfAssociatedFiles2');
|
|
22
|
+
// Returns: { typeAf, typeAfEntry, resolveFileSpec,
|
|
23
|
+
// isStandardRelationship, listStandardRelationships,
|
|
24
|
+
// STANDARD_REL, CARRIER_HINTS }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| Member | Signature | Returns |
|
|
30
|
+
|--------|-----------|---------|
|
|
31
|
+
| `typeAf` | `(afArray, opts?: { resolveRef?, carrier? }) => { entries, carrier }` | Types a top-level `/AF` array. |
|
|
32
|
+
| `typeAfEntry` | `(entry, resolveRef?, index?) => Entry` | Types one item. |
|
|
33
|
+
| `resolveFileSpec` | `(entry, resolveRef?) => { resolved, dict?, ref? }` | Dereferences an entry. |
|
|
34
|
+
| `isStandardRelationship` | `(name) => boolean` | |
|
|
35
|
+
| `listStandardRelationships` | `() => string[]` | |
|
|
36
|
+
| `STANDARD_REL` | `Set` | The 8 standard relationships. |
|
|
37
|
+
| `CARRIER_HINTS` | `Set` | `Catalog`, `Page`, `XObject`, `StructElem`, `Annot`, `Mark`, `DParams`. |
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Load a page's AF array
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const ext = runtime.resolve('pdfAssociatedFiles2');
|
|
45
|
+
const af = ext.typeAf(page.af, { resolveRef: ref => doc._raw.resolve(ref), carrier: 'Page' });
|
|
46
|
+
af.entries[0].relationship; // 'Data'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Check a custom relationship
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
ext.isStandardRelationship('CustomXYZ'); // false
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Errors
|
|
56
|
+
|
|
57
|
+
| Code | Class | When |
|
|
58
|
+
|------|-------|------|
|
|
59
|
+
| `pdf/af2/bad-entry` | `ParseError` | Entry is neither a dict nor a ref. |
|
|
60
|
+
| `pdf/af2/not-filespec` | `ParseError` | Resolved entry is not a dict. |
|
|
61
|
+
| `pdf/af2/bad-filespec-type` | `ParseError` | `/Type` is not `/Filespec`. |
|
|
62
|
+
| `pdf/af2/bad-relationship` | `ParseError` | `/AFRelationship` is not a name. |
|
|
63
|
+
| `pdf/af2/bad-carrier` | `ParseError` | Carrier outside `CARRIER_HINTS`. |
|
|
64
|
+
| `pdf/af2/not-array` | `ParseError` | `/AF` is not an array. |
|
|
65
|
+
|
|
66
|
+
## See also
|
|
67
|
+
|
|
68
|
+
- [`pdfAssociatedFiles`](../associatedFiles/associatedFiles.md)
|
|
69
|
+
- [`pdfFileSpec`](../embedded/fileSpec.md)
|
|
70
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfCcittFaxDecoder
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfCcittFaxDecoder
|
|
11
|
+
|
|
12
|
+
> CCITTFaxDecode codec (ITU-T T.4 / T.6), full Group 3/Group 4 read + write.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfCcittFaxDecoder` | **Source** `packages/front/office/pdf/src/extra/ccitt-fax-decoder.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Implements the CCITT Group 3/Group 4 fax codec referenced by `/Filter /CCITTFaxDecode` (ISO 32000-2 §7.4.6): `K < 0` selects Group 4 (T.6, pure 2D coding), `K == 0` selects Group 3 one-dimensional (T.4 baseline, white/black run Huffman), `K > 0` selects Group 3 mixed 1D/2D (T.4 with a K-row block and a tag bit). Output is a packed bitstream of `Columns` bits per row, MSB-first, with polarity following `/BlackIs1` (default: white = 1). This is the real decoder that [`pdfLegacyDeprecatedFilters`](./legacy-deprecated-filters.md)'s `ccittFaxDecode` delegates to after validating `DecodeParms`; it is registered directly in `src/main.js#extras` and can also be resolved and used standalone.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfCcittFaxDecoder');
|
|
22
|
+
// Returns: { decode, encode, _internals }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `decode` | `(bytes: Uint8Array, parms: { Columns, Rows?, K?, EndOfLine?, EncodedByteAlign?, BlackIs1?, DamagedRowsBeforeError?, EndOfBlock? }) => Uint8Array` | Packed bitstream, `Columns`-bits-per-row, MSB-first. |
|
|
30
|
+
| `encode` | `(lines: Uint8Array[], parms?: { Columns?, K?, EndOfLine?, EncodedByteAlign?, EndOfBlock? }) => Uint8Array` | Encodes an array of one-byte-per-pixel rows (0=white, 1=black) into a CCITT bitstream, including RTC (G3) / EOFB (G4) terminators. |
|
|
31
|
+
| `_internals` | object | Test/introspection surface: `{ WHITE_MAP, BLACK_MAP, MODE_CODES, EOL_BITS, codeForRun, encode1DLine, encode2DLine, decode1DLine, decode2DLine, makeBitReader, makeBitWriter, findB1, findNextChange, findChangeFrom }`. Not part of the stable public contract. |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Decode a Group 4 stream
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const ext = runtime.resolve('pdfCcittFaxDecoder');
|
|
39
|
+
const bits = ext.decode(streamBytes, { K: -1, Columns: 1728, Rows: 100 });
|
|
40
|
+
// bits.length === Math.ceil(1728 / 8) * 100
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Round-trip encode then decode
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const rows = [ new Uint8Array(1728), new Uint8Array(1728) ]; // all-white
|
|
47
|
+
const encoded = ext.encode(rows, { Columns: 1728, K: -1 });
|
|
48
|
+
const decoded = ext.decode(encoded, { Columns: 1728, Rows: rows.length, K: -1 });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Errors
|
|
52
|
+
|
|
53
|
+
| Code | Class | When |
|
|
54
|
+
|------|-------|------|
|
|
55
|
+
| `pdf/ccitt/bad-input` | `ParseError` | `bytes` is not a Uint8Array. |
|
|
56
|
+
| `pdf/ccitt/bad-columns` | `ParseError` | `Columns` is `<= 0` or `> 65535`. |
|
|
57
|
+
| `pdf/ccitt/bad-runcode` | `ParseError` | An unrecognized white/black run-length code is read. |
|
|
58
|
+
| `pdf/ccitt/bad-2d-mode` | `ParseError` | An unrecognized 2D mode code is read. |
|
|
59
|
+
| `pdf/ccitt/unsupported-2d-mode` | `ParseError` | A resolved 2D mode has no vertical-offset handling (defensive). |
|
|
60
|
+
| `pdf/ccitt/truncated` | `ParseError` | Stream ends mid-line and `DamagedRowsBeforeError` does not tolerate it. |
|
|
61
|
+
| `pdf/ccitt/decode-failed` | `ParseError` | Any other decode-time error, wrapped with `cause`. |
|
|
62
|
+
|
|
63
|
+
`encode` does not throw a validated-input error of its own; malformed `lines`/`parms` produce best-effort output.
|
|
64
|
+
|
|
65
|
+
## Notes
|
|
66
|
+
|
|
67
|
+
- The encoder side is production-grade (greedy make-up code choice, `EncodedByteAlign` padding, RTC/EOFB terminators, full 2D state machine) even though the module is filed as a "legacy read" extra alongside [`pdfLegacyDeprecatedFilters`](./legacy-deprecated-filters.md) — it is exercised by that module's `ccittFaxDecode`/`validateCcittParms` pair but is independently usable.
|
|
68
|
+
- Rows tolerant of damage (`DamagedRowsBeforeError > 0`) are filled with a blank (all-white) row instead of throwing.
|
|
69
|
+
|
|
70
|
+
## See also
|
|
71
|
+
|
|
72
|
+
- [`pdfLegacyDeprecatedFilters`](./legacy-deprecated-filters.md)
|
|
73
|
+
- [`pdfFilters`](../syntax/filters/README.md)
|
|
74
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfColorSpacesExtended
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfColorSpacesExtended
|
|
11
|
+
|
|
12
|
+
> Typed color spaces (CalGray/CalRGB/Lab/ICCBased/Indexed/Separation/DeviceN/NChannel/Pattern) — ISO 32000-2 §8.6.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfColorSpacesExtended` | **Source** `packages/front/office/pdf/src/extra/color-spaces-extended.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Types color spaces expressed as an array whose first element is the family name, plus the named device families. Coverage: CalGray (§8.6.5.2), CalRGB (§8.6.5.3), Lab (§8.6.5.4), ICCBased (§8.6.5.5, with Metadata), Indexed (§8.6.6.3), Separation (§8.6.6.4), DeviceN (§8.6.6.5) with `/Attributes`, NChannel (a DeviceN subtype with `/Process`), Pattern (§8.7).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfColorSpacesExtended');
|
|
22
|
+
// Returns: { typeColorSpace, COLOR_SPACE_FAMILIES }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeColorSpace` | `(value) => CS` | Record `{ family, ..., raw }`. |
|
|
30
|
+
| `COLOR_SPACE_FAMILIES` | `Set<string>` | The 12 known families. |
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Type a CS array
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const ext = runtime.resolve('pdfColorSpacesExtended');
|
|
38
|
+
const cs = ext.typeColorSpace(arrayCs);
|
|
39
|
+
cs.family; // 'ICCBased'
|
|
40
|
+
cs.n; // 3
|
|
41
|
+
cs.metadata; // streamObj | null
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### DeviceN
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
cs.family; // 'DeviceN'
|
|
48
|
+
cs.names; // ['Cyan','Magenta','Yellow','Black','PANTONE 185 C']
|
|
49
|
+
cs.attributes; // dict | null
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Errors
|
|
53
|
+
|
|
54
|
+
| Code | Class | When |
|
|
55
|
+
|------|-------|------|
|
|
56
|
+
| `pdf/extra/colorspace/bad-shape` | `ParseError` | Neither a name nor an array. |
|
|
57
|
+
| `pdf/extra/colorspace/bad-family` | `ParseError` | Entry 0 is not a name. |
|
|
58
|
+
| `pdf/extra/colorspace/unknown` | `ParseError` | Family outside `COLOR_SPACE_FAMILIES`. |
|
|
59
|
+
| `pdf/extra/colorspace/cal-no-dict` | `ParseError` | CalGray/CalRGB without a dict. |
|
|
60
|
+
| `pdf/extra/colorspace/cal-truncated` | `ParseError` | CalGray/CalRGB truncated. |
|
|
61
|
+
| `pdf/extra/colorspace/lab-truncated` | `ParseError` | Lab without a dict. |
|
|
62
|
+
| `pdf/extra/colorspace/icc-no-stream` | `ParseError` | ICCBased without a stream. |
|
|
63
|
+
| `pdf/extra/colorspace/indexed-truncated` | `ParseError` | Indexed incomplete. |
|
|
64
|
+
| `pdf/extra/colorspace/indexed-bad-hival` | `ParseError` | hival is not an int. |
|
|
65
|
+
| `pdf/extra/colorspace/sep-truncated` | `ParseError` | Separation incomplete. |
|
|
66
|
+
| `pdf/extra/colorspace/devn-truncated` | `ParseError` | DeviceN incomplete. |
|
|
67
|
+
|
|
68
|
+
## See also
|
|
69
|
+
|
|
70
|
+
- [`pdfColor`](../content/color.md)
|
|
71
|
+
- [`pdfShadingTyped`](./shading-typed.md)
|
|
72
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfContentOpsExtended
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfContentOpsExtended
|
|
11
|
+
|
|
12
|
+
> Extended graphics-state operators and full ExtGState catalog — ISO 32000-2 §8.4.5.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfContentOpsExtended` | **Source** `packages/front/office/pdf/src/extra/content-ops-extended.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Covers `d0`/`d1` (Type 3 glyph-width operators, §9.6.4) and every key of the `/ExtGState` dictionary (Table 57). Unknown keys are preserved under `_extras`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfContentOpsExtended');
|
|
22
|
+
// Returns: { typeExtGState, decodeType3CharOp, EXT_GSTATE_KEYS }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeExtGState` | `(dict) => ExtGState` | Typed record covering every §8.4.5 Table 57 entry. |
|
|
30
|
+
| `decodeType3CharOp` | `(op: string, operands: number[]) => { kind, wx, wy, bbox? }` | `d0` or `d1`. |
|
|
31
|
+
| `EXT_GSTATE_KEYS` | frozen catalog | Map key → `{ kind, doc }`. |
|
|
32
|
+
|
|
33
|
+
### Shape `ExtGState`
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
{
|
|
37
|
+
type, lw, lc, lj, ml, d, ri, op, opNs, opm, font,
|
|
38
|
+
bg, bg2, ucr, ucr2, tr, tr2, ht, fl, sm, sa,
|
|
39
|
+
bm, sMask, ca, caNs, ais, tk, useBlackPtComp, hto,
|
|
40
|
+
raw, _extras
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Type a full ExtGState
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const ext = runtime.resolve('pdfContentOpsExtended');
|
|
50
|
+
const gs = ext.typeExtGState(doc._raw.resolve(extGStateRef));
|
|
51
|
+
gs.ca; // 0.5
|
|
52
|
+
gs.bm; // { type: 'name', value: 'Multiply' }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Decode a Type 3 operator
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
ext.decodeType3CharOp('d1', [600, 0, 0, 0, 500, 700]);
|
|
59
|
+
// { kind: 'd1', wx: 600, wy: 0, bbox: [0, 0, 500, 700] }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Key catalog
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
ext.EXT_GSTATE_KEYS.CA.doc; // 'stroke alpha [0,1]'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Errors
|
|
69
|
+
|
|
70
|
+
| Code | Class | When |
|
|
71
|
+
|------|-------|------|
|
|
72
|
+
| `pdf/extra/ext-gstate/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
73
|
+
| `pdf/extra/ext-gstate/bad-type` | `ParseError` | `/Type` present and not `/ExtGState`. |
|
|
74
|
+
| `pdf/extra/content-ops/unknown` | `ParseError` | Operator is neither `d0` nor `d1`. |
|
|
75
|
+
| `pdf/extra/content-ops/bad-d0` | `ParseError` | `d0` does not have exactly 2 operands. |
|
|
76
|
+
| `pdf/extra/content-ops/bad-d1` | `ParseError` | `d1` does not have exactly 6 operands. |
|
|
77
|
+
|
|
78
|
+
## See also
|
|
79
|
+
|
|
80
|
+
- [`pdfContentOps`](../content/ops.md)
|
|
81
|
+
- [`pdfFont`](../font/font.md)
|
|
82
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfDocumentParts
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfDocumentParts
|
|
11
|
+
|
|
12
|
+
> Document Parts hierarchical tree (`/DPartRoot`, `/DPart`, `/DPM`) — ISO/TS 32004.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfDocumentParts` | **Source** `packages/front/office/pdf/src/extra/document-parts.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
TS 32004 introduces a "Document Parts" tree rooted in the Catalog under `/DPartRoot`. Each node is a `/Type /DPart` dict with `/Parent`, `/DParts` (child nodes or pages), `/Start`/`/End`, `/DPM` (metadata), `/NodeNameTree`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfDocumentParts');
|
|
22
|
+
// Returns: { typeDPartRoot, typeDPart, typeDPM, walkDParts }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeDPartRoot` | `(dict) => DPartRoot` | Root `/DPartRoot`. |
|
|
30
|
+
| `typeDPart` | `(dict) => DPart` | A tree node. |
|
|
31
|
+
| `typeDPM` | `(dict) => DPM` | Metadata dict. |
|
|
32
|
+
| `walkDParts` | `(root, visit) => void` | Depth-first traversal. |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Load the root
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const ext = runtime.resolve('pdfDocumentParts');
|
|
40
|
+
const root = ext.typeDPartRoot(doc._raw.resolve(catalog.dPartRoot));
|
|
41
|
+
root.rootNode; // ref
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Traversal
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
ext.walkDParts(rootNode, (node) => {
|
|
48
|
+
console.log(node.start, '-', node.end);
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Errors
|
|
53
|
+
|
|
54
|
+
| Code | Class | When |
|
|
55
|
+
|------|-------|------|
|
|
56
|
+
| `pdf/extra/dparts/root/not-dict` | `ParseError` | Root is not a dict. |
|
|
57
|
+
| `pdf/extra/dparts/root/bad-type` | `ParseError` | `/Type` is not `/DPartRoot`. |
|
|
58
|
+
| `pdf/extra/dparts/root/missing-node` | `ParseError` | `/DPartRootNode` absent. |
|
|
59
|
+
| `pdf/extra/dparts/node/not-dict` | `ParseError` | Node is not a dict. |
|
|
60
|
+
| `pdf/extra/dparts/node/bad-type` | `ParseError` | `/Type` is not `/DPart`. |
|
|
61
|
+
| `pdf/extra/dparts/node/bad-dpm` | `ParseError` | `/DPM` is not a dict. |
|
|
62
|
+
| `pdf/extra/dparts/dpm/not-dict` | `ParseError` | DPM is not a dict. |
|
|
63
|
+
| `pdf/extra/dparts/walk/bad-visit` | `ParseError` | `visit` is not a function. |
|
|
64
|
+
|
|
65
|
+
## See also
|
|
66
|
+
|
|
67
|
+
- [`pdfCatalog`](../document/catalog.md)
|
|
68
|
+
- [`pdfXmpExtended`](./xmp-extended.md)
|
|
69
|
+
- [Extras index](./README.md)
|