@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,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfFileAttachAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfFileAttachAnnot
|
|
11
|
+
|
|
12
|
+
> File-attachment annotation — ISO 32000-2 §12.5.6.15.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfFileAttachAnnot` | **Source** `packages/front/office/pdf/src/annot/fileAttach.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/FileAttachment`. Key entries: `/FS` (file specification — see
|
|
17
|
+
[`pdfFileSpec`](../embedded/fileSpec.md)) and `/Name` (icon — `Graph`,
|
|
18
|
+
`PushPin`, `Paperclip`, `Tag`). The payload lives in the file spec's `/EF`
|
|
19
|
+
stream. `/FS` is required and must be a reference or a dictionary.
|
|
20
|
+
|
|
21
|
+
## Resolve
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
const fa = runtime.resolve('pdfFileAttachAnnot');
|
|
25
|
+
// Returns: { typeFileAttachAnnot }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
| Method | Signature | Returns |
|
|
31
|
+
|--------|-----------|---------|
|
|
32
|
+
| `typeFileAttachAnnot` | `(dict) => FileAttachAnnot` | Base record plus `fs` (raw typed `/FS` — ref or dict) and `iconName`. |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const fa = runtime.resolve('pdfFileAttachAnnot').typeFileAttachAnnot(dict);
|
|
38
|
+
const spec = runtime.resolve('pdfFileSpec').typeFileSpec(doc._raw.resolve(fa.fs));
|
|
39
|
+
spec.f; // filename (/F)
|
|
40
|
+
spec.embedded?.F; // /EF /F — the embedded-file stream reference
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Errors
|
|
44
|
+
|
|
45
|
+
| Code | Class | When |
|
|
46
|
+
|------|-------|------|
|
|
47
|
+
| `pdf/annot/fileattach/bad-subtype` | `ParseError` | `/Subtype` present and not `/FileAttachment`. |
|
|
48
|
+
| `pdf/annot/fileattach/bad-fs` | `ParseError` | `/FS` missing, or neither a reference nor a dictionary. |
|
|
49
|
+
|
|
50
|
+
## See also
|
|
51
|
+
|
|
52
|
+
- [`pdfAnnot`](./annot.md) · [`pdfMarkupAnnot`](./markup.md)
|
|
53
|
+
- [`pdfFileSpec`](../embedded/fileSpec.md) · [`pdfEmbeddedFile`](../embedded/embeddedFile.md)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfFreeTextAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfFreeTextAnnot
|
|
11
|
+
|
|
12
|
+
> Free text annotation — ISO 32000-2 §12.5.6.6.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfFreeTextAnnot` | **Source** `packages/front/office/pdf/src/annot/freeText.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/FreeText` — text painted directly on the page rather than in a pop-up.
|
|
17
|
+
Subtype-specific entries: `/DA` (default appearance string — a sequence of `Tf`,
|
|
18
|
+
`g`, `rg`, … operators), `/Q` (quadding 0/1/2), `/RC` (rich content), `/DS`
|
|
19
|
+
(default style, CSS), `/CL` (callout line array), `/IT` (intent: `FreeText`,
|
|
20
|
+
`FreeTextCallout`, `FreeTextTypeWriter`), `/RD` (rectangle differences) and
|
|
21
|
+
`/LE` (line ending). `/BS` and `/BE` come from the base record.
|
|
22
|
+
|
|
23
|
+
## Resolve
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const ft = runtime.resolve('pdfFreeTextAnnot');
|
|
27
|
+
// Returns: { typeFreeTextAnnot }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| Method | Signature | Returns |
|
|
33
|
+
|--------|-----------|---------|
|
|
34
|
+
| `typeFreeTextAnnot` | `(dict) => FreeTextAnnot` | Base record plus `da`, `q`, `rc`, `ds`, `cl`, `it`, `rd`, `le`. |
|
|
35
|
+
|
|
36
|
+
`da`, `rc` and `ds` are the raw `Uint8Array` payloads of the PDF strings; `le` is
|
|
37
|
+
a single name (not an array).
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Plain free text
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const f = runtime.resolve('pdfFreeTextAnnot').typeFreeTextAnnot(dict);
|
|
45
|
+
f.contents; // body text
|
|
46
|
+
f.da; // Uint8Array — Tf + rg/g sequence
|
|
47
|
+
f.q; // 0=left, 1=center, 2=right
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Callout
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
f.it === 'FreeTextCallout';
|
|
54
|
+
f.cl; // [x1, y1, x2, y2, x3, y3] — knee/elbow points
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Errors
|
|
58
|
+
|
|
59
|
+
| Code | Class | When |
|
|
60
|
+
|------|-------|------|
|
|
61
|
+
| `pdf/annot/freetext/bad-subtype` | `ParseError` | `/Subtype` present and not `/FreeText`. |
|
|
62
|
+
| `pdf/annot/freetext/bad-cl` | `ParseError` | `/CL` is not an array of numbers. |
|
|
63
|
+
| `pdf/annot/freetext/bad-rd` | `ParseError` | `/RD` is not an array of numbers. |
|
|
64
|
+
|
|
65
|
+
## See also
|
|
66
|
+
|
|
67
|
+
- [`pdfAnnot`](./annot.md)
|
|
68
|
+
- [`pdfAppearance`](../form/appearance.md) — `/AP` shares the same mechanics.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfInkAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfInkAnnot
|
|
11
|
+
|
|
12
|
+
> Ink (freehand) annotation — ISO 32000-2 §12.5.6.13.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfInkAnnot` | **Source** `packages/front/office/pdf/src/annot/ink.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Ink`. A freehand trace: `/InkList` is an array of strokes, each stroke
|
|
17
|
+
itself an array of coordinates `[x0 y0 x1 y1 …]` (pairs). `/BS` — part of the
|
|
18
|
+
base record — carries width and style. The typer validates the shape strictly:
|
|
19
|
+
an array of arrays of numeric pairs. `/InkList` is the only subtype-specific
|
|
20
|
+
entry; everything else lands in the base record or in `_extras`.
|
|
21
|
+
|
|
22
|
+
## Resolve
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const ink = runtime.resolve('pdfInkAnnot');
|
|
26
|
+
// Returns: { typeInkAnnot }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Method | Signature | Returns |
|
|
32
|
+
|--------|-----------|---------|
|
|
33
|
+
| `typeInkAnnot` | `(dict) => InkAnnot` | Base record plus `inkList: number[][]`. |
|
|
34
|
+
|
|
35
|
+
Each sub-array of `inkList` is one stroke; an even length is guaranteed.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### Reading the strokes
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
const a = runtime.resolve('pdfInkAnnot').typeInkAnnot(dict);
|
|
43
|
+
for (const stroke of a.inkList) {
|
|
44
|
+
for (let i = 0; i < stroke.length; i += 2) {
|
|
45
|
+
const [x, y] = [stroke[i], stroke[i + 1]];
|
|
46
|
+
// …
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Line width
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
a.bs?.entries.W?.value; // line width, from the base record
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Errors
|
|
58
|
+
|
|
59
|
+
| Code | Class | When |
|
|
60
|
+
|------|-------|------|
|
|
61
|
+
| `pdf/annot/ink/bad-subtype` | `ParseError` | `/Subtype` present and not `/Ink`. |
|
|
62
|
+
| `pdf/annot/ink/bad-inklist` | `ParseError` | `/InkList` is not an array. |
|
|
63
|
+
| `pdf/annot/ink/bad-stroke` | `ParseError` | A non-array element inside `/InkList`. |
|
|
64
|
+
| `pdf/annot/ink/bad-coord` | `ParseError` | Stroke of odd length, or a non-numeric element. |
|
|
65
|
+
|
|
66
|
+
## See also
|
|
67
|
+
|
|
68
|
+
- [`pdfAnnot`](./annot.md)
|
|
69
|
+
- [`pdfMarkupAnnot`](./markup.md) — shared markup entries land in `_extras` here too.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfLinkAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfLinkAnnot
|
|
11
|
+
|
|
12
|
+
> Hyperlink — ISO 32000-2 §12.5.6.5.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfLinkAnnot` | **Source** `packages/front/office/pdf/src/annot/link.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Link`. Subtype-specific entries: `/A` (action — see
|
|
17
|
+
[`pdfAction`](../action/action.md)), `/Dest` (destination — see
|
|
18
|
+
[`pdfDestination`](../destination/destination.md)), `/H` (highlight mode —
|
|
19
|
+
`N`/`I`/`O`/`P`), `/PA` (legacy URI action) and `/QuadPoints` (clickable
|
|
20
|
+
regions, multiples of 8 floats §12.5.6.10). `/BS` is part of the base record.
|
|
21
|
+
Any other entry lands in `_extras`.
|
|
22
|
+
|
|
23
|
+
## Resolve
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const link = runtime.resolve('pdfLinkAnnot');
|
|
27
|
+
// Returns: { typeLinkAnnot }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| Method | Signature | Returns |
|
|
33
|
+
|--------|-----------|---------|
|
|
34
|
+
| `typeLinkAnnot` | `(dict) => LinkAnnot` | Base record plus `dest`, `action`, `h`, `pa`, `quadPoints`. |
|
|
35
|
+
|
|
36
|
+
`/A` is surfaced as `action` (and only when it is a dictionary, not an indirect
|
|
37
|
+
reference); `dest` is the raw typed `/Dest` value, left unresolved. `action` and
|
|
38
|
+
`dest` are mutually exclusive in practice; the typer does not arbitrate — the
|
|
39
|
+
semantic resolver (catalog walker) prioritises `/A`.
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Link to a URI
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const link = runtime.resolve('pdfLinkAnnot').typeLinkAnnot(dict);
|
|
47
|
+
if (link.action) {
|
|
48
|
+
const act = runtime.resolve('pdfAction').typeAction(link.action, typers);
|
|
49
|
+
act.kind === 'URI';
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Internal link (destination)
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
if (link.dest) {
|
|
57
|
+
const d = runtime.resolve('pdfDestination')
|
|
58
|
+
.typeDestination(link.dest, catalog.names, resolveRef);
|
|
59
|
+
d.page;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Errors
|
|
64
|
+
|
|
65
|
+
| Code | Class | When |
|
|
66
|
+
|------|-------|------|
|
|
67
|
+
| `pdf/annot/not-dict` | `ParseError` | Inherited from `typeBaseAnnot`. |
|
|
68
|
+
| `pdf/annot/link/bad-subtype` | `ParseError` | `/Subtype` present and not `/Link`. |
|
|
69
|
+
| `pdf/annot/link/bad-quadpoints` | `ParseError` | `/QuadPoints` is not an array of numbers. |
|
|
70
|
+
|
|
71
|
+
## See also
|
|
72
|
+
|
|
73
|
+
- [`pdfAnnot`](./annot.md)
|
|
74
|
+
- [`pdfAction`](../action/action.md) · [`pdfDestination`](../destination/destination.md)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfMarkupAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfMarkupAnnot
|
|
11
|
+
|
|
12
|
+
> Text-markup annotations — ISO 32000-2 §12.5.6.10.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfMarkupAnnot` | **Source** `packages/front/office/pdf/src/annot/markup.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Covers the `Highlight`, `Underline`, `Squiggly`, `StrikeOut` and `Caret`
|
|
17
|
+
subtypes. The typer consumes `/QuadPoints` (8 × n floats — the four corners of
|
|
18
|
+
each region), `/IT` (intent) and, for `Caret` only (§12.5.6.11), `/RD`
|
|
19
|
+
(rectangle differences) and `/Sy` (displayed symbol).
|
|
20
|
+
|
|
21
|
+
The shared markup entries of §12.5.6.2 — `/T` (author), `/Subj`, `/RC` (rich
|
|
22
|
+
content), `/CreationDate`, `/IRT` (in-reply-to ref), `/RT` (reply type), `/Popup`
|
|
23
|
+
and `/ExData` — are **not** promoted to named fields: they are neither base keys
|
|
24
|
+
nor subtype keys, so `captureExtras` puts them in `_extras` under their raw PDF
|
|
25
|
+
names.
|
|
26
|
+
|
|
27
|
+
## Resolve
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const markup = runtime.resolve('pdfMarkupAnnot');
|
|
31
|
+
// Returns: { typeMarkupAnnot }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
| Method | Signature | Returns |
|
|
37
|
+
|--------|-----------|---------|
|
|
38
|
+
| `typeMarkupAnnot` | `(dict, expected: string) => MarkupAnnot` | Base record plus `quadPoints`, `it`, and — for `Caret` — `rd` and `sy`. |
|
|
39
|
+
|
|
40
|
+
`expected` ∈ `'Highlight'`, `'Underline'`, `'Squiggly'`, `'StrikeOut'`,
|
|
41
|
+
`'Caret'`. The multiple-of-8 check on `/QuadPoints` is applied to every subtype
|
|
42
|
+
except `Caret`.
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Typed highlight
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const m = runtime.resolve('pdfMarkupAnnot').typeMarkupAnnot(dict, 'Highlight');
|
|
50
|
+
m.quadPoints; // number[8 * n]
|
|
51
|
+
m.it; // /IT intent name or null
|
|
52
|
+
m._extras.T; // /T (author) — typed string object
|
|
53
|
+
m._extras.Popup; // /Popup — typed ref object
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Reply thread
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
m._extras.IRT; // ref to the parent annotation
|
|
60
|
+
m._extras.RT; // 'R' (reply) | 'Group' — typed name object
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Caret specifics
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const c = runtime.resolve('pdfMarkupAnnot').typeMarkupAnnot(dict, 'Caret');
|
|
67
|
+
c.rd; // rectangle differences
|
|
68
|
+
c.sy; // 'P' | 'None' | null
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Errors
|
|
72
|
+
|
|
73
|
+
| Code | Class | When |
|
|
74
|
+
|------|-------|------|
|
|
75
|
+
| `pdf/annot/markup/bad-expected` | `ParseError` | `expected` is not one of the five supported subtypes. |
|
|
76
|
+
| `pdf/annot/markup/bad-subtype` | `ParseError` | `/Subtype` differs from `expected`. |
|
|
77
|
+
| `pdf/annot/markup/bad-quadpoints` | `ParseError` | `/QuadPoints` is not an array of numbers, or its length is not a multiple of 8. |
|
|
78
|
+
| `pdf/annot/markup/bad-rd` | `ParseError` | `/RD` (Caret) is not an array of numbers. |
|
|
79
|
+
|
|
80
|
+
## See also
|
|
81
|
+
|
|
82
|
+
- [`pdfAnnot`](./annot.md)
|
|
83
|
+
- [`pdfPopupAnnot`](./popup.md)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfPopupAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfPopupAnnot
|
|
11
|
+
|
|
12
|
+
> Pop-up annotation — ISO 32000-2 §12.5.6.14.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfPopupAnnot` | **Source** `packages/front/office/pdf/src/annot/popup.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Popup`: the display window attached to a parent annotation (markup,
|
|
17
|
+
sticky note). Subtype-specific entries: `/Parent` (reference to the carrying
|
|
18
|
+
annotation) and `/Open` (initial state). A pop-up is never meaningful alone — it
|
|
19
|
+
relies on its parent for `/Contents`, `/T` and `/M`.
|
|
20
|
+
|
|
21
|
+
## Resolve
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
const popup = runtime.resolve('pdfPopupAnnot');
|
|
25
|
+
// Returns: { typePopupAnnot }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
| Method | Signature | Returns |
|
|
31
|
+
|--------|-----------|---------|
|
|
32
|
+
| `typePopupAnnot` | `(dict) => PopupAnnot` | Base record plus `parent: {num,gen}\|null` and `open: boolean`. |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const p = runtime.resolve('pdfPopupAnnot').typePopupAnnot(dict);
|
|
38
|
+
p.parent; // reference to the parent markup annotation
|
|
39
|
+
p.open; // false by default
|
|
40
|
+
p.rect; // window position (base record)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Errors
|
|
44
|
+
|
|
45
|
+
| Code | Class | When |
|
|
46
|
+
|------|-------|------|
|
|
47
|
+
| `pdf/annot/popup/bad-subtype` | `ParseError` | `/Subtype` present and not `/Popup`. |
|
|
48
|
+
|
|
49
|
+
## See also
|
|
50
|
+
|
|
51
|
+
- [`pdfAnnot`](./annot.md) · [`pdfMarkupAnnot`](./markup.md)
|
|
52
|
+
- [`pdfTextAnnot`](./text.md)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfProjectionAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfProjectionAnnot
|
|
11
|
+
|
|
12
|
+
> Projection annotation (3D view) — ISO 32000-2 §13.6.6.2.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfProjectionAnnot` | **Source** `packages/front/office/pdf/src/annot/projection.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Projection`: an annotation bound to a 3D view. Two subtype-specific
|
|
17
|
+
entries are promoted — `/V` (the 3D view, a dictionary or a referenced view
|
|
18
|
+
name) and `/B` (the 3D state dictionary: background and so on). Everything else,
|
|
19
|
+
including the shared markup entries (`/T`, `/Subj`, `/CreationDate`, …) and 3D
|
|
20
|
+
extras such as `/M3D`, is captured into `_extras` under its raw PDF name.
|
|
21
|
+
|
|
22
|
+
The same source file also carries the legacy Movie/Sound handling (Annex H,
|
|
23
|
+
deprecated in PDF 2.0) for completeness.
|
|
24
|
+
|
|
25
|
+
## Resolve
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const proj = runtime.resolve('pdfProjectionAnnot');
|
|
29
|
+
// Returns: { typeProjectionAnnot }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
| Method | Signature | Returns |
|
|
35
|
+
|--------|-----------|---------|
|
|
36
|
+
| `typeProjectionAnnot` | `(dict) => ProjectionAnnot` | Base record plus `v` (raw typed `/V`) and `b` (`/B` dictionary or `null`), with everything else in `_extras`. |
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
const p = runtime.resolve('pdfProjectionAnnot').typeProjectionAnnot(dict);
|
|
42
|
+
p.v; // /V — 3D view dict or name
|
|
43
|
+
p.b; // /B — 3D state dict or null
|
|
44
|
+
p._extras.T; // /T (author) — typed string object
|
|
45
|
+
p._extras.M3D; // reference to the 3D measurement, when present
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Errors
|
|
49
|
+
|
|
50
|
+
| Code | Class | When |
|
|
51
|
+
|------|-------|------|
|
|
52
|
+
| `pdf/annot/projection/bad-subtype` | `ParseError` | `/Subtype` present and not `/Projection`. |
|
|
53
|
+
|
|
54
|
+
## See also
|
|
55
|
+
|
|
56
|
+
- [`pdfAnnot`](./annot.md) · [`pdfMarkupAnnot`](./markup.md)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfRedactAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfRedactAnnot
|
|
11
|
+
|
|
12
|
+
> Redact annotation (ISO 32000-2 §12.5.6.21) — read-side typing only; applying a redaction (content removal) is not implemented.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfRedactAnnot` | **Source** `packages/front/office/pdf/src/annot/redact.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Redact`: a visual marker for an area to be redacted. Actually applying
|
|
17
|
+
the redaction (removing the underlying content) is *not* performed by this
|
|
18
|
+
module. Subtype-specific entries: `/QuadPoints` (regions, multiples of 8
|
|
19
|
+
floats), `/IC` (interior colour after redaction), `/RO` (override appearance),
|
|
20
|
+
`/OverlayText` (replacement text), `/Repeat` (boolean — repeat the overlay
|
|
21
|
+
pattern), `/DA` and `/Q`.
|
|
22
|
+
|
|
23
|
+
## Resolve
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const redact = runtime.resolve('pdfRedactAnnot');
|
|
27
|
+
// Returns: { typeRedactAnnot }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| Method | Signature | Returns |
|
|
33
|
+
|--------|-----------|---------|
|
|
34
|
+
| `typeRedactAnnot` | `(dict) => RedactAnnot` | Base record plus `quadPoints`, `ic`, `ro`, `overlayText`, `repeat`, `da`, `q`. |
|
|
35
|
+
|
|
36
|
+
`overlayText` and `da` are the raw `Uint8Array` payloads of the PDF strings;
|
|
37
|
+
`q` defaults to `0` and `repeat` to `false`.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Marking
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const r = runtime.resolve('pdfRedactAnnot').typeRedactAnnot(dict);
|
|
45
|
+
r.quadPoints; // regions to redact
|
|
46
|
+
r.overlayText; // Uint8Array — e.g. 'REDACTED'
|
|
47
|
+
r.ic; // [0, 0, 0] = solid black
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Applying
|
|
51
|
+
|
|
52
|
+
Application must happen out of band (content removal, image re-encoding,
|
|
53
|
+
deletion of covered annotations). See
|
|
54
|
+
[`pdfRedactionIso32005`](../extra/redaction-iso32005.md).
|
|
55
|
+
|
|
56
|
+
## Errors
|
|
57
|
+
|
|
58
|
+
| Code | Class | When |
|
|
59
|
+
|------|-------|------|
|
|
60
|
+
| `pdf/annot/redact/bad-subtype` | `ParseError` | `/Subtype` present and not `/Redact`. |
|
|
61
|
+
| `pdf/annot/redact/bad-quadpoints` | `ParseError` | `/QuadPoints` is not an array of numbers, or its length is not a multiple of 8. |
|
|
62
|
+
| `pdf/annot/redact/bad-ic` | `ParseError` | `/IC` is not an array of numbers. |
|
|
63
|
+
|
|
64
|
+
## See also
|
|
65
|
+
|
|
66
|
+
- [`pdfAnnot`](./annot.md) · [`pdfMarkupAnnot`](./markup.md)
|
|
67
|
+
- [`pdfRedactionIso32005`](../extra/redaction-iso32005.md)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfShapeAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfShapeAnnot
|
|
11
|
+
|
|
12
|
+
> Shape annotations — Line/Square/Circle/Polygon/PolyLine — ISO 32000-2 §12.5.6.7–§12.5.6.9.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfShapeAnnot` | **Source** `packages/front/office/pdf/src/annot/square.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Generic typer for the geometric annotations. `/IC` (interior colour) is read for
|
|
17
|
+
every subtype; the remaining entries are gated on `expected`:
|
|
18
|
+
|
|
19
|
+
| `expected` | Fields set |
|
|
20
|
+
|------------|------------|
|
|
21
|
+
| `Square`, `Circle` | `ic`, `rd` (`/RD`) |
|
|
22
|
+
| `Line` | `ic`, `l` (`/L`), `le` (`/LE`), `ll` (`/LL`), `lle` (`/LLE`), `cap` (`/Cap`), `cp` (`/CP`), `it` (`/IT`), `measure` (`/Measure`) |
|
|
23
|
+
| `Polygon`, `PolyLine` | `ic`, `vertices` (`/Vertices`), `le`, `it`, `measure`, `path` (`/Path`) |
|
|
24
|
+
|
|
25
|
+
Every other entry — including `/BE`, handled by the base typer, and the shared
|
|
26
|
+
markup entries `/T`, `/Subj`, `/Popup`, … — is either part of the base record or
|
|
27
|
+
captured into `_extras`.
|
|
28
|
+
|
|
29
|
+
## Resolve
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const shape = runtime.resolve('pdfShapeAnnot');
|
|
33
|
+
// Returns: { typeShapeAnnot }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## API
|
|
37
|
+
|
|
38
|
+
| Method | Signature | Returns |
|
|
39
|
+
|--------|-----------|---------|
|
|
40
|
+
| `typeShapeAnnot` | `(dict, expected: string) => ShapeAnnot` | Base record plus the geometry fields listed above. |
|
|
41
|
+
|
|
42
|
+
`expected` ∈ `'Line'`, `'Square'`, `'Circle'`, `'Polygon'`, `'PolyLine'`.
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Square / Circle
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const s = runtime.resolve('pdfShapeAnnot').typeShapeAnnot(dict, 'Square');
|
|
50
|
+
s.ic; // [r, g, b] interior colour
|
|
51
|
+
s.rd; // rectangle differences
|
|
52
|
+
s.bs; // border style dict (base record)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Line with endings
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
const l = runtime.resolve('pdfShapeAnnot').typeShapeAnnot(dict, 'Line');
|
|
59
|
+
l.l; // [x1, y1, x2, y2]
|
|
60
|
+
l.le; // ['OpenArrow', 'None']
|
|
61
|
+
l.cap; // false unless /Cap true
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Polygon vertices
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
const p = runtime.resolve('pdfShapeAnnot').typeShapeAnnot(dict, 'Polygon');
|
|
68
|
+
p.vertices; // [x0, y0, x1, y1, …]
|
|
69
|
+
p.path; // typed /Path array or null
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Errors
|
|
73
|
+
|
|
74
|
+
| Code | Class | When |
|
|
75
|
+
|------|-------|------|
|
|
76
|
+
| `pdf/annot/shape/bad-expected` | `ParseError` | `expected` outside the allowed set. |
|
|
77
|
+
| `pdf/annot/shape/bad-subtype` | `ParseError` | `/Subtype` differs from `expected`. |
|
|
78
|
+
| `pdf/annot/shape/bad-ic` | `ParseError` | `/IC` is not an array of numbers. |
|
|
79
|
+
| `pdf/annot/shape/bad-rd` | `ParseError` | `/RD` is not an array of numbers. |
|
|
80
|
+
| `pdf/annot/shape/bad-l` | `ParseError` | `/L` is not an array of numbers. |
|
|
81
|
+
| `pdf/annot/shape/bad-le` | `ParseError` | `/LE` is not an array of names. |
|
|
82
|
+
| `pdf/annot/shape/bad-vertices` | `ParseError` | `/Vertices` is not an array of numbers. |
|
|
83
|
+
|
|
84
|
+
## See also
|
|
85
|
+
|
|
86
|
+
- [`pdfAnnot`](./annot.md) — dispatcher.
|
|
87
|
+
- [`pdfMarkupAnnot`](./markup.md) — text-markup subtypes.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
module: pdfStampAnnot
|
|
3
|
+
category: pdf/annot
|
|
4
|
+
dependencies: [pdfErrors, pdfParser, pdfAnnot]
|
|
5
|
+
returns: object
|
|
6
|
+
worker-safe: true
|
|
7
|
+
status: complete
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# pdfStampAnnot
|
|
11
|
+
|
|
12
|
+
> Rubber-stamp annotation — ISO 32000-2 §12.5.6.12.
|
|
13
|
+
|
|
14
|
+
**Module** `pdfStampAnnot` | **Source** `packages/front/office/pdf/src/annot/stamp.js` | **Deps** `pdfErrors`, `pdfParser`, `pdfAnnot` | **Worker-safe** yes
|
|
15
|
+
|
|
16
|
+
Subtype `/Stamp`. The only subtype-specific entry is `/Name` — the icon
|
|
17
|
+
(`Approved`, `Experimental`, `NotApproved`, `AsIs`, `Expired`,
|
|
18
|
+
`NotForPublicRelease`, `Confidential`, `Final`, `Sold`, `Departmental`,
|
|
19
|
+
`ForComment`, `TopSecret`, `Draft`, `ForPublicRelease`). The actual rendering
|
|
20
|
+
lives in `/AP` (base record); `/Name` is only a hint. The shared markup entries
|
|
21
|
+
(`/T`, `/Subj`, `/CreationDate`, `/Popup`, …) are captured into `_extras`.
|
|
22
|
+
|
|
23
|
+
## Resolve
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const stamp = runtime.resolve('pdfStampAnnot');
|
|
27
|
+
// Returns: { typeStampAnnot }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
| Method | Signature | Returns |
|
|
33
|
+
|--------|-----------|---------|
|
|
34
|
+
| `typeStampAnnot` | `(dict) => StampAnnot` | Base record plus `iconName`. |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const s = runtime.resolve('pdfStampAnnot').typeStampAnnot(dict);
|
|
40
|
+
s.iconName; // 'Approved'
|
|
41
|
+
s.ap; // appearance-stream dictionary (base record)
|
|
42
|
+
s._extras.T; // /T (author) — typed string object
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Errors
|
|
46
|
+
|
|
47
|
+
| Code | Class | When |
|
|
48
|
+
|------|-------|------|
|
|
49
|
+
| `pdf/annot/stamp/bad-subtype` | `ParseError` | `/Subtype` present and not `/Stamp`. |
|
|
50
|
+
|
|
51
|
+
## See also
|
|
52
|
+
|
|
53
|
+
- [`pdfAnnot`](./annot.md) · [`pdfMarkupAnnot`](./markup.md)
|
|
54
|
+
- [`pdfAppearance`](../form/appearance.md)
|