@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,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfRedactionIso32005
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfRedactionIso32005
|
|
11
|
+
|
|
12
|
+
> Opt-in: typing of the ISO/TS 32005 apply-redaction audit record (read side). The TS text is not vendored; the entries below are what this module recognises. No content removal is performed.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfRedactionIso32005` | **Source** `packages/front/office/pdf/src/extra/redaction-iso32005.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
TS 32005 layers an "apply-redaction" workflow on top of the `/Redact` annotation (§12.5.6.21). Captures the audit record: applied annotations, overlay hints (`/RD`, `/IC`, `/RO`), content-stream markers (`/Redact … BMC … EMC`).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfRedactionIso32005');
|
|
22
|
+
// Returns: { typeRedactionRecord, findRedactMarkers, REDACT_MARKERS }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeRedactionRecord` | `(dict) => RedactionRecord` | `{ appliedAt, tool, annotations, rd, ro, ic, markedRegions, raw, _extras }`. |
|
|
30
|
+
| `findRedactMarkers` | `(Uint8Array) => { regions: Array<{ beginOffset, endOffset, kind }> }` | Scans BMC/BDC/EMC markers. |
|
|
31
|
+
| `REDACT_MARKERS` | frozen catalog | `{ begin: '/Redact BMC', beginPropertyList: '/Redact BDC', end: 'EMC', notes }`. |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Audit record
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const ext = runtime.resolve('pdfRedactionIso32005');
|
|
39
|
+
const r = ext.typeRedactionRecord(auditDict);
|
|
40
|
+
r.appliedAt; // '2026-05-15'
|
|
41
|
+
r.annotations; // [ ref, ref, … ]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Markers in the content stream
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const m = ext.findRedactMarkers(contentBytes);
|
|
48
|
+
m.regions.length; // 1
|
|
49
|
+
m.regions[0].kind; // 'BMC'
|
|
50
|
+
m.regions[0].endOffset; // > beginOffset, or null if EMC is missing
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Errors
|
|
54
|
+
|
|
55
|
+
| Code | Class | When |
|
|
56
|
+
|------|-------|------|
|
|
57
|
+
| `pdf/extra/redact32005/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
58
|
+
| `pdf/extra/redact32005/bad-annotations` | `ParseError` | `/Annotations` is not an array. |
|
|
59
|
+
| `pdf/extra/redact32005/scan/bad-input` | `ParseError` | Bytes are not a Uint8Array. |
|
|
60
|
+
|
|
61
|
+
## See also
|
|
62
|
+
|
|
63
|
+
- [`pdfRedactAnnot`](../annot/redact.md)
|
|
64
|
+
- [`pdfContentStream`](../content/stream.md)
|
|
65
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfShadingTyped
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfShadingTyped
|
|
11
|
+
|
|
12
|
+
> Typed Shading dicts (§8.7.4) and Function dicts (§7.10) — ISO 32000-2.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfShadingTyped` | **Source** `packages/front/office/pdf/src/extra/shading-typed.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Shadings 1–7 (Function-based, Axial, Radial, Free-form Gouraud, Lattice-form Gouraud, Coons patch mesh, Tensor-product patch mesh). Functions 0/2/3/4 (Sampled, Exponential, Stitching, PostScript).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfShadingTyped');
|
|
22
|
+
// Returns: { typeShading, typeFunction }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeShading` | `(dict\|stream) => Shading` | Record shaped by `/ShadingType`. |
|
|
30
|
+
| `typeFunction` | `(dict\|stream) => Function` | Record shaped by `/FunctionType`. |
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Axial shading
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const ext = runtime.resolve('pdfShadingTyped');
|
|
38
|
+
const sh = ext.typeShading(shadingDict);
|
|
39
|
+
sh.shadingType; // 2
|
|
40
|
+
sh.coords; // [x0, y0, x1, y1]
|
|
41
|
+
sh.function; // raw /Function entry
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Stitching function
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const fn = ext.typeFunction(fnDict);
|
|
48
|
+
fn.functionType; // 3
|
|
49
|
+
fn.functions; // array of sub-function entries
|
|
50
|
+
fn.bounds; // [...]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Errors
|
|
54
|
+
|
|
55
|
+
| Code | Class | When |
|
|
56
|
+
|------|-------|------|
|
|
57
|
+
| `pdf/extra/shading/not-dict-or-stream` | `ParseError` | Invalid input. |
|
|
58
|
+
| `pdf/extra/shading/missing-type` | `ParseError` | `/ShadingType` absent. |
|
|
59
|
+
| `pdf/extra/shading/bad-type` | `ParseError` | `/ShadingType` outside 1..7. |
|
|
60
|
+
| `pdf/extra/shading/lattice-missing-vpr` | `ParseError` | Type 5 without `/VerticesPerRow`. |
|
|
61
|
+
| `pdf/extra/shading/mesh-missing-bits` | `ParseError` | Type 4/6/7 without `/BitsPerCoordinate`/`/BitsPerComponent`. |
|
|
62
|
+
| `pdf/extra/shading/mesh-missing-decode` | `ParseError` | `/Decode` absent. |
|
|
63
|
+
| `pdf/extra/shading/mesh-missing-flag` | `ParseError` | `/BitsPerFlag` absent (Type 4/6/7). |
|
|
64
|
+
| `pdf/extra/shading/bad-coords` | `ParseError` | `/Coords` malformed. |
|
|
65
|
+
| `pdf/extra/function/not-dict-or-stream` | `ParseError` | Invalid input. |
|
|
66
|
+
| `pdf/extra/function/missing-type` | `ParseError` | `/FunctionType` absent. |
|
|
67
|
+
| `pdf/extra/function/bad-type` | `ParseError` | `/FunctionType` outside {0,2,3,4}. |
|
|
68
|
+
|
|
69
|
+
## See also
|
|
70
|
+
|
|
71
|
+
- [`pdfColorSpacesExtended`](./color-spaces-extended.md)
|
|
72
|
+
- [`pdfGraphics`](../content/graphics.md)
|
|
73
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfSigAesGcm
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfSigAesGcm
|
|
11
|
+
|
|
12
|
+
> AES-GCM crypt filter (`/CFM /AESV4`) — ISO/TS 32003.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfSigAesGcm` | **Source** `packages/front/office/pdf/src/extra/sig-aes-gcm.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
TS 32003 adds `/CFM /AESV4` (AES-256 GCM) to the Standard Security Handler v6. Wire format: `IV (12) ‖ ciphertext ‖ tag (16)`. This module inspects an `/Encrypt` dict, locates the CF entries, and surfaces a typed view identifying GCM crypt filters.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfSigAesGcm');
|
|
22
|
+
// Returns: { typeEncryptForGcm, typeCfEntry, validateGcmFraming, CFM_CATALOG }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeEncryptForGcm` | `(encryptDict) => { v, r, length, stmF, strF, eff, cf, hasAesGcm, raw, _extras }` | GCM-focused view. |
|
|
30
|
+
| `typeCfEntry` | `(dict) => { cfm, authEvent, length, catalog, raw, _extras }` | A single `/CF` entry. |
|
|
31
|
+
| `validateGcmFraming` | `(Uint8Array) => { iv, ciphertext, tag }` | Splits the TS 32003 framing. |
|
|
32
|
+
| `CFM_CATALOG` | frozen catalog | CFM name → `{ cipher, keyBits, mode?, notes }`. |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Detect AES-GCM
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const ext = runtime.resolve('pdfSigAesGcm');
|
|
40
|
+
const e = ext.typeEncryptForGcm(encryptDict);
|
|
41
|
+
e.hasAesGcm; // true
|
|
42
|
+
e.cf.StdCF.cfm; // 'AESV4'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Split a framed buffer
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const f = ext.validateGcmFraming(framedBytes);
|
|
49
|
+
f.iv.length; // 12
|
|
50
|
+
f.tag.length; // 16
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Errors
|
|
54
|
+
|
|
55
|
+
| Code | Class | When |
|
|
56
|
+
|------|-------|------|
|
|
57
|
+
| `pdf/extra/sig-aes-gcm/not-dict` | `ParseError` | encryptDict is not a dict. |
|
|
58
|
+
| `pdf/extra/sig-aes-gcm/bad-cf` | `ParseError` | `/CF` is not a dict. |
|
|
59
|
+
| `pdf/extra/sig-aes-gcm/bad-cf-entry` | `ParseError` | A CF entry is not a dict. |
|
|
60
|
+
| `pdf/extra/sig-aes-gcm/cf-entry-not-dict` | `ParseError` | `typeCfEntry` argument is not a dict. |
|
|
61
|
+
| `pdf/extra/sig-aes-gcm/bad-input` | `EncryptionError` | Framing input is not a Uint8Array. |
|
|
62
|
+
| `pdf/extra/sig-aes-gcm/too-short` | `EncryptionError` | Framed buffer is under 28 bytes. |
|
|
63
|
+
|
|
64
|
+
## See also
|
|
65
|
+
|
|
66
|
+
- [`pdfStandardV6`](../crypto/standardV6.md)
|
|
67
|
+
- [`pdfAesGcm`](../crypto/aesGcm.md)
|
|
68
|
+
- [`pdfSigPades`](./sig-pades.md)
|
|
69
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfSigPades
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfSigPades
|
|
11
|
+
|
|
12
|
+
> PAdES profile detection (ETSI EN 319 142-1), `/Reference` array, DSS, DocMDP and B-LTA chain validation — ISO 32000-2 §12.8.4.3.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfSigPades` | **Source** `packages/front/office/pdf/src/extra/sig-pades.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
PAdES profiles by `/SubFilter`: `ETSI.CAdES.detached` (B-B/B-T), `ETSI.RFC3161` (Document Timestamp), `adbe.pkcs7.detached` (non-PAdES). Inferred levels: B-B (signature only), B-T (+timestamp), B-LT (+DSS), B-LTA (+DocTimeStamp over DSS). Does NOT verify the cryptography.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfSigPades');
|
|
22
|
+
// Returns: { detectPadesProfile, typeReferenceArray, typeDSS,
|
|
23
|
+
// validateDocMdp, validateBLtaChain, SIG_SUBFILTERS }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| Member | Signature | Returns |
|
|
29
|
+
|--------|-----------|---------|
|
|
30
|
+
| `detectPadesProfile` | `(sigDict, ctx?) => { subFilter, isPades, level, hasTimestamp }` | `level` is `B-B`/`B-T`/`B-LT`/`B-LTA` or `null` when not PAdES. |
|
|
31
|
+
| `typeReferenceArray` | `(array) => Reference[]` | Records for `/Reference` items. |
|
|
32
|
+
| `typeDSS` | `(dict) => DSS` | `{ certs, ocsps, crls, vri, raw, _extras }`. |
|
|
33
|
+
| `validateDocMdp` | `(reference) => { valid, level, issues }` | Validates a DocMDP `/Reference` entry (`/TransformMethod /DocMDP`). |
|
|
34
|
+
| `validateBLtaChain` | `(steps) => { chainLevel, trace }` | Walks a chronological list of `{ sigDict, hasDss, hasDocTimestamp, hasSignatureTimestamp }` steps and reports the resulting PAdES level at each step. |
|
|
35
|
+
| `SIG_SUBFILTERS` | frozen catalog | SubFilter name → `{ pades, kind }`. |
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### PAdES detection
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
const ext = runtime.resolve('pdfSigPades');
|
|
43
|
+
const p = ext.detectPadesProfile(sigDict, { dss: {}, hasDocTimestampOverDss: false });
|
|
44
|
+
p.level; // 'B-LT'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### DSS
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
const dss = ext.typeDSS(dssDict);
|
|
51
|
+
dss.certs.length; // 3
|
|
52
|
+
dss.vri; // { 'C1D2E3...': { cert, crl, ocsp, tu, ts } }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### DocMDP reference
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
const v = ext.validateDocMdp(referenceRecord);
|
|
59
|
+
v.valid; // true | false
|
|
60
|
+
v.level; // 1 | 2 | 3 | null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### B-LTA chain
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const chain = ext.validateBLtaChain([
|
|
67
|
+
{ sigDict: firstSig, hasDss: false },
|
|
68
|
+
{ sigDict: secondSig, hasDss: true, hasDocTimestamp: true }
|
|
69
|
+
]);
|
|
70
|
+
chain.chainLevel; // 'B-LTA'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Errors
|
|
74
|
+
|
|
75
|
+
| Code | Class | When |
|
|
76
|
+
|------|-------|------|
|
|
77
|
+
| `pdf/extra/pades/not-dict` | `ParseError` | sigDict is not a dict. |
|
|
78
|
+
| `pdf/extra/pades/bad-reference` | `ParseError` | `/Reference` is not an array. |
|
|
79
|
+
| `pdf/extra/pades/bad-reference-item` | `ParseError` | An item is not a dict. |
|
|
80
|
+
| `pdf/extra/pades/bad-reference-type` | `ParseError` | `/Type` is not `/SigRef`. |
|
|
81
|
+
| `pdf/extra/pades/dss-not-dict` | `ParseError` | DSS is not a dict. |
|
|
82
|
+
| `pdf/extra/pades/dss-bad-type` | `ParseError` | `/Type` is not `/DSS`. |
|
|
83
|
+
| `pdf/extra/pades/dss-bad-array` | `ParseError` | `/Certs`/`/OCSPs`/`/CRLs` is not an array. |
|
|
84
|
+
| `pdf/extra/pades/chain/bad-input` | `ParseError` | `validateBLtaChain` argument is not an array. |
|
|
85
|
+
| `pdf/extra/pades/chain/missing-sig` | `ParseError` | A step is missing `sigDict`. |
|
|
86
|
+
|
|
87
|
+
### DocMDP validation issues (non-throwing, returned in `issues`)
|
|
88
|
+
|
|
89
|
+
| Code | When |
|
|
90
|
+
|------|------|
|
|
91
|
+
| `pdf/extra/pades/mdp/wrong-transform` | Reference is not a DocMDP transform. |
|
|
92
|
+
| `pdf/extra/pades/mdp/missing-params` | `/TransformParams` dict missing. |
|
|
93
|
+
| `pdf/extra/pades/mdp/bad-p-type` | `/P` is not an integer. |
|
|
94
|
+
| `pdf/extra/pades/mdp/bad-p-value` | `/P` is not 1, 2, or 3. |
|
|
95
|
+
| `pdf/extra/pades/mdp/bad-version` | Unknown DocMDP `/V`. |
|
|
96
|
+
| `pdf/extra/pades/mdp/missing-digest` | `/DigestMethod` absent on the reference. |
|
|
97
|
+
|
|
98
|
+
## See also
|
|
99
|
+
|
|
100
|
+
- [`pdfSignature`](../sig/signature.md)
|
|
101
|
+
- [`pdfTimestamp`](../sig/timestamp.md)
|
|
102
|
+
- [`pdfSigAesGcm`](./sig-aes-gcm.md)
|
|
103
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfTaggedPdfTyped
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParserObj]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfTaggedPdfTyped
|
|
11
|
+
|
|
12
|
+
> Typing of structural attribute dictionaries (`/O` Owner) — ISO 32000-2 §14.8.5.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfTaggedPdfTyped` | **Source** `packages/front/office/pdf/src/extra/tagged-pdf-typed.js` | **Deps** `pdfErrors`, `pdfParserObj` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Covers the standard attribute owners: Layout (§14.8.5.4), List (§14.8.5.5), Table (§14.8.5.7), PrintField (§14.8.5.6), Artifact (§14.8.2.2), UserProperties (§14.8.5.10). Dispatches on `/O`; unknown keys are preserved under `_extras`.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfTaggedPdfTyped');
|
|
22
|
+
// Returns: { typeStructAttribute, ATTRIBUTE_OWNERS }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeStructAttribute` | `(dict) => StructAttr` | Record `{ owner, ...typed, raw, _extras }`. |
|
|
30
|
+
| `ATTRIBUTE_OWNERS` | `Set<string>` | `Layout`, `List`, `Table`, `PrintField`, `Artifact`, `UserProperties`. |
|
|
31
|
+
|
|
32
|
+
### Shape `StructAttr` (Layout)
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
{ owner: 'Layout', placement, writingMode, backgroundColor,
|
|
36
|
+
borderColor, borderStyle, borderThickness, padding,
|
|
37
|
+
color, spaceBefore, spaceAfter, …, raw, _extras }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Type a Layout attribute
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const ext = runtime.resolve('pdfTaggedPdfTyped');
|
|
46
|
+
const a = ext.typeStructAttribute(layoutDict);
|
|
47
|
+
a.owner; // 'Layout'
|
|
48
|
+
a.placement; // 'Block'
|
|
49
|
+
a.writingMode; // 'LrTb'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### UserProperties
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
const up = ext.typeStructAttribute(userPropsDict);
|
|
56
|
+
up.properties; // [ { name: 'role', value: 'caption', formatted: false, hidden: false }, … ]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Catalog
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
ext.ATTRIBUTE_OWNERS.has('Table'); // true
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Errors
|
|
66
|
+
|
|
67
|
+
| Code | Class | When |
|
|
68
|
+
|------|-------|------|
|
|
69
|
+
| `pdf/extra/tagged/not-dict` | `ParseError` | Argument is not a dictionary. |
|
|
70
|
+
| `pdf/extra/tagged/missing-owner` | `ParseError` | `/O` missing or not a name. |
|
|
71
|
+
| `pdf/extra/tagged/bad-user-property` | `ParseError` | A `/P` item is malformed. |
|
|
72
|
+
|
|
73
|
+
## See also
|
|
74
|
+
|
|
75
|
+
- [`pdfStructTree`](../tagged/structTree.md)
|
|
76
|
+
- [`pdfStructElement`](../tagged/structElement.md)
|
|
77
|
+
- [`pdfUaTagged`](./pdf-ua-tagged.md)
|
|
78
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfTransparencyTyped
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfTransparencyTyped
|
|
11
|
+
|
|
12
|
+
> Transparency Group (§11.6.6), Soft Mask (§11.6.5.2), blend modes (§11.3.5) — ISO 32000-2.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfTransparencyTyped` | **Source** `packages/front/office/pdf/src/extra/transparency-typed.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Types the group attributes `/Group /S /Transparency` (§11.6.6), the soft masks `/Luminosity` / `/Alpha` with `/TR` transfer (§11.6.5.2), and exposes the frozen catalog of standard blend modes (§11.3.5 Table 136).
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfTransparencyTyped');
|
|
22
|
+
// Returns: { typeTransparencyGroup, typeSoftMask, resolveBlendMode, BLEND_MODES }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `typeTransparencyGroup` | `(dict) => Group` | `{ s, cs, isolated, knockout, raw, _extras }`. |
|
|
30
|
+
| `typeSoftMask` | `(dict) => SoftMask` | `{ kind, g, backdrop, transfer, raw, _extras }`. |
|
|
31
|
+
| `resolveBlendMode` | `(value) => string \| null` | Decodes a name or the first recognized name in an array. |
|
|
32
|
+
| `BLEND_MODES` | frozen array | 17 standard modes (includes `Compatible`). |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Group
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const ext = runtime.resolve('pdfTransparencyTyped');
|
|
40
|
+
const g = ext.typeTransparencyGroup(groupDict);
|
|
41
|
+
g.s; // 'Transparency'
|
|
42
|
+
g.cs; // raw /CS entry
|
|
43
|
+
g.isolated; // true
|
|
44
|
+
g.knockout; // false
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Blend mode resolution
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
ext.resolveBlendMode({ type: 'name', value: 'Multiply' }); // 'Multiply'
|
|
51
|
+
ext.resolveBlendMode({ type: 'array', items: [
|
|
52
|
+
{ type: 'name', value: 'Saturation' },
|
|
53
|
+
{ type: 'name', value: 'Normal' }
|
|
54
|
+
]}); // 'Saturation' (first recognized name)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Errors
|
|
58
|
+
|
|
59
|
+
| Code | Class | When |
|
|
60
|
+
|------|-------|------|
|
|
61
|
+
| `pdf/extra/transparency-group/not-dict` | `ParseError` | Group is not a dict. |
|
|
62
|
+
| `pdf/extra/transparency-group/bad-type` | `ParseError` | `/Type` present and not `/Group`. |
|
|
63
|
+
| `pdf/extra/transparency-group/bad-s` | `ParseError` | `/S` is not `/Transparency`. |
|
|
64
|
+
| `pdf/extra/soft-mask/not-dict` | `ParseError` | SoftMask is not a dict. |
|
|
65
|
+
| `pdf/extra/soft-mask/bad-type` | `ParseError` | `/Type` is not `/Mask`. |
|
|
66
|
+
| `pdf/extra/soft-mask/bad-s` | `ParseError` | `/S` is not `Luminosity`/`Alpha`. |
|
|
67
|
+
| `pdf/extra/soft-mask/missing-g` | `ParseError` | `/G` (transparency group XObject) absent. |
|
|
68
|
+
| `pdf/extra/blend-mode/bad-type` | `ParseError` | Value is neither a name nor an array. |
|
|
69
|
+
|
|
70
|
+
## See also
|
|
71
|
+
|
|
72
|
+
- [`pdfGraphics`](../content/graphics.md)
|
|
73
|
+
- [`pdfContentOpsExtended`](./content-ops-extended.md)
|
|
74
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfWellTagged
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors, pdfParser]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfWellTagged
|
|
11
|
+
|
|
12
|
+
> WTPDF 1.0 (Well-Tagged PDF) linter — best practices beyond PDF/UA.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfWellTagged` | **Source** `packages/front/office/pdf/src/extra/well-tagged-pdf.js` | **Deps** `pdfErrors`, `pdfParser` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
WTPDF 1.0 (PDF Association, 2024). Rule families: Artifact placement (tagged decorative content), `/Span` use (no bare pseudo-paragraph span), Table (`/Table` → `/TR` → `/TH`/`/TD`), List (`/L` → `/LI` → `/Lbl` + `/LBody`), heading-level jumps.
|
|
17
|
+
|
|
18
|
+
## Resolve
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const ext = runtime.resolve('pdfWellTagged');
|
|
22
|
+
// Returns: { lintWellTagged, checkArtifactPlacement, WTPDF_RULES }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Member | Signature | Returns |
|
|
28
|
+
|--------|-----------|---------|
|
|
29
|
+
| `lintWellTagged` | `(structTree) => { pass, errors, warnings }` | Walks the tree and applies the WTPDF checks. |
|
|
30
|
+
| `checkArtifactPlacement` | `(regions) => { pass, errors, warnings }` | Checks an array of content regions. |
|
|
31
|
+
| `WTPDF_RULES` | frozen catalog | Rule id → description (`wtpdf/artifact`, `wtpdf/span/empty`, `wtpdf/table/empty`, `wtpdf/table/row`, `wtpdf/list/empty`, `wtpdf/list/item`, `wtpdf/heading/jump`). |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Lint a tree
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const ext = runtime.resolve('pdfWellTagged');
|
|
39
|
+
const r = ext.lintWellTagged(structTree);
|
|
40
|
+
r.errors.find(e => e.rule === 'wtpdf/table/empty');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Artifact placement
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
ext.checkArtifactPlacement(regions).errors;
|
|
47
|
+
// [ { rule: 'wtpdf/artifact', message: '…', mcid } ]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Errors
|
|
51
|
+
|
|
52
|
+
| Code | Class | When |
|
|
53
|
+
|------|-------|------|
|
|
54
|
+
| `pdf/extra/wtpdf/bad-tree` | `ParseError` | structTree is not an object. |
|
|
55
|
+
| `pdf/extra/wtpdf/regions/bad-input` | `ParseError` | regions is not an array. |
|
|
56
|
+
|
|
57
|
+
## See also
|
|
58
|
+
|
|
59
|
+
- [`pdfUaTagged`](./pdf-ua-tagged.md)
|
|
60
|
+
- [`pdfStructTree`](../tagged/structTree.md)
|
|
61
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfXmpExtended
|
|
3
|
+
category: pdf/extra
|
|
4
|
+
dependencies: [pdfErrors]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfXmpExtended
|
|
11
|
+
|
|
12
|
+
> Minimal XMP packet (RDF/XML) extractor.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfXmpExtended` | **Source** `packages/front/office/pdf/src/extra/xmp-extended.js` | **Deps** `pdfErrors` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Tokenizes an XMP RDF/XML packet for a fixed set of well-known namespaces and pulls out tag→value pairs. Not a full RDF parser — it walks the element stream and harvests qualified tags whose prefix maps to a known namespace.
|
|
17
|
+
|
|
18
|
+
Supported namespaces: `dc`, `xmp`, `xmpMM`, `pdf`, `pdfaid`, `pdfuaid`.
|
|
19
|
+
|
|
20
|
+
## Resolve
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
const ext = runtime.resolve('pdfXmpExtended');
|
|
24
|
+
// Returns: { parsePacket, extract, group, KNOWN_NAMESPACES }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| Member | Signature | Returns |
|
|
30
|
+
|--------|-----------|---------|
|
|
31
|
+
| `parsePacket` | `(string \| Uint8Array) => { pairs, grouped }` | Top-level entry point. |
|
|
32
|
+
| `extract` | `(input) => Pair[]` | Flat list `{ prefix, ns, localName, value, attrs }`. |
|
|
33
|
+
| `group` | `(pairs) => { [prefix]: { [localName]: value \| values[] } }` | Re-groups a flat pair list. |
|
|
34
|
+
| `KNOWN_NAMESPACES` | object | URI → prefix. |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Parse
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
const ext = runtime.resolve('pdfXmpExtended');
|
|
42
|
+
const r = ext.parsePacket(xmpBytes);
|
|
43
|
+
r.grouped.dc.title; // 'My Document'
|
|
44
|
+
r.grouped.pdfaid.part; // '2'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Flat extract
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
ext.extract(xmpBytes);
|
|
51
|
+
// [ { prefix: 'dc', ns: '...', localName: 'title', value: '...', attrs: {} }, … ]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Errors
|
|
55
|
+
|
|
56
|
+
| Code | Class | When |
|
|
57
|
+
|------|-------|------|
|
|
58
|
+
| `pdf/xmp2/bad-input` | `ParseError` | Neither a string nor a Uint8Array. |
|
|
59
|
+
| `pdf/xmp2/unclosed-tag` | `ParseError` | Malformed XML (unclosed tag). |
|
|
60
|
+
|
|
61
|
+
## See also
|
|
62
|
+
|
|
63
|
+
- [`pdfXmp`](../metadata/xmp.md)
|
|
64
|
+
- [`pdfInfoDictDeprecated`](./info-dict-deprecated.md)
|
|
65
|
+
- [Extras index](./README.md)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Font — ISO 32000-2 §9.6 / §9.7 / §9.9
|
|
2
|
+
|
|
3
|
+
Typing of PDF Font dicts + `/Encoding` resolution + the embedding adapter. Parsing of the font files themselves (TrueType, Type1, CFF, CIDFont) is delegated to `@awacloud/fonts`.
|
|
4
|
+
|
|
5
|
+
| Module | Returns | Deps | Description |
|
|
6
|
+
|--------|----------|------|-------------|
|
|
7
|
+
| [`pdfFont`](./font.md) | `{ typeFont, resolveDescendant }` | `pdfErrors`, `pdfParser` | Font dict, §9.6 / §9.7. |
|
|
8
|
+
| [`pdfFontEncoding`](./encoding.md) | `{ resolveEncoding }` | `pdfErrors` | `/Encoding`, §9.6.5. |
|
|
9
|
+
| [`pdfType3`](./type3.md) | `{ typeType3 }` | `pdfErrors`, `pdfParser` | PDF-specific Type 3, §9.6.4. |
|
|
10
|
+
| [`pdfFontEmbed`](./embed.md) | `{ embedSimple, embedCid }` | `pdfErrors`, `embedSubsetForPdf`, `embedFontDescriptor`, `embedCidSystemInfo`, `embedToUnicodeBuilder` | Write-side adapter, §9.9 / ISO TS 32001. |
|
|
11
|
+
|
|
12
|
+
## Common pattern
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const f = runtime.resolve('pdfFont');
|
|
16
|
+
const enc = runtime.resolve('pdfFontEncoding');
|
|
17
|
+
const font = f.typeFont(resources.Font.F1);
|
|
18
|
+
const table = enc.resolveEncoding(font.encoding, lookupNamed);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## See also
|
|
22
|
+
|
|
23
|
+
- [`pdfText`](../content/text.md) — `extractText` consumes `subtype` + ToUnicode.
|
|
24
|
+
- [`pdfResources`](../document/resources.md) — supplies the dicts.
|
|
25
|
+
- [Syntax layer](../syntax/README.md) — the underlying `pdfParser`.
|