@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,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfEmbeddedFilesPortfolio
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfEmbeddedFilesPortfolio
|
|
11
|
+
|
|
12
|
+
> Deep typing of the PDF Portfolio (`/Collection`).
|
|
13
|
+
|
|
14
|
+
**Module** `pdfEmbeddedFilesPortfolio` | **Source** `packages/front/office/pdf/src/extra/embedded-files-portfolio.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Augments the L1 `/Collection` typing with deep inspection: `/Schema` field defs, `/Sort` criteria, `/Navigator`, the initial `/D` entry, the `/View` mode (`D`/`T`/`H`/`C`), and the `/CI` (Collection Item) custom icon.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfEmbeddedFilesPortfolio');
|
|
22
|
+
// Returns: { typePortfolio, typeSchema, typeSchemaField, typeSort,
|
|
23
|
+
// typeNavigator, typeCustomIcon, typeCollectionItem,
|
|
24
|
+
// VIEW_MODES, SCHEMA_SUBTYPES }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| Member | Signature | Returns |
|
|
30
|
+
|--------|-----------|---------|
|
|
31
|
+
| `typePortfolio` | `(collectionDict) => Portfolio` | Full view `{ raw, _extras, schema?, initialDoc?, view?, sort?, navigator? }`. |
|
|
32
|
+
| `typeSchema` | `(dict) => { fields, raw }` | `/Schema` fields, keyed by their dict key. |
|
|
33
|
+
| `typeSchemaField` | `(name, dict) => Field` | A single field definition. |
|
|
34
|
+
| `typeSort` | `(dict) => Sort` | `/Sort` `/S`/`/A`. |
|
|
35
|
+
| `typeNavigator` | `(value) => Navigator` | Ref or typed dict. |
|
|
36
|
+
| `typeCustomIcon` | `(dict) => { raw }` | `/CI` icon. |
|
|
37
|
+
| `typeCollectionItem` | `(dict) => CI` | Per-file metadata. |
|
|
38
|
+
| `VIEW_MODES` | `Set` | `D`, `T`, `H`, `C`. |
|
|
39
|
+
| `SCHEMA_SUBTYPES` | `Set` | `S`, `D`, `N`, `F`, `Desc`, `ModDate`, `CreationDate`, `Size`. |
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Load a portfolio
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const ext = runtime.resolve('pdfEmbeddedFilesPortfolio');
|
|
47
|
+
const p = ext.typePortfolio(catalog.collection);
|
|
48
|
+
p.view; // 'D'
|
|
49
|
+
p.schema.fields.Title.displayName; // 'Title'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Sort
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
ext.typeSort(sortDict);
|
|
56
|
+
// { keys: ['Date','Size'], ascending: [false, true], raw, _extras }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Errors
|
|
60
|
+
|
|
61
|
+
| Code | Class | When |
|
|
62
|
+
|------|-------|------|
|
|
63
|
+
| `pdf/portfolio/bad-schema-field` | `ParseError` | Field is not a dict. |
|
|
64
|
+
| `pdf/portfolio/bad-schema-subtype` | `ParseError` | `/Subtype` outside the set. |
|
|
65
|
+
| `pdf/portfolio/bad-schema-n` | `ParseError` | `/N` is not a string. |
|
|
66
|
+
| `pdf/portfolio/bad-schema-o` | `ParseError` | `/O` is not an int. |
|
|
67
|
+
| `pdf/portfolio/bad-schema-v` | `ParseError` | `/V` wrong type. |
|
|
68
|
+
| `pdf/portfolio/bad-schema-e` | `ParseError` | `/E` wrong type. |
|
|
69
|
+
| `pdf/portfolio/bad-schema` | `ParseError` | `/Schema` dict invalid. |
|
|
70
|
+
| `pdf/portfolio/bad-sort` | `ParseError` | `/Sort` dict invalid. |
|
|
71
|
+
| `pdf/portfolio/bad-sort-s-item` | `ParseError` | `/S` array item is not a name. |
|
|
72
|
+
| `pdf/portfolio/bad-sort-s` | `ParseError` | `/S` is neither name nor array. |
|
|
73
|
+
| `pdf/portfolio/bad-sort-a-item` | `ParseError` | `/A` array item is not a bool. |
|
|
74
|
+
| `pdf/portfolio/bad-sort-a` | `ParseError` | `/A` is neither bool nor array. |
|
|
75
|
+
| `pdf/portfolio/bad-navigator` | `ParseError` | Navigator invalid. |
|
|
76
|
+
| `pdf/portfolio/bad-ci` | `ParseError` | `/CI` is not a dict or stream. |
|
|
77
|
+
| `pdf/portfolio/not-dict` | `ParseError` | Collection is not a dict. |
|
|
78
|
+
| `pdf/portfolio/bad-type` | `ParseError` | `/Type` is not `/Collection`. |
|
|
79
|
+
| `pdf/portfolio/bad-d` | `ParseError` | `/D` is not a string. |
|
|
80
|
+
| `pdf/portfolio/bad-view` | `ParseError` | `/View` outside `VIEW_MODES`. |
|
|
81
|
+
| `pdf/portfolio/ci-not-dict` | `ParseError` | `typeCollectionItem` argument is not a dict. |
|
|
82
|
+
|
|
83
|
+
## See also
|
|
84
|
+
|
|
85
|
+
- [`pdfCollection`](../embedded/collection.md)
|
|
86
|
+
- [`pdfFileSpec`](../embedded/fileSpec.md)
|
|
87
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfFontCidTyped
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfFontCidTyped
|
|
11
|
+
|
|
12
|
+
> Typed CIDFont, CIDSystemInfo, `/W` glyph widths, and the predefined-CMap catalog — ISO 32000-2 §9.7.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfFontCidTyped` | **Source** `packages/front/office/pdf/src/extra/font-cid-typed.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Covers `/CIDFontType0` and `/CIDFontType2` (§9.7.4), `/CIDSystemInfo` (§9.7.3), `/CIDToGIDMap` (§9.7.4.3), `/W /W2 /DW /DW2` (§9.7.4.3), and the frozen list of predefined CMaps (§9.7.5.2).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfFontCidTyped');
|
|
22
|
+
// Returns: { typeCIDFont, typeCIDSystemInfo, decodeWidthsW, PREDEFINED_CMAPS }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeCIDFont` | `(dict) => CIDFont` | Record for `/Type /Font /Subtype /CIDFontType{0,2}`. |
|
|
30
|
+
| `typeCIDSystemInfo` | `(dict) => { registry, ordering, supplement }` | §9.7.3. |
|
|
31
|
+
| `decodeWidthsW` | `(array) => Array<{ first, last, widths? , width? }>` | Expands `/W` runs. |
|
|
32
|
+
| `PREDEFINED_CMAPS` | frozen catalog | Map `registry-ordering` → list of CMap names. |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Type a CIDFont
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const cid = ext.typeCIDFont(doc._raw.resolve(cidFontRef));
|
|
40
|
+
cid.subtype; // 'CIDFontType2'
|
|
41
|
+
cid.cidSystemInfo.registry; // 'Adobe'
|
|
42
|
+
cid.dw; // 1000
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Decode `/W`
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
ext.decodeWidthsW(arr);
|
|
49
|
+
// [ { first: 1, last: 3, widths: [500, 500, 500] }, { first: 10, last: 10, width: 600 } ]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Predefined CMap
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
ext.PREDEFINED_CMAPS['Adobe-GB1'].includes('GB-EUC-H'); // true
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
| Code | Class | When |
|
|
61
|
+
|------|-------|------|
|
|
62
|
+
| `pdf/extra/cid-font/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
63
|
+
| `pdf/extra/cid-font/bad-type` | `ParseError` | `/Type` present and not `/Font`. |
|
|
64
|
+
| `pdf/extra/cid-font/bad-subtype` | `ParseError` | `/Subtype` is not a CIDFontType. |
|
|
65
|
+
| `pdf/extra/cid-font/missing-csi` | `ParseError` | `/CIDSystemInfo` missing. |
|
|
66
|
+
| `pdf/extra/cid-system-info/not-dict` | `ParseError` | CIDSystemInfo is not a dictionary. |
|
|
67
|
+
| `pdf/extra/cid-system-info/incomplete` | `ParseError` | A required field is absent. |
|
|
68
|
+
| `pdf/extra/cid-font/bad-w` | `ParseError` | `/W` is not an array. |
|
|
69
|
+
| `pdf/extra/cid-font/bad-w-c` | `ParseError` | First value is not numeric. |
|
|
70
|
+
| `pdf/extra/cid-font/bad-w-item` | `ParseError` | Array item is not numeric. |
|
|
71
|
+
| `pdf/extra/cid-font/bad-w-range` | `ParseError` | Range form is malformed. |
|
|
72
|
+
|
|
73
|
+
## See also
|
|
74
|
+
|
|
75
|
+
- [`pdfFont`](../font/font.md)
|
|
76
|
+
- [`pdfFontEncoding`](../font/encoding.md)
|
|
77
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfFontColorTagging
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfFontColorTagging
|
|
11
|
+
|
|
12
|
+
> Detection of OpenType color fonts (COLR/CPAL/sbix/SVG/CBDT) and FontDescriptor flags — ISO 32000-2 §9.8.2.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfFontColorTagging` | **Source** `packages/front/office/pdf/src/extra/font-color-tagging.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
PDF has no single "is-color-font" flag. This module cross-references the FontDescriptor flags (Table 121) with an sfnt-table scan of an embedded `/FontFile3 /Subtype /OpenType` program to detect color OT tables.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfFontColorTagging');
|
|
22
|
+
// Returns: { decodeFontDescriptorFlags, detectColorFontTables,
|
|
23
|
+
// typeFontFile3OpenType, FONT_DESCRIPTOR_FLAGS, COLOR_OT_TABLES }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| Member | Signature | Returns |
|
|
29
|
+
|--------|-----------|---------|
|
|
30
|
+
| `decodeFontDescriptorFlags` | `(int) => FlagsRecord` | Decodes each bit into a named boolean. |
|
|
31
|
+
| `detectColorFontTables` | `(Uint8Array) => { hasCOLR, hasSbix, hasSVG, hasCBDT, tables }` | Scans the sfnt table directory. |
|
|
32
|
+
| `typeFontFile3OpenType` | `(streamObj) => { subtype, length, metadata, color, raw, _extras }` | Typed wrapper around `/FontFile3`. |
|
|
33
|
+
| `FONT_DESCRIPTOR_FLAGS` | frozen catalog | Bit name → mask (FixedPitch, Serif, Symbolic, Script, Nonsymbolic, Italic, AllCap, SmallCap, ForceBold). |
|
|
34
|
+
| `COLOR_OT_TABLES` | frozen array | `['COLR','CPAL','sbix','SVG ','CBDT','CBLC']`. |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Detect a color font
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
const r = ext.detectColorFontTables(fontBytes);
|
|
42
|
+
r.tables; // ['COLR', 'CPAL', ...]
|
|
43
|
+
r.hasCOLR; // true
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Decode the flags
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const f = ext.decodeFontDescriptorFlags(0x44);
|
|
50
|
+
f.symbolic; // true
|
|
51
|
+
f.nonsymbolic; // false
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Type `/FontFile3 /Subtype /OpenType`
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const ff3 = ext.typeFontFile3OpenType(stream);
|
|
58
|
+
ff3.subtype; // 'OpenType'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Errors
|
|
62
|
+
|
|
63
|
+
| Code | Class | When |
|
|
64
|
+
|------|-------|------|
|
|
65
|
+
| `pdf/extra/font-flags/bad-input` | `ParseError` | Argument is not numeric. |
|
|
66
|
+
| `pdf/extra/color-font/bad-input` | `ParseError` | Argument is not a Uint8Array. |
|
|
67
|
+
| `pdf/extra/color-font/truncated` | `ParseError` | sfnt header truncated. |
|
|
68
|
+
| `pdf/extra/fontfile3/not-stream` | `ParseError` | `/FontFile3` is not a stream. |
|
|
69
|
+
| `pdf/extra/fontfile3/no-dict` | `ParseError` | Stream has no dict. |
|
|
70
|
+
| `pdf/extra/fontfile3/bad-subtype` | `ParseError` | `/Subtype` is not `/OpenType`. |
|
|
71
|
+
|
|
72
|
+
## See also
|
|
73
|
+
|
|
74
|
+
- [`pdfFontEmbed`](../font/embed.md)
|
|
75
|
+
- [`pdfFontCidTyped`](./font-cid-typed.md)
|
|
76
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfFormActionsExtended
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfFormActionsExtended
|
|
11
|
+
|
|
12
|
+
> Extended action subtypes (GoTo3DView, SetOCGState, …) — ISO 32000-2 §12.6.4.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfFormActionsExtended` | **Source** `packages/front/office/pdf/src/extra/form-actions-extended.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Covers: GoTo3DView (§12.6.4.15), SetOCGState (§12.6.4.12), Trans (§12.6.4.13), Rendition (§12.6.4.14), Hide (§12.6.4.10), SubmitForm (§12.6.4.4), ResetForm (§12.6.4.5), ImportData (§12.6.4.6), JavaScript (§12.6.4.7, sandboxed flag only). Returns `{ kind, ...typed, raw, _extras }`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfFormActionsExtended');
|
|
22
|
+
// Returns: { typeExtendedAction, EXTENDED_ACTION_SUBTYPES }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeExtendedAction` | `(dict) => ExtendedAction` | Dispatches on `/S`. |
|
|
30
|
+
| `EXTENDED_ACTION_SUBTYPES` | `Set<string>` | The 9 covered subtypes. |
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Type an action
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const ext = runtime.resolve('pdfFormActionsExtended');
|
|
38
|
+
const a = ext.typeExtendedAction(actionDict);
|
|
39
|
+
a.kind; // 'SubmitForm' | 'JavaScript' | …
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### SetOCGState
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
a.kind; // 'SetOCGState'
|
|
46
|
+
a.state; // raw /State array items
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### JavaScript
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
a.kind; // 'JavaScript'
|
|
53
|
+
a.js; // string or stream
|
|
54
|
+
a.sandboxed; // true
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Errors
|
|
58
|
+
|
|
59
|
+
| Code | Class | When |
|
|
60
|
+
|------|-------|------|
|
|
61
|
+
| `pdf/extra/action-ext/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
62
|
+
| `pdf/extra/action-ext/bad-type` | `ParseError` | `/Type` present and not `/Action`. |
|
|
63
|
+
| `pdf/extra/action-ext/unsupported` | `ParseError` | `/S` outside `EXTENDED_ACTION_SUBTYPES`. |
|
|
64
|
+
| `pdf/extra/action-ext/bad-state` | `ParseError` | SetOCGState `/State` malformed. |
|
|
65
|
+
| `pdf/extra/action-ext/bad-trans` | `ParseError` | `/Trans` dict invalid. |
|
|
66
|
+
| `pdf/extra/action-ext/missing-t` | `ParseError` | `/T` absent (Hide). |
|
|
67
|
+
| `pdf/extra/action-ext/bad-t` | `ParseError` | `/T` wrong type. |
|
|
68
|
+
| `pdf/extra/action-ext/missing-f` | `ParseError` | `/F` absent (SubmitForm/ImportData). |
|
|
69
|
+
| `pdf/extra/action-ext/missing-js` | `ParseError` | `/JS` absent. |
|
|
70
|
+
| `pdf/extra/action-ext/bad-js` | `ParseError` | `/JS` wrong type. |
|
|
71
|
+
|
|
72
|
+
## See also
|
|
73
|
+
|
|
74
|
+
- [`pdfAction`](../action/action.md)
|
|
75
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfInfoDictDeprecated
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfInfoDictDeprecated
|
|
11
|
+
|
|
12
|
+
> `/Info` linter (deprecated in PDF 2.0) with XMP mapping.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfInfoDictDeprecated` | **Source** `packages/front/office/pdf/src/extra/info-dict-deprecated.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
PDF 2.0 (ISO 32000-2 §14.3.3) deprecates the Document Information Dictionary in favour of the XMP metadata stream. This module inspects a Catalog + `/Info` pair and emits structured warnings when `/Info` is present on a PDF 2.0 document, with a suggested XMP mapping per the standard's recommended namespaces.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfInfoDictDeprecated');
|
|
22
|
+
// Returns: { lint, mapInfoKey, suggestionsFor, INFO_TO_XMP, isVersion2OrHigher }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `lint` | `({ version, info, xmpPresent }) => { version, isPdf2, hasInfo, xmpPresent, warnings }` | Top-level lint. |
|
|
30
|
+
| `mapInfoKey` | `(name) => { ns, field } \| null` | Lookup by Info key. |
|
|
31
|
+
| `suggestionsFor` | `(infoDict) => Suggestion[]` | List of per-entry mappings. |
|
|
32
|
+
| `INFO_TO_XMP` | object | Info key → `{ ns, field }`. |
|
|
33
|
+
| `isVersion2OrHigher` | `(version) => boolean` | |
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Lint
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const ext = runtime.resolve('pdfInfoDictDeprecated');
|
|
41
|
+
const r = ext.lint({ version: 2.0, info: infoDict, xmpPresent: false });
|
|
42
|
+
r.warnings;
|
|
43
|
+
// [ { code: 'pdf/info-deprecated', severity: 'warn', message: '…', suggestions: [...] },
|
|
44
|
+
// { code: 'pdf/info-without-xmp', severity: 'warn', message: '…' } ]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Map a key
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
ext.mapInfoKey('Author'); // { ns: 'dc', field: 'creator' }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Errors
|
|
54
|
+
|
|
55
|
+
| Code | Class | When |
|
|
56
|
+
|------|-------|------|
|
|
57
|
+
| `pdf/info-deprecated/bad-version` | `ParseError` | version is not string/name/number. |
|
|
58
|
+
| `pdf/info-deprecated/bad-info` | `ParseError` | Info is not a dict. |
|
|
59
|
+
|
|
60
|
+
### Warning codes (lint output)
|
|
61
|
+
|
|
62
|
+
| Code | Severity | When |
|
|
63
|
+
|------|----------|------|
|
|
64
|
+
| `pdf/info-deprecated` | warn | PDF 2.0 + `/Info` present. |
|
|
65
|
+
| `pdf/info-without-xmp` | warn | PDF 2.0 + `/Info` without XMP. |
|
|
66
|
+
|
|
67
|
+
## See also
|
|
68
|
+
|
|
69
|
+
- [`pdfInfo`](../metadata/info.md)
|
|
70
|
+
- [`pdfXmp`](../metadata/xmp.md)
|
|
71
|
+
- [`pdfXmpExtended`](./xmp-extended.md)
|
|
72
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfJbig2Read
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: partial
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfJbig2Read
|
|
11
|
+
|
|
12
|
+
> JBIG2 segment reader, header-only (PARTIAL).
|
|
13
|
+
|
|
14
|
+
**Module** `pdfJbig2Read` | **Source** `packages/front/office/pdf/src/extra/jbig2-read.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
JBIG2 is the bilevel codec referenced by `/Filter /JBIG2Decode` (ISO 32000-2 §7.4.7). A full decoder is out of scope; this module parses the segment-header chain (ISO/IEC 14492:2001 §7.2) and returns descriptors for enumeration. **Status: PARTIAL — header-only**, unrelated to the real T.4/T.6 codec shipped by [`pdfCcittFaxDecoder`](./ccitt-fax-decoder.md).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfJbig2Read');
|
|
22
|
+
// Returns: { parseSegments, enumerateGenericRegions, decode,
|
|
23
|
+
// SEGMENT_TYPES, STATUS }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| Member | Signature | Returns |
|
|
29
|
+
|--------|-----------|---------|
|
|
30
|
+
| `parseSegments` | `(Uint8Array) => Segment[]` | Walks the segment chain. |
|
|
31
|
+
| `enumerateGenericRegions` | `(Uint8Array) => Segment[]` | Filters types 36/38/39. |
|
|
32
|
+
| `decode` | `(Uint8Array) => never` | Always throws `not-implemented`. |
|
|
33
|
+
| `SEGMENT_TYPES` | object | Type number → name. |
|
|
34
|
+
| `STATUS` | string | `'partial — header-only'`. |
|
|
35
|
+
|
|
36
|
+
### Shape `Segment`
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
{ segmentNumber, type, typeName, referredCount,
|
|
40
|
+
retain, deferredNonRetain, dataOffset, dataLength, unknownLength }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
### Enumerate segments
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const ext = runtime.resolve('pdfJbig2Read');
|
|
49
|
+
const segs = ext.parseSegments(jbig2Bytes);
|
|
50
|
+
segs[0].typeName; // 'symbolDictionary'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Generic regions
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
ext.enumerateGenericRegions(jbig2Bytes).length;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Status check
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
ext.STATUS; // 'partial — header-only'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Errors
|
|
66
|
+
|
|
67
|
+
| Code | Class | When |
|
|
68
|
+
|------|-------|------|
|
|
69
|
+
| `pdf/jbig2/bad-input` | `ParseError` | Not a Uint8Array. |
|
|
70
|
+
| `pdf/jbig2/truncated-header` | `ParseError` | Header chain cut short. |
|
|
71
|
+
| `pdf/jbig2/truncated-data-length` | `ParseError` | Data-length field missing. |
|
|
72
|
+
| `pdf/jbig2/truncated-data` | `ParseError` | Payload cut short. |
|
|
73
|
+
| `pdf/jbig2/not-implemented` | `ParseError` | Always, from `decode()`. |
|
|
74
|
+
|
|
75
|
+
## See also
|
|
76
|
+
|
|
77
|
+
- [`pdfFilters`](../syntax/filters/README.md)
|
|
78
|
+
- [`pdfImages`](../content/images.md)
|
|
79
|
+
- [`pdfCcittFaxDecoder`](./ccitt-fax-decoder.md)
|
|
80
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfLegacyDeprecatedAnnots
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfLegacyDeprecatedAnnots
|
|
11
|
+
|
|
12
|
+
> Sound (§12.5.6.16), Movie (§12.5.6.17), Screen (§12.5.6.18) — legacy.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfLegacyDeprecatedAnnots` | **Source** `packages/front/office/pdf/src/extra/legacy-deprecated-annots.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Typed payloads for the multimedia subtypes that PDF 2.0 deprecates in favour of `/RichMedia` and the `/Screen` + `/Rendition` pattern:
|
|
17
|
+
- `/Subtype /Sound` (ISO 32000-1 §12.5.6.16): `/Sound` stream, `/Name` icon.
|
|
18
|
+
- `/Subtype /Movie` (§12.5.6.17): `/Movie` dict, `/A` activation, `/T` title.
|
|
19
|
+
- `/Subtype /Screen` (§12.5.6.18): `/MK` appearance, `/A` rendition action, `/AA` additional actions.
|
|
20
|
+
|
|
21
|
+
## Resolve
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
const ext = runtime.resolve('pdfLegacyDeprecatedAnnots');
|
|
25
|
+
// Returns: { typeSoundAnnot, typeSoundStream, typeMovieAnnot,
|
|
26
|
+
// typeScreenAnnot, SOUND_MODES, MOVIE_OP_MODES }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Member | Signature | Returns |
|
|
32
|
+
|--------|-----------|---------|
|
|
33
|
+
| `typeSoundAnnot` | `(dict) => SoundAnnot` | `{ subtype: 'Sound', sound, iconName?, raw, _extras }`. |
|
|
34
|
+
| `typeSoundStream` | `(stream) => { samplingRate?, channels?, bitsPerSample?, encoding?, compression?, mode?, raw, _extras }` | `/Sound` stream payload. |
|
|
35
|
+
| `typeMovieAnnot` | `(dict) => MovieAnnot` | `{ subtype: 'Movie', movie, title?, activation?, raw, _extras }`. |
|
|
36
|
+
| `typeScreenAnnot` | `(dict) => ScreenAnnot` | `{ subtype: 'Screen', title?, mk?, action?, additionalActions?, page?, raw, _extras }`. |
|
|
37
|
+
| `SOUND_MODES` | `Set` | `Mono`, `Stereo`. |
|
|
38
|
+
| `MOVIE_OP_MODES` | `Set` | `Once`, `Open`, `Repeat`, `Palindrome`. |
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Sound
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const ext = runtime.resolve('pdfLegacyDeprecatedAnnots');
|
|
46
|
+
const s = ext.typeSoundAnnot(annot);
|
|
47
|
+
s.sound; // stream ref
|
|
48
|
+
s.iconName; // 'Speaker'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Movie
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const m = ext.typeMovieAnnot(annot);
|
|
55
|
+
m.activation.mode; // 'Once' (when /A is a dict with /Mode)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
| Code | Class | When |
|
|
61
|
+
|------|-------|------|
|
|
62
|
+
| `pdf/legacy-annot/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
63
|
+
| `pdf/legacy-annot/bad-subtype` | `ParseError` | Subtype is not Sound/Movie/Screen. |
|
|
64
|
+
| `pdf/legacy-annot/sound-missing` | `ParseError` | `/Sound` absent. |
|
|
65
|
+
| `pdf/legacy-annot/sound-bad-stream` | `ParseError` | `/Sound` is not a stream or ref. |
|
|
66
|
+
| `pdf/legacy-annot/sound-bad-name` | `ParseError` | `/Name` is not a name. |
|
|
67
|
+
| `pdf/legacy-annot/sound-stream` | `ParseError` | Sound payload is not a stream. |
|
|
68
|
+
| `pdf/legacy-annot/sound-bad-R` | `ParseError` | `/R` is not numeric. |
|
|
69
|
+
| `pdf/legacy-annot/sound-bad-C` | `ParseError` | `/C` is not numeric. |
|
|
70
|
+
| `pdf/legacy-annot/sound-bad-B` | `ParseError` | `/B` is not numeric. |
|
|
71
|
+
| `pdf/legacy-annot/sound-bad-E` | `ParseError` | `/E` is not a name. |
|
|
72
|
+
| `pdf/legacy-annot/sound-bad-CO` | `ParseError` | `/CO` is not a name. |
|
|
73
|
+
| `pdf/legacy-annot/sound-bad-mode` | `ParseError` | Mode outside `SOUND_MODES`. |
|
|
74
|
+
| `pdf/legacy-annot/movie-missing` | `ParseError` | `/Movie` absent. |
|
|
75
|
+
| `pdf/legacy-annot/movie-bad` | `ParseError` | `/Movie` is not a dict. |
|
|
76
|
+
| `pdf/legacy-annot/movie-bad-T` | `ParseError` | `/T` is not a string. |
|
|
77
|
+
| `pdf/legacy-annot/movie-bad-A` | `ParseError` | `/A` is neither bool nor dict. |
|
|
78
|
+
| `pdf/legacy-annot/movie-bad-mode` | `ParseError` | Mode outside `MOVIE_OP_MODES`. |
|
|
79
|
+
| `pdf/legacy-annot/screen-bad-T` | `ParseError` | `/T` is not a string. |
|
|
80
|
+
| `pdf/legacy-annot/screen-bad-MK` | `ParseError` | `/MK` is not a dict. |
|
|
81
|
+
| `pdf/legacy-annot/screen-bad-A` | `ParseError` | `/A` is not a dict. |
|
|
82
|
+
| `pdf/legacy-annot/screen-bad-AA` | `ParseError` | `/AA` is not a dict. |
|
|
83
|
+
| `pdf/legacy-annot/screen-bad-P` | `ParseError` | `/P` is neither ref nor dict. |
|
|
84
|
+
|
|
85
|
+
## See also
|
|
86
|
+
|
|
87
|
+
- [`pdfAnnot`](../annot/annot.md)
|
|
88
|
+
- [`pdf3dRichMedia`](./3d-richmedia.md)
|
|
89
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfLegacyDeprecatedFilters
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, lzw, pdfCcittFaxDecoder]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfLegacyDeprecatedFilters
|
|
11
|
+
|
|
12
|
+
> LZWDecode (via fw) + CCITTFax (via `pdfCcittFaxDecoder`) + DCT/JPX passthrough — legacy.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfLegacyDeprecatedFilters` | **Source** `packages/front/office/pdf/src/extra/legacy-deprecated-filters.js` | **Deps** `pdfErrors`, `lzw` (fw binding), `pdfCcittFaxDecoder` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Read side of three legacy filters. LZWDecode = wrapper over `@awacloud/fw/io/compress/lzw` (TIFF profile, MSB-first, 8-bit min, CLEAR/END), supports `/EarlyChange`. CCITTFaxDecode validates the `DecodeParms` shape and then delegates the actual Group 3/Group 4 decode to the [`pdfCcittFaxDecoder`](./ccitt-fax-decoder.md) dependency — this module is a thin, validated pass-through, not a decoder itself. DCTDecode/JPXDecode are signature-checked passthroughs (JPEG/JPX bytes returned unchanged).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfLegacyDeprecatedFilters');
|
|
22
|
+
// Returns: { lzwDecode, lzwEncode, validateCcittParms, ccittFaxDecode,
|
|
23
|
+
// dctDecode, jpxDecode, CCITT_KEYS }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| Member | Signature | Returns |
|
|
29
|
+
|--------|-----------|---------|
|
|
30
|
+
| `lzwDecode` | `(bytes, decodeParms?) => Uint8Array` | TIFF-profile LZW decode. |
|
|
31
|
+
| `lzwEncode` | `(bytes) => Uint8Array` | TIFF-profile LZW encode. |
|
|
32
|
+
| `validateCcittParms` | `(parms) => NormalizedParms` | Validates and normalizes the CCITT `DecodeParms` shape. |
|
|
33
|
+
| `ccittFaxDecode` | `(bytes, decodeParms) => Uint8Array` | Validates parms then calls `pdfCcittFaxDecoder.decode(bytes, parms)`. |
|
|
34
|
+
| `dctDecode` | `(bytes) => Uint8Array` | Checks the JPEG SOI marker, then passthrough. |
|
|
35
|
+
| `jpxDecode` | `(bytes) => Uint8Array` | Checks the JP2/codestream signature, then passthrough. |
|
|
36
|
+
| `CCITT_KEYS` | `Set` | Accepted CCITT `DecodeParms` keys (`K`, `EndOfLine`, `EncodedByteAlign`, `Columns`, `Rows`, `EndOfBlock`, `BlackIs1`, `DamagedRowsBeforeError`). |
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### LZW decode
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
const ext = runtime.resolve('pdfLegacyDeprecatedFilters');
|
|
44
|
+
const plain = ext.lzwDecode(streamBytes, { EarlyChange: 1 });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### CCITT parms validation + decode
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
const p = ext.validateCcittParms({ K: -1, Columns: 1728, Rows: 100 });
|
|
51
|
+
p.K; // -1 (Group 4)
|
|
52
|
+
p.Columns; // 1728
|
|
53
|
+
|
|
54
|
+
const image = ext.ccittFaxDecode(streamBytes, { K: -1, Columns: 1728, Rows: 100 });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Errors
|
|
58
|
+
|
|
59
|
+
| Code | Class | When |
|
|
60
|
+
|------|-------|------|
|
|
61
|
+
| `pdf/filters/missing-lzw` | `ParseError` | The `lzw` fw dependency has no `decode`/`encode`. |
|
|
62
|
+
| `pdf/filters/missing-ccitt` | `ParseError` | The `pdfCcittFaxDecoder` dependency has no `decode`. |
|
|
63
|
+
| `pdf/filters/bad-input` | `ParseError` | bytes is not a Uint8Array. |
|
|
64
|
+
| `pdf/lzw/bad-earlychange` | `ParseError` | `/EarlyChange` is not 0 or 1. |
|
|
65
|
+
| `pdf/lzw/decode-failed` | `ParseError` | The fw decode threw. |
|
|
66
|
+
| `pdf/lzw/encode-failed` | `ParseError` | The fw encode threw. |
|
|
67
|
+
| `pdf/ccitt/bad-parms` | `ParseError` | parms is not an object. |
|
|
68
|
+
| `pdf/ccitt/unknown-parm` | `ParseError` | A key outside `CCITT_KEYS`. |
|
|
69
|
+
| `pdf/dct/bad-soi` | `ParseError` | JPEG SOI marker absent. |
|
|
70
|
+
| `pdf/jpx/bad-signature` | `ParseError` | Not a recognized JPEG 2000 codestream or JP2 box stream. |
|
|
71
|
+
|
|
72
|
+
Actual T.4/T.6 decode failures (truncation, unrecognized codes) surface through `pdfCcittFaxDecoder`'s own error codes (see that page) — this module does not wrap or rename them.
|
|
73
|
+
|
|
74
|
+
## See also
|
|
75
|
+
|
|
76
|
+
- [`pdfCcittFaxDecoder`](./ccitt-fax-decoder.md)
|
|
77
|
+
- [`pdfFilters`](../syntax/filters/README.md)
|
|
78
|
+
- [Extras index](./README.md)
|