@syncfusion/ej2-pdf 1.0.23 → 23.1.38
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/.eslintrc.json +260 -0
- package/.gitleaksignore +1 -0
- package/CHANGELOG.md +28 -0
- package/README.md +17 -0
- package/dist/ej2-pdf.umd.min.js +4 -14
- package/dist/ej2-pdf.umd.min.js.map +1 -11
- package/dist/es6/ej2-pdf.es2015.js +48372 -0
- package/dist/es6/ej2-pdf.es2015.js.map +1 -0
- package/dist/es6/ej2-pdf.es5.js +50250 -0
- package/dist/es6/ej2-pdf.es5.js.map +1 -0
- package/dist/global/ej2-pdf.min.js +11 -0
- package/dist/global/ej2-pdf.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/index.js +4 -8
- package/license +10 -3
- package/package.json +58 -16
- package/pdf.d.ts +4 -0
- package/pdf.js +4 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +45 -98
- package/src/index.js +45 -96
- package/src/pdf/core/annotations/annotation-collection.d.ts +289 -0
- package/src/pdf/core/annotations/annotation-collection.js +755 -0
- package/src/pdf/core/annotations/annotation.d.ts +5865 -0
- package/src/pdf/core/annotations/annotation.js +14195 -0
- package/src/pdf/core/annotations/index.d.ts +4 -0
- package/src/pdf/core/annotations/index.js +4 -0
- package/src/pdf/core/annotations/pdf-appearance.d.ts +102 -0
- package/src/pdf/core/annotations/pdf-appearance.js +124 -0
- package/src/pdf/core/annotations/pdf-paddings.d.ts +8 -0
- package/src/pdf/core/annotations/pdf-paddings.js +22 -0
- package/src/pdf/core/base-stream.d.ts +86 -0
- package/src/pdf/core/base-stream.js +332 -0
- package/src/pdf/core/content-parser.d.ts +38 -0
- package/src/pdf/core/content-parser.js +359 -0
- package/src/pdf/core/decode-stream.d.ts +21 -0
- package/src/pdf/core/decode-stream.js +120 -0
- package/src/pdf/core/decrypt-stream.d.ts +11 -0
- package/src/pdf/core/decrypt-stream.js +53 -0
- package/src/pdf/core/enumerator.d.ts +1668 -0
- package/src/pdf/core/enumerator.js +1717 -0
- package/src/pdf/core/flate-stream.d.ts +13 -0
- package/src/pdf/core/flate-stream.js +329 -0
- package/src/pdf/core/fonts/index.d.ts +7 -0
- package/{dist/es6/implementation/graphics → src/pdf/core}/fonts/index.js +3 -4
- package/src/pdf/core/fonts/pdf-font-metrics.d.ts +66 -0
- package/src/pdf/core/fonts/pdf-font-metrics.js +192 -0
- package/src/pdf/core/fonts/pdf-standard-font.d.ts +1023 -0
- package/src/pdf/core/fonts/pdf-standard-font.js +1682 -0
- package/src/pdf/core/fonts/pdf-string-format.d.ts +236 -0
- package/src/pdf/core/fonts/pdf-string-format.js +213 -0
- package/src/pdf/core/fonts/string-layouter.d.ts +68 -0
- package/src/pdf/core/fonts/string-layouter.js +437 -0
- package/src/pdf/core/fonts/ttf-reader.d.ts +167 -0
- package/src/pdf/core/fonts/ttf-reader.js +1150 -0
- package/src/pdf/core/fonts/ttf-table.d.ts +132 -0
- package/src/pdf/core/fonts/ttf-table.js +74 -0
- package/src/pdf/core/fonts/unicode-true-type-font.d.ts +50 -0
- package/src/pdf/core/fonts/unicode-true-type-font.js +289 -0
- package/src/pdf/core/form/field.d.ts +3011 -0
- package/src/pdf/core/form/field.js +6828 -0
- package/src/pdf/core/form/form.d.ts +279 -0
- package/src/pdf/core/form/form.js +782 -0
- package/src/pdf/core/form/index.d.ts +2 -0
- package/src/pdf/core/form/index.js +2 -0
- package/src/pdf/core/graphics/images/image-decoder.d.ts +38 -0
- package/src/pdf/core/graphics/images/image-decoder.js +227 -0
- package/src/{implementation → pdf/core}/graphics/images/index.d.ts +0 -5
- package/{dist/es6/implementation → src/pdf/core}/graphics/images/index.js +0 -1
- package/src/pdf/core/graphics/images/pdf-bitmap.d.ts +73 -0
- package/src/pdf/core/graphics/images/pdf-bitmap.js +68 -0
- package/src/pdf/core/graphics/images/pdf-image.d.ts +201 -0
- package/src/pdf/core/graphics/images/pdf-image.js +201 -0
- package/src/pdf/core/graphics/index.d.ts +10 -0
- package/src/pdf/core/graphics/index.js +10 -0
- package/src/pdf/core/graphics/pdf-graphics.d.ts +956 -0
- package/src/pdf/core/graphics/pdf-graphics.js +1860 -0
- package/src/pdf/core/graphics/pdf-path.d.ts +34 -0
- package/src/pdf/core/graphics/pdf-path.js +177 -0
- package/src/pdf/core/graphics/pdf-stream-writer.d.ts +56 -0
- package/src/pdf/core/graphics/pdf-stream-writer.js +231 -0
- package/src/pdf/core/graphics/pdf-template.d.ts +79 -0
- package/src/pdf/core/graphics/pdf-template.js +100 -0
- package/src/pdf/core/graphics/rightToLeft/bidirectional.d.ts +69 -0
- package/src/pdf/core/graphics/rightToLeft/bidirectional.js +831 -0
- package/src/pdf/core/graphics/rightToLeft/index.d.ts +3 -0
- package/src/pdf/core/graphics/rightToLeft/index.js +3 -0
- package/src/pdf/core/graphics/rightToLeft/text-renderer.d.ts +13 -0
- package/src/pdf/core/graphics/rightToLeft/text-renderer.js +116 -0
- package/src/pdf/core/graphics/rightToLeft/text-shape.d.ts +48 -0
- package/src/pdf/core/graphics/rightToLeft/text-shape.js +289 -0
- package/src/pdf/core/import-export/fdf-document.d.ts +37 -0
- package/src/pdf/core/import-export/fdf-document.js +667 -0
- package/src/pdf/core/import-export/index.d.ts +5 -0
- package/src/pdf/core/import-export/index.js +5 -0
- package/src/pdf/core/import-export/json-document.d.ts +47 -0
- package/src/pdf/core/import-export/json-document.js +1547 -0
- package/src/pdf/core/import-export/xfdf-document.d.ts +146 -0
- package/src/pdf/core/import-export/xfdf-document.js +2920 -0
- package/src/pdf/core/import-export/xml-document.d.ts +14 -0
- package/src/pdf/core/import-export/xml-document.js +166 -0
- package/src/pdf/core/import-export/xml-writer.d.ts +69 -0
- package/src/pdf/core/import-export/xml-writer.js +494 -0
- package/src/pdf/core/pdf-catalog.d.ts +18 -0
- package/src/pdf/core/pdf-catalog.js +166 -0
- package/src/pdf/core/pdf-cross-reference.d.ts +80 -0
- package/src/pdf/core/pdf-cross-reference.js +1049 -0
- package/src/pdf/core/pdf-document.d.ts +821 -0
- package/src/pdf/core/pdf-document.js +1022 -0
- package/src/pdf/core/pdf-file-structure.d.ts +54 -0
- package/src/pdf/core/pdf-file-structure.js +65 -0
- package/src/pdf/core/pdf-outline.d.ts +362 -0
- package/src/pdf/core/pdf-outline.js +860 -0
- package/src/pdf/core/pdf-page.d.ts +589 -0
- package/src/pdf/core/pdf-page.js +1049 -0
- package/src/pdf/core/pdf-parser.d.ts +62 -0
- package/src/pdf/core/pdf-parser.js +1035 -0
- package/src/pdf/core/pdf-primitives.d.ts +87 -0
- package/src/pdf/core/pdf-primitives.js +305 -0
- package/src/pdf/core/predictor-stream.d.ts +15 -0
- package/src/pdf/core/predictor-stream.js +214 -0
- package/src/pdf/core/security/encryptor.d.ts +140 -0
- package/src/pdf/core/security/encryptor.js +1616 -0
- package/src/pdf/core/security/index.d.ts +1 -0
- package/src/pdf/core/security/index.js +1 -0
- package/src/pdf/core/utils.d.ts +686 -0
- package/src/pdf/core/utils.js +3625 -0
- package/src/pdf/index.d.ts +44 -0
- package/src/pdf/index.js +44 -0
- package/tslint.json +111 -0
- package/ReadMe.md +0 -13
- package/dist/es6/implementation/actions/action.js +0 -44
- package/dist/es6/implementation/actions/index.js +0 -2
- package/dist/es6/implementation/actions/uri-action.js +0 -38
- package/dist/es6/implementation/annotations/action-link-annotation.js +0 -29
- package/dist/es6/implementation/annotations/annotation-collection.js +0 -93
- package/dist/es6/implementation/annotations/annotation.js +0 -156
- package/dist/es6/implementation/annotations/document-link-annotation.js +0 -48
- package/dist/es6/implementation/annotations/index.js +0 -7
- package/dist/es6/implementation/annotations/link-annotation.js +0 -31
- package/dist/es6/implementation/annotations/pdf-text-web-link.js +0 -178
- package/dist/es6/implementation/annotations/uri-annotation.js +0 -64
- package/dist/es6/implementation/collections/dictionary.js +0 -71
- package/dist/es6/implementation/collections/index.js +0 -3
- package/dist/es6/implementation/collections/object-object-pair/dictionary.js +0 -84
- package/dist/es6/implementation/collections/object-object-pair/index.js +0 -1
- package/dist/es6/implementation/collections/utils.js +0 -8
- package/dist/es6/implementation/document/automatic-fields/automatic-field-info-collection.js +0 -17
- package/dist/es6/implementation/document/automatic-fields/automatic-field-info.js +0 -68
- package/dist/es6/implementation/document/automatic-fields/automatic-field.js +0 -145
- package/dist/es6/implementation/document/automatic-fields/composite-field.js +0 -61
- package/dist/es6/implementation/document/automatic-fields/index.js +0 -7
- package/dist/es6/implementation/document/automatic-fields/multiple-value-field.js +0 -36
- package/dist/es6/implementation/document/automatic-fields/page-count-field.js +0 -53
- package/dist/es6/implementation/document/automatic-fields/pdf-numbers-convertor.js +0 -91
- package/dist/es6/implementation/document/automatic-fields/pdf-page-number-field.js +0 -56
- package/dist/es6/implementation/document/automatic-fields/pdf-template-value-pair.js +0 -34
- package/dist/es6/implementation/document/automatic-fields/single-value-field.js +0 -47
- package/dist/es6/implementation/document/index.js +0 -11
- package/dist/es6/implementation/document/pdf-catalog.js +0 -38
- package/dist/es6/implementation/document/pdf-document-base.js +0 -71
- package/dist/es6/implementation/document/pdf-document-template.js +0 -204
- package/dist/es6/implementation/document/pdf-document.js +0 -175
- package/dist/es6/implementation/drawing/index.js +0 -1
- package/dist/es6/implementation/drawing/pdf-drawing.js +0 -80
- package/dist/es6/implementation/general/enum.js +0 -6
- package/dist/es6/implementation/general/index.js +0 -3
- package/dist/es6/implementation/general/pdf-cache-collection.js +0 -24
- package/dist/es6/implementation/general/pdf-collection.js +0 -26
- package/dist/es6/implementation/general/pdf-destination.js +0 -107
- package/dist/es6/implementation/graphics/brushes/index.js +0 -2
- package/dist/es6/implementation/graphics/brushes/pdf-brush.js +0 -6
- package/dist/es6/implementation/graphics/brushes/pdf-solid-brush.js +0 -53
- package/dist/es6/implementation/graphics/constants.js +0 -11
- package/dist/es6/implementation/graphics/enum.js +0 -100
- package/dist/es6/implementation/graphics/figures/base/element-layouter.js +0 -154
- package/dist/es6/implementation/graphics/figures/base/graphics-element.js +0 -18
- package/dist/es6/implementation/graphics/figures/base/index.js +0 -3
- package/dist/es6/implementation/graphics/figures/base/pdf-shape-element.js +0 -32
- package/dist/es6/implementation/graphics/figures/base/shape-layouter.js +0 -55
- package/dist/es6/implementation/graphics/figures/base/text-layouter.js +0 -123
- package/dist/es6/implementation/graphics/figures/enum.js +0 -11
- package/dist/es6/implementation/graphics/figures/index.js +0 -5
- package/dist/es6/implementation/graphics/figures/layout-element.js +0 -41
- package/dist/es6/implementation/graphics/figures/pdf-template.js +0 -110
- package/dist/es6/implementation/graphics/figures/text-element.js +0 -298
- package/dist/es6/implementation/graphics/fonts/enum.js +0 -45
- package/dist/es6/implementation/graphics/fonts/pdf-font-metrics.js +0 -122
- package/dist/es6/implementation/graphics/fonts/pdf-font.js +0 -159
- package/dist/es6/implementation/graphics/fonts/pdf-standard-font-metrics-factory.js +0 -357
- package/dist/es6/implementation/graphics/fonts/pdf-standard-font.js +0 -124
- package/dist/es6/implementation/graphics/fonts/pdf-string-format.js +0 -239
- package/dist/es6/implementation/graphics/fonts/string-layouter.js +0 -335
- package/dist/es6/implementation/graphics/fonts/string-tokenizer.js +0 -162
- package/dist/es6/implementation/graphics/images/byte-array.js +0 -82
- package/dist/es6/implementation/graphics/images/image-decoder.js +0 -167
- package/dist/es6/implementation/graphics/images/pdf-bitmap.js +0 -41
- package/dist/es6/implementation/graphics/images/pdf-image.js +0 -68
- package/dist/es6/implementation/graphics/index.js +0 -20
- package/dist/es6/implementation/graphics/pdf-color.js +0 -205
- package/dist/es6/implementation/graphics/pdf-graphics.js +0 -1034
- package/dist/es6/implementation/graphics/pdf-margins.js +0 -75
- package/dist/es6/implementation/graphics/pdf-pen.js +0 -180
- package/dist/es6/implementation/graphics/pdf-resources.js +0 -223
- package/dist/es6/implementation/graphics/pdf-transformation-matrix.js +0 -134
- package/dist/es6/implementation/graphics/pdf-transparency.js +0 -22
- package/dist/es6/implementation/graphics/unit-convertor.js +0 -33
- package/dist/es6/implementation/index.js +0 -85
- package/dist/es6/implementation/input-output/cross-table.js +0 -6
- package/dist/es6/implementation/input-output/enum.js +0 -5
- package/dist/es6/implementation/input-output/index.js +0 -8
- package/dist/es6/implementation/input-output/pdf-cross-table.js +0 -346
- package/dist/es6/implementation/input-output/pdf-dictionary-properties.js +0 -60
- package/dist/es6/implementation/input-output/pdf-main-object-collection.js +0 -115
- package/dist/es6/implementation/input-output/pdf-operators.js +0 -75
- package/dist/es6/implementation/input-output/pdf-stream-writer.js +0 -364
- package/dist/es6/implementation/input-output/pdf-writer.js +0 -44
- package/dist/es6/implementation/pages/enum.js +0 -51
- package/dist/es6/implementation/pages/index.js +0 -13
- package/dist/es6/implementation/pages/page-added-event-arguments.js +0 -19
- package/dist/es6/implementation/pages/pdf-document-page-collection.js +0 -120
- package/dist/es6/implementation/pages/pdf-page-base.js +0 -104
- package/dist/es6/implementation/pages/pdf-page-layer-collection.js +0 -115
- package/dist/es6/implementation/pages/pdf-page-layer.js +0 -160
- package/dist/es6/implementation/pages/pdf-page-settings.js +0 -126
- package/dist/es6/implementation/pages/pdf-page-size.js +0 -36
- package/dist/es6/implementation/pages/pdf-page-template-element.js +0 -510
- package/dist/es6/implementation/pages/pdf-page.js +0 -130
- package/dist/es6/implementation/pages/pdf-section-collection.js +0 -95
- package/dist/es6/implementation/pages/pdf-section-page-collection.js +0 -30
- package/dist/es6/implementation/pages/pdf-section-templates.js +0 -71
- package/dist/es6/implementation/pages/pdf-section.js +0 -388
- package/dist/es6/implementation/primitives/index.js +0 -8
- package/dist/es6/implementation/primitives/pdf-array.js +0 -199
- package/dist/es6/implementation/primitives/pdf-boolean.js +0 -66
- package/dist/es6/implementation/primitives/pdf-dictionary.js +0 -220
- package/dist/es6/implementation/primitives/pdf-name.js +0 -102
- package/dist/es6/implementation/primitives/pdf-number.js +0 -94
- package/dist/es6/implementation/primitives/pdf-reference.js +0 -195
- package/dist/es6/implementation/primitives/pdf-stream.js +0 -149
- package/dist/es6/implementation/primitives/pdf-string.js +0 -143
- package/dist/es6/implementation/structured-elements/grid/index.js +0 -1
- package/dist/es6/implementation/structured-elements/grid/pdf-grid-cell.js +0 -512
- package/dist/es6/implementation/structured-elements/grid/pdf-grid-column.js +0 -125
- package/dist/es6/implementation/structured-elements/grid/pdf-grid-row.js +0 -244
- package/dist/es6/implementation/structured-elements/grid/pdf-grid.js +0 -989
- package/dist/es6/implementation/structured-elements/grid/styles/index.js +0 -2
- package/dist/es6/implementation/structured-elements/grid/styles/pdf-borders.js +0 -145
- package/dist/es6/implementation/structured-elements/grid/styles/style.js +0 -267
- package/dist/es6/implementation/structured-elements/index.js +0 -1
- package/dist/es6/implementation/structured-elements/tables/light-tables/enum.js +0 -5
- package/dist/es6/index.js +0 -89
- package/dist/es6/interfaces/i-pdf-cache.js +0 -1
- package/dist/es6/interfaces/i-pdf-changable.js +0 -1
- package/dist/es6/interfaces/i-pdf-primitives.js +0 -1
- package/dist/es6/interfaces/i-pdf-wrapper.js +0 -1
- package/dist/es6/interfaces/i-pdf-writer.js +0 -1
- package/dist/es6/interfaces/index.js +0 -1
- package/dist/global/ej2-pdf-export.js +0 -15979
- package/implementation.d.ts +0 -4
- package/implementation.js +0 -8
- package/interfaces.d.ts +0 -4
- package/interfaces.js +0 -4
- package/src/implementation/actions/action.d.ts +0 -50
- package/src/implementation/actions/action.js +0 -44
- package/src/implementation/actions/index.d.ts +0 -6
- package/src/implementation/actions/index.js +0 -9
- package/src/implementation/actions/uri-action.d.ts +0 -33
- package/src/implementation/actions/uri-action.js +0 -39
- package/src/implementation/annotations/action-link-annotation.d.ts +0 -30
- package/src/implementation/annotations/action-link-annotation.js +0 -32
- package/src/implementation/annotations/annotation-collection.d.ts +0 -77
- package/src/implementation/annotations/annotation-collection.js +0 -91
- package/src/implementation/annotations/annotation.d.ts +0 -152
- package/src/implementation/annotations/annotation.js +0 -146
- package/src/implementation/annotations/document-link-annotation.d.ts +0 -89
- package/src/implementation/annotations/document-link-annotation.js +0 -51
- package/src/implementation/annotations/index.d.ts +0 -11
- package/src/implementation/annotations/index.js +0 -14
- package/src/implementation/annotations/link-annotation.d.ts +0 -23
- package/src/implementation/annotations/link-annotation.js +0 -33
- package/src/implementation/annotations/pdf-text-web-link.d.ts +0 -118
- package/src/implementation/annotations/pdf-text-web-link.js +0 -173
- package/src/implementation/annotations/uri-annotation.d.ts +0 -48
- package/src/implementation/annotations/uri-annotation.js +0 -65
- package/src/implementation/collections/dictionary.d.ts +0 -76
- package/src/implementation/collections/dictionary.js +0 -74
- package/src/implementation/collections/index.d.ts +0 -7
- package/src/implementation/collections/index.js +0 -10
- package/src/implementation/collections/object-object-pair/dictionary.d.ts +0 -62
- package/src/implementation/collections/object-object-pair/dictionary.js +0 -88
- package/src/implementation/collections/object-object-pair/index.d.ts +0 -5
- package/src/implementation/collections/object-object-pair/index.js +0 -8
- package/src/implementation/collections/utils.d.ts +0 -27
- package/src/implementation/collections/utils.js +0 -13
- package/src/implementation/document/automatic-fields/automatic-field-info-collection.d.ts +0 -31
- package/src/implementation/document/automatic-fields/automatic-field-info-collection.js +0 -21
- package/src/implementation/document/automatic-fields/automatic-field-info.d.ts +0 -67
- package/src/implementation/document/automatic-fields/automatic-field-info.js +0 -70
- package/src/implementation/document/automatic-fields/automatic-field.d.ts +0 -41
- package/src/implementation/document/automatic-fields/automatic-field.js +0 -143
- package/src/implementation/document/automatic-fields/composite-field.d.ts +0 -46
- package/src/implementation/document/automatic-fields/composite-field.js +0 -64
- package/src/implementation/document/automatic-fields/index.d.ts +0 -11
- package/src/implementation/document/automatic-fields/index.js +0 -14
- package/src/implementation/document/automatic-fields/multiple-value-field.d.ts +0 -18
- package/src/implementation/document/automatic-fields/multiple-value-field.js +0 -35
- package/src/implementation/document/automatic-fields/page-count-field.d.ts +0 -44
- package/src/implementation/document/automatic-fields/page-count-field.js +0 -53
- package/src/implementation/document/automatic-fields/pdf-numbers-convertor.d.ts +0 -53
- package/src/implementation/document/automatic-fields/pdf-numbers-convertor.js +0 -94
- package/src/implementation/document/automatic-fields/pdf-page-number-field.d.ts +0 -51
- package/src/implementation/document/automatic-fields/pdf-page-number-field.js +0 -56
- package/src/implementation/document/automatic-fields/pdf-template-value-pair.d.ts +0 -38
- package/src/implementation/document/automatic-fields/pdf-template-value-pair.js +0 -38
- package/src/implementation/document/automatic-fields/single-value-field.d.ts +0 -15
- package/src/implementation/document/automatic-fields/single-value-field.js +0 -46
- package/src/implementation/document/index.d.ts +0 -15
- package/src/implementation/document/index.js +0 -18
- package/src/implementation/document/pdf-catalog.d.ts +0 -32
- package/src/implementation/document/pdf-catalog.js +0 -38
- package/src/implementation/document/pdf-document-base.d.ts +0 -117
- package/src/implementation/document/pdf-document-base.js +0 -72
- package/src/implementation/document/pdf-document-template.d.ts +0 -166
- package/src/implementation/document/pdf-document-template.js +0 -207
- package/src/implementation/document/pdf-document.d.ts +0 -206
- package/src/implementation/document/pdf-document.js +0 -166
- package/src/implementation/drawing/index.d.ts +0 -5
- package/src/implementation/drawing/index.js +0 -8
- package/src/implementation/drawing/pdf-drawing.d.ts +0 -93
- package/src/implementation/drawing/pdf-drawing.js +0 -84
- package/src/implementation/general/enum.d.ts +0 -21
- package/src/implementation/general/enum.js +0 -10
- package/src/implementation/general/index.d.ts +0 -7
- package/src/implementation/general/index.js +0 -10
- package/src/implementation/general/pdf-cache-collection.d.ts +0 -33
- package/src/implementation/general/pdf-cache-collection.js +0 -27
- package/src/implementation/general/pdf-collection.d.ts +0 -26
- package/src/implementation/general/pdf-collection.js +0 -30
- package/src/implementation/general/pdf-destination.d.ts +0 -103
- package/src/implementation/general/pdf-destination.js +0 -103
- package/src/implementation/graphics/brushes/index.d.ts +0 -6
- package/src/implementation/graphics/brushes/index.js +0 -9
- package/src/implementation/graphics/brushes/pdf-brush.d.ts +0 -55
- package/src/implementation/graphics/brushes/pdf-brush.js +0 -10
- package/src/implementation/graphics/brushes/pdf-solid-brush.d.ts +0 -77
- package/src/implementation/graphics/brushes/pdf-solid-brush.js +0 -54
- package/src/implementation/graphics/constants.d.ts +0 -31
- package/src/implementation/graphics/constants.js +0 -15
- package/src/implementation/graphics/enum.d.ts +0 -392
- package/src/implementation/graphics/enum.js +0 -104
- package/src/implementation/graphics/figures/base/element-layouter.d.ts +0 -160
- package/src/implementation/graphics/figures/base/element-layouter.js +0 -156
- package/src/implementation/graphics/figures/base/graphics-element.d.ts +0 -16
- package/src/implementation/graphics/figures/base/graphics-element.js +0 -22
- package/src/implementation/graphics/figures/base/index.d.ts +0 -7
- package/src/implementation/graphics/figures/base/index.js +0 -10
- package/src/implementation/graphics/figures/base/pdf-shape-element.d.ts +0 -28
- package/src/implementation/graphics/figures/base/pdf-shape-element.js +0 -34
- package/src/implementation/graphics/figures/base/shape-layouter.d.ts +0 -80
- package/src/implementation/graphics/figures/base/shape-layouter.js +0 -57
- package/src/implementation/graphics/figures/base/text-layouter.d.ts +0 -107
- package/src/implementation/graphics/figures/base/text-layouter.js +0 -121
- package/src/implementation/graphics/figures/enum.d.ts +0 -37
- package/src/implementation/graphics/figures/enum.js +0 -15
- package/src/implementation/graphics/figures/index.d.ts +0 -9
- package/src/implementation/graphics/figures/index.js +0 -12
- package/src/implementation/graphics/figures/layout-element.d.ts +0 -57
- package/src/implementation/graphics/figures/layout-element.js +0 -43
- package/src/implementation/graphics/figures/pdf-template.d.ts +0 -113
- package/src/implementation/graphics/figures/pdf-template.js +0 -106
- package/src/implementation/graphics/figures/text-element.d.ts +0 -213
- package/src/implementation/graphics/figures/text-element.js +0 -289
- package/src/implementation/graphics/fonts/enum.d.ts +0 -179
- package/src/implementation/graphics/fonts/enum.js +0 -49
- package/src/implementation/graphics/fonts/index.d.ts +0 -12
- package/src/implementation/graphics/fonts/index.js +0 -15
- package/src/implementation/graphics/fonts/pdf-font-metrics.d.ts +0 -160
- package/src/implementation/graphics/fonts/pdf-font-metrics.js +0 -123
- package/src/implementation/graphics/fonts/pdf-font.d.ts +0 -187
- package/src/implementation/graphics/fonts/pdf-font.js +0 -158
- package/src/implementation/graphics/fonts/pdf-standard-font-metrics-factory.d.ts +0 -301
- package/src/implementation/graphics/fonts/pdf-standard-font-metrics-factory.js +0 -359
- package/src/implementation/graphics/fonts/pdf-standard-font.d.ts +0 -143
- package/src/implementation/graphics/fonts/pdf-standard-font.js +0 -121
- package/src/implementation/graphics/fonts/pdf-string-format.d.ts +0 -319
- package/src/implementation/graphics/fonts/pdf-string-format.js +0 -241
- package/src/implementation/graphics/fonts/string-layouter.d.ts +0 -255
- package/src/implementation/graphics/fonts/string-layouter.js +0 -336
- package/src/implementation/graphics/fonts/string-tokenizer.d.ts +0 -107
- package/src/implementation/graphics/fonts/string-tokenizer.js +0 -166
- package/src/implementation/graphics/images/byte-array.d.ts +0 -68
- package/src/implementation/graphics/images/byte-array.js +0 -86
- package/src/implementation/graphics/images/image-decoder.d.ts +0 -227
- package/src/implementation/graphics/images/image-decoder.js +0 -164
- package/src/implementation/graphics/images/index.js +0 -11
- package/src/implementation/graphics/images/pdf-bitmap.d.ts +0 -90
- package/src/implementation/graphics/images/pdf-bitmap.js +0 -41
- package/src/implementation/graphics/images/pdf-image.d.ts +0 -88
- package/src/implementation/graphics/images/pdf-image.js +0 -69
- package/src/implementation/graphics/index.d.ts +0 -24
- package/src/implementation/graphics/index.js +0 -27
- package/src/implementation/graphics/pdf-color.d.ts +0 -170
- package/src/implementation/graphics/pdf-color.js +0 -204
- package/src/implementation/graphics/pdf-graphics.d.ts +0 -1085
- package/src/implementation/graphics/pdf-graphics.js +0 -1017
- package/src/implementation/graphics/pdf-margins.d.ts +0 -82
- package/src/implementation/graphics/pdf-margins.js +0 -79
- package/src/implementation/graphics/pdf-pen.d.ts +0 -237
- package/src/implementation/graphics/pdf-pen.js +0 -181
- package/src/implementation/graphics/pdf-resources.d.ts +0 -147
- package/src/implementation/graphics/pdf-resources.js +0 -215
- package/src/implementation/graphics/pdf-transformation-matrix.d.ts +0 -143
- package/src/implementation/graphics/pdf-transformation-matrix.js +0 -136
- package/src/implementation/graphics/pdf-transparency.d.ts +0 -34
- package/src/implementation/graphics/pdf-transparency.js +0 -22
- package/src/implementation/graphics/unit-convertor.d.ts +0 -72
- package/src/implementation/graphics/unit-convertor.js +0 -37
- package/src/implementation/index.d.ts +0 -89
- package/src/implementation/index.js +0 -92
- package/src/implementation/input-output/cross-table.d.ts +0 -21
- package/src/implementation/input-output/cross-table.js +0 -10
- package/src/implementation/input-output/enum.d.ts +0 -16
- package/src/implementation/input-output/enum.js +0 -9
- package/src/implementation/input-output/index.d.ts +0 -12
- package/src/implementation/input-output/index.js +0 -15
- package/src/implementation/input-output/pdf-cross-table.d.ts +0 -249
- package/src/implementation/input-output/pdf-cross-table.js +0 -340
- package/src/implementation/input-output/pdf-dictionary-properties.d.ts +0 -283
- package/src/implementation/input-output/pdf-dictionary-properties.js +0 -64
- package/src/implementation/input-output/pdf-main-object-collection.d.ts +0 -120
- package/src/implementation/input-output/pdf-main-object-collection.js +0 -117
- package/src/implementation/input-output/pdf-operators.d.ts +0 -352
- package/src/implementation/input-output/pdf-operators.js +0 -79
- package/src/implementation/input-output/pdf-stream-writer.d.ts +0 -314
- package/src/implementation/input-output/pdf-stream-writer.js +0 -363
- package/src/implementation/input-output/pdf-writer.d.ts +0 -68
- package/src/implementation/input-output/pdf-writer.js +0 -48
- package/src/implementation/pages/enum.d.ts +0 -201
- package/src/implementation/pages/enum.js +0 -55
- package/src/implementation/pages/index.d.ts +0 -17
- package/src/implementation/pages/index.js +0 -20
- package/src/implementation/pages/page-added-event-arguments.d.ts +0 -30
- package/src/implementation/pages/page-added-event-arguments.js +0 -23
- package/src/implementation/pages/pdf-document-page-collection.d.ts +0 -92
- package/src/implementation/pages/pdf-document-page-collection.js +0 -121
- package/src/implementation/pages/pdf-page-base.d.ts +0 -121
- package/src/implementation/pages/pdf-page-base.js +0 -104
- package/src/implementation/pages/pdf-page-layer-collection.d.ts +0 -99
- package/src/implementation/pages/pdf-page-layer-collection.js +0 -113
- package/src/implementation/pages/pdf-page-layer.d.ts +0 -160
- package/src/implementation/pages/pdf-page-layer.js +0 -159
- package/src/implementation/pages/pdf-page-settings.d.ts +0 -111
- package/src/implementation/pages/pdf-page-settings.js +0 -126
- package/src/implementation/pages/pdf-page-size.d.ts +0 -159
- package/src/implementation/pages/pdf-page-size.js +0 -39
- package/src/implementation/pages/pdf-page-template-element.d.ts +0 -230
- package/src/implementation/pages/pdf-page-template-element.js +0 -509
- package/src/implementation/pages/pdf-page.d.ts +0 -153
- package/src/implementation/pages/pdf-page.js +0 -127
- package/src/implementation/pages/pdf-section-collection.d.ts +0 -109
- package/src/implementation/pages/pdf-section-collection.js +0 -91
- package/src/implementation/pages/pdf-section-page-collection.d.ts +0 -41
- package/src/implementation/pages/pdf-section-page-collection.js +0 -34
- package/src/implementation/pages/pdf-section-templates.d.ts +0 -64
- package/src/implementation/pages/pdf-section-templates.js +0 -74
- package/src/implementation/pages/pdf-section.d.ts +0 -319
- package/src/implementation/pages/pdf-section.js +0 -379
- package/src/implementation/primitives/index.d.ts +0 -12
- package/src/implementation/primitives/index.js +0 -15
- package/src/implementation/primitives/pdf-array.d.ts +0 -186
- package/src/implementation/primitives/pdf-array.js +0 -201
- package/src/implementation/primitives/pdf-boolean.d.ts +0 -84
- package/src/implementation/primitives/pdf-boolean.js +0 -70
- package/src/implementation/primitives/pdf-dictionary.d.ts +0 -311
- package/src/implementation/primitives/pdf-dictionary.js +0 -220
- package/src/implementation/primitives/pdf-name.d.ts +0 -121
- package/src/implementation/primitives/pdf-name.js +0 -106
- package/src/implementation/primitives/pdf-number.d.ts +0 -104
- package/src/implementation/primitives/pdf-number.js +0 -98
- package/src/implementation/primitives/pdf-reference.d.ts +0 -222
- package/src/implementation/primitives/pdf-reference.js +0 -192
- package/src/implementation/primitives/pdf-stream.d.ts +0 -111
- package/src/implementation/primitives/pdf-stream.js +0 -146
- package/src/implementation/primitives/pdf-string.d.ts +0 -212
- package/src/implementation/primitives/pdf-string.js +0 -147
- package/src/implementation/structured-elements/grid/index.d.ts +0 -0
- package/src/implementation/structured-elements/grid/index.js +0 -1
- package/src/implementation/structured-elements/grid/pdf-grid-cell.d.ts +0 -248
- package/src/implementation/structured-elements/grid/pdf-grid-cell.js +0 -504
- package/src/implementation/structured-elements/grid/pdf-grid-column.d.ts +0 -108
- package/src/implementation/structured-elements/grid/pdf-grid-column.js +0 -127
- package/src/implementation/structured-elements/grid/pdf-grid-row.d.ts +0 -207
- package/src/implementation/structured-elements/grid/pdf-grid-row.js +0 -246
- package/src/implementation/structured-elements/grid/pdf-grid.d.ts +0 -678
- package/src/implementation/structured-elements/grid/pdf-grid.js +0 -982
- package/src/implementation/structured-elements/grid/styles/index.d.ts +0 -5
- package/src/implementation/structured-elements/grid/styles/index.js +0 -9
- package/src/implementation/structured-elements/grid/styles/pdf-borders.d.ts +0 -126
- package/src/implementation/structured-elements/grid/styles/pdf-borders.js +0 -146
- package/src/implementation/structured-elements/grid/styles/style.d.ts +0 -250
- package/src/implementation/structured-elements/grid/styles/style.js +0 -269
- package/src/implementation/structured-elements/index.d.ts +0 -0
- package/src/implementation/structured-elements/index.js +0 -1
- package/src/implementation/structured-elements/tables/light-tables/enum.d.ts +0 -16
- package/src/implementation/structured-elements/tables/light-tables/enum.js +0 -9
- package/src/interfaces/i-pdf-cache.d.ts +0 -23
- package/src/interfaces/i-pdf-cache.js +0 -4
- package/src/interfaces/i-pdf-changable.d.ts +0 -17
- package/src/interfaces/i-pdf-changable.js +0 -4
- package/src/interfaces/i-pdf-primitives.d.ts +0 -45
- package/src/interfaces/i-pdf-primitives.js +0 -4
- package/src/interfaces/i-pdf-wrapper.d.ts +0 -13
- package/src/interfaces/i-pdf-wrapper.js +0 -4
- package/src/interfaces/i-pdf-writer.d.ts +0 -29
- package/src/interfaces/i-pdf-writer.js +0 -4
- package/src/interfaces/index.d.ts +0 -9
- package/src/interfaces/index.js +0 -4
|
@@ -0,0 +1,3011 @@
|
|
|
1
|
+
import { _PdfDictionary, _PdfReference } from './../pdf-primitives';
|
|
2
|
+
import { _PdfCrossReference } from './../pdf-cross-reference';
|
|
3
|
+
import { PdfForm } from './form';
|
|
4
|
+
import { PdfRadioButtonListItem, PdfStateItem, PdfWidgetAnnotation, PdfListFieldItem, _PaintParameter, PdfInteractiveBorder } from './../annotations/annotation';
|
|
5
|
+
import { _PdfCheckFieldState, PdfFormFieldVisibility, _FieldFlag, PdfTextAlignment, PdfHighlightMode, PdfBorderStyle, PdfRotationAngle } from './../enumerator';
|
|
6
|
+
import { PdfPage } from './../pdf-page';
|
|
7
|
+
import { PdfTemplate } from './../graphics/pdf-template';
|
|
8
|
+
import { PdfStringFormat } from './../fonts/pdf-string-format';
|
|
9
|
+
import { PdfGraphics, _PdfTransformationMatrix, PdfBrush, PdfPen } from './../graphics/pdf-graphics';
|
|
10
|
+
import { PdfFontFamily, PdfStandardFont, PdfFont } from './../fonts/pdf-standard-font';
|
|
11
|
+
import { PdfAppearance } from './../annotations/pdf-appearance';
|
|
12
|
+
/**
|
|
13
|
+
* `PdfField` class represents the base class for form field objects.
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Load an existing PDF document
|
|
16
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
17
|
+
* // Access the form field at index 0
|
|
18
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
19
|
+
* // Gets the count of the loaded field items
|
|
20
|
+
* let count: number = field.itemsCount;
|
|
21
|
+
* // Save the document
|
|
22
|
+
* document.save('output.pdf');
|
|
23
|
+
* // Destroy the document
|
|
24
|
+
* document.destroy();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class PdfField {
|
|
28
|
+
_ref: _PdfReference;
|
|
29
|
+
_dictionary: _PdfDictionary;
|
|
30
|
+
_crossReference: _PdfCrossReference;
|
|
31
|
+
_form: PdfForm;
|
|
32
|
+
_kids: _PdfReference[];
|
|
33
|
+
_defaultIndex: number;
|
|
34
|
+
_parsedItems: Map<number, PdfWidgetAnnotation>;
|
|
35
|
+
_name: string;
|
|
36
|
+
_actualName: string;
|
|
37
|
+
_mappingName: string;
|
|
38
|
+
_alternateName: string;
|
|
39
|
+
_maxLength: number;
|
|
40
|
+
_visibility: PdfFormFieldVisibility;
|
|
41
|
+
_visible: boolean;
|
|
42
|
+
_page: PdfPage;
|
|
43
|
+
_da: _PdfDefaultAppearance;
|
|
44
|
+
_flags: _FieldFlag;
|
|
45
|
+
_isLoaded: boolean;
|
|
46
|
+
_setAppearance: boolean;
|
|
47
|
+
_stringFormat: PdfStringFormat;
|
|
48
|
+
_font: PdfFont;
|
|
49
|
+
_fontName: string;
|
|
50
|
+
_gray: PdfBrush;
|
|
51
|
+
_silver: PdfBrush;
|
|
52
|
+
_white: PdfBrush;
|
|
53
|
+
_black: PdfBrush;
|
|
54
|
+
_backColorSet: boolean;
|
|
55
|
+
_tabIndex: number;
|
|
56
|
+
_annotationIndex: number;
|
|
57
|
+
_defaultFont: PdfStandardFont;
|
|
58
|
+
_appearanceFont: PdfStandardFont;
|
|
59
|
+
_defaultItemFont: PdfStandardFont;
|
|
60
|
+
_flatten: boolean;
|
|
61
|
+
_hasData: boolean;
|
|
62
|
+
_circleCaptionFont: PdfStandardFont;
|
|
63
|
+
_textAlignment: PdfTextAlignment;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the count of the loaded field items (Read only).
|
|
66
|
+
*
|
|
67
|
+
* @returns {number} Items count.
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // Load an existing PDF document
|
|
70
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
71
|
+
* // Access the form field at index 0
|
|
72
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
73
|
+
* // Gets the count of the loaded field items
|
|
74
|
+
* let count: number = field.itemsCount;
|
|
75
|
+
* // Save the document
|
|
76
|
+
* document.save('output.pdf');
|
|
77
|
+
* // Destroy the document
|
|
78
|
+
* document.destroy();
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
readonly itemsCount: number;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the form object of the field (Read only).
|
|
84
|
+
*
|
|
85
|
+
* @returns {PdfForm} Form.
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Load an existing PDF document
|
|
88
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
89
|
+
* // Access the form field at index 0
|
|
90
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
91
|
+
* // Gets the form object of the field
|
|
92
|
+
* let form: PdfForm = field.form;
|
|
93
|
+
* // Save the document
|
|
94
|
+
* document.save('output.pdf');
|
|
95
|
+
* // Destroy the document
|
|
96
|
+
* document.destroy();
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
readonly form: PdfForm;
|
|
100
|
+
/**
|
|
101
|
+
* Gets the name of the field (Read only).
|
|
102
|
+
*
|
|
103
|
+
* @returns {string} Field name.
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Load an existing PDF document
|
|
106
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
107
|
+
* // Access the form field at index 0
|
|
108
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
109
|
+
* // Gets the name of the field
|
|
110
|
+
* let name: string = field.name;
|
|
111
|
+
* // Save the document
|
|
112
|
+
* document.save('output.pdf');
|
|
113
|
+
* // Destroy the document
|
|
114
|
+
* document.destroy();
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
readonly name: string;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the actual name of the field (Read only).
|
|
120
|
+
*
|
|
121
|
+
* @private
|
|
122
|
+
* @returns {string} Actual name.
|
|
123
|
+
* ```typescript
|
|
124
|
+
* // Load an existing PDF document
|
|
125
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
126
|
+
* // Access the form field at index 0
|
|
127
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
128
|
+
* // Gets the actual name of the field
|
|
129
|
+
* let name: string = field.actualName;
|
|
130
|
+
* // Save the document
|
|
131
|
+
* document.save('output.pdf');
|
|
132
|
+
* // Destroy the document
|
|
133
|
+
* document.destroy();
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
readonly actualName: string;
|
|
137
|
+
/**
|
|
138
|
+
* Gets the mapping name to be used when exporting interactive form field data from the document.
|
|
139
|
+
*
|
|
140
|
+
* @returns {string} Mapping name.
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // Load an existing PDF document
|
|
143
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
144
|
+
* // Access the form field at index 0
|
|
145
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
146
|
+
* // Gets the mapping name of the field
|
|
147
|
+
* let name: string = field.mappingName;
|
|
148
|
+
* // Save the document
|
|
149
|
+
* document.save('output.pdf');
|
|
150
|
+
* // Destroy the document
|
|
151
|
+
* document.destroy();
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* Sets the mapping name to be used when exporting interactive form field data from the document.
|
|
156
|
+
*
|
|
157
|
+
* @param {string} value Mapping name.
|
|
158
|
+
* ```typescript
|
|
159
|
+
* // Load an existing PDF document
|
|
160
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
161
|
+
* // Access the form field at index 0
|
|
162
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
163
|
+
* // Sets the mapping name of the field
|
|
164
|
+
* field.mappingName = ‘Author’;
|
|
165
|
+
* // Save the document
|
|
166
|
+
* document.save('output.pdf');
|
|
167
|
+
* // Destroy the document
|
|
168
|
+
* document.destroy();
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
mappingName: string;
|
|
172
|
+
/**
|
|
173
|
+
* Gets the tool tip of the form field.
|
|
174
|
+
*
|
|
175
|
+
* @returns {string} Tooltip.
|
|
176
|
+
* ```typescript
|
|
177
|
+
* // Load an existing PDF document
|
|
178
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
179
|
+
* // Access the form field at index 0
|
|
180
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
181
|
+
* // Gets the tool tip value of the field
|
|
182
|
+
* let toolTip: string = field.toolTip;
|
|
183
|
+
* // Save the document
|
|
184
|
+
* document.save('output.pdf');
|
|
185
|
+
* // Destroy the document
|
|
186
|
+
* document.destroy();
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
/**
|
|
190
|
+
* Sets the tool tip of the form field.
|
|
191
|
+
*
|
|
192
|
+
* @param {string} value Tooltip.
|
|
193
|
+
* ```typescript
|
|
194
|
+
* // Load an existing PDF document
|
|
195
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
196
|
+
* // Access the form field at index 0
|
|
197
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
198
|
+
* // Sets the tool tip value of the field
|
|
199
|
+
* field.toolTip = ‘Author of the document’;
|
|
200
|
+
* // Save the document
|
|
201
|
+
* document.save('output.pdf');
|
|
202
|
+
* // Destroy the document
|
|
203
|
+
* document.destroy();
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
toolTip: string;
|
|
207
|
+
/**
|
|
208
|
+
* Gets the form field visibility.
|
|
209
|
+
*
|
|
210
|
+
* @returns {PdfFormFieldVisibility} Field visibility option.
|
|
211
|
+
* ```typescript
|
|
212
|
+
* // Load an existing PDF document
|
|
213
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
214
|
+
* // Access the form field at index 0
|
|
215
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
216
|
+
* // Gets the form field visibility.
|
|
217
|
+
* let visibility: PdfFormFieldVisibility = field.visibility;
|
|
218
|
+
* // Save the document
|
|
219
|
+
* document.save('output.pdf');
|
|
220
|
+
* // Destroy the document
|
|
221
|
+
* document.destroy();
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
/**
|
|
225
|
+
* Sets the form field visibility.
|
|
226
|
+
*
|
|
227
|
+
* @param {PdfFormFieldVisibility} value visibility.
|
|
228
|
+
* ```typescript
|
|
229
|
+
* // Load an existing PDF document
|
|
230
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
231
|
+
* // Access the form field at index 0
|
|
232
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
233
|
+
* // Sets the form field visibility.
|
|
234
|
+
* field.visibility = PdfFormFieldVisibility.visible;
|
|
235
|
+
* // Save the document
|
|
236
|
+
* document.save('output.pdf');
|
|
237
|
+
* // Destroy the document
|
|
238
|
+
* document.destroy();
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
visibility: PdfFormFieldVisibility;
|
|
242
|
+
/**
|
|
243
|
+
* Gets the bounds.
|
|
244
|
+
*
|
|
245
|
+
* @returns {{ x: number, y: number, width: number, height: number }} Bounds.
|
|
246
|
+
* ```typescript
|
|
247
|
+
* // Load an existing PDF document
|
|
248
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
249
|
+
* // Access the form field at index 0
|
|
250
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
251
|
+
* // Gets the bounds of list box field.
|
|
252
|
+
* let bounds: {x: number, y: number, width: number, height: number} = field.bounds;
|
|
253
|
+
* // Save the document
|
|
254
|
+
* document.save('output.pdf');
|
|
255
|
+
* // Destroy the document
|
|
256
|
+
* document.destroy();
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
/**
|
|
260
|
+
* Sets the bounds.
|
|
261
|
+
*
|
|
262
|
+
* @param {{ x: number, y: number, width: number, height: number }} value bounds.
|
|
263
|
+
* ```typescript
|
|
264
|
+
* // Load an existing PDF document
|
|
265
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
266
|
+
* // Access the form field at index 0
|
|
267
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
268
|
+
* // Sets the bounds.
|
|
269
|
+
* field.bounds = {x: 10, y: 10, width: 100, height: 20};
|
|
270
|
+
* // Save the document
|
|
271
|
+
* document.save('output.pdf');
|
|
272
|
+
* // Destroy the document
|
|
273
|
+
* document.destroy();
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
bounds: {
|
|
277
|
+
x: number;
|
|
278
|
+
y: number;
|
|
279
|
+
width: number;
|
|
280
|
+
height: number;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Gets the rotation angle of the field.
|
|
284
|
+
*
|
|
285
|
+
* @returns {number} angle.
|
|
286
|
+
* ```typescript
|
|
287
|
+
* // Load an existing PDF document
|
|
288
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
289
|
+
* // Access the form field at index 0
|
|
290
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
291
|
+
* // Gets the rotation angle of the form field.
|
|
292
|
+
* let rotate: number = field.rotate;
|
|
293
|
+
* // Save the document
|
|
294
|
+
* document.save('output.pdf');
|
|
295
|
+
* // Destroy the document
|
|
296
|
+
* document.destroy();
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
/**
|
|
300
|
+
* Sets the rotation angle of the field.
|
|
301
|
+
*
|
|
302
|
+
* @param {number} value rotation angle.
|
|
303
|
+
* ```typescript
|
|
304
|
+
* // Load an existing PDF document
|
|
305
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
306
|
+
* // Access the form field at index 0
|
|
307
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
308
|
+
* // Sets the rotation angle.
|
|
309
|
+
* field.rotate = 90;
|
|
310
|
+
* // Save the document
|
|
311
|
+
* document.save('output.pdf');
|
|
312
|
+
* // Destroy the document
|
|
313
|
+
* document.destroy();
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
rotate: number;
|
|
317
|
+
/**
|
|
318
|
+
* Gets the fore color of the field.
|
|
319
|
+
*
|
|
320
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
321
|
+
* ```typescript
|
|
322
|
+
* // Load an existing PDF document
|
|
323
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
324
|
+
* // Access the form field at index 0
|
|
325
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
326
|
+
* // Gets the fore color of the field.
|
|
327
|
+
* let color: number[] = field.color;
|
|
328
|
+
* // Save the document
|
|
329
|
+
* document.save('output.pdf');
|
|
330
|
+
* // Destroy the document
|
|
331
|
+
* document.destroy();
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
/**
|
|
335
|
+
* Sets the fore color of the field.
|
|
336
|
+
*
|
|
337
|
+
* @param {number[]} value R, G, B color values in between 0 to 255.
|
|
338
|
+
* ```typescript
|
|
339
|
+
* // Load an existing PDF document
|
|
340
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
341
|
+
* // Access the form field at index 0
|
|
342
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
343
|
+
* // Sets the fore color of the field.
|
|
344
|
+
* field.color = [255, 0, 0];
|
|
345
|
+
* // Save the document
|
|
346
|
+
* document.save('output.pdf');
|
|
347
|
+
* // Destroy the document
|
|
348
|
+
* document.destroy();
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
color: number[];
|
|
352
|
+
/**
|
|
353
|
+
* Gets the back color of the field.
|
|
354
|
+
*
|
|
355
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
356
|
+
* ```typescript
|
|
357
|
+
* // Load an existing PDF document
|
|
358
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
359
|
+
* // Access the form field at index 0
|
|
360
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
361
|
+
* // Gets the back color of the field.
|
|
362
|
+
* let backColor: number[] = field.backColor;
|
|
363
|
+
* // Save the document
|
|
364
|
+
* document.save('output.pdf');
|
|
365
|
+
* // Destroy the document
|
|
366
|
+
* document.destroy();
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
/**
|
|
370
|
+
* Sets the back color of the field.
|
|
371
|
+
*
|
|
372
|
+
* @param {number[]} value R, G, B color values in between 0 to 255.
|
|
373
|
+
* ```typescript
|
|
374
|
+
* // Load an existing PDF document
|
|
375
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
376
|
+
* // Access the form field at index 0
|
|
377
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
378
|
+
* // Sets the back color of the field.
|
|
379
|
+
* field.backColor = [255, 0, 0];
|
|
380
|
+
* // Save the document
|
|
381
|
+
* document.save('output.pdf');
|
|
382
|
+
* // Destroy the document
|
|
383
|
+
* document.destroy();
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
backColor: number[];
|
|
387
|
+
/**
|
|
388
|
+
* Gets the border color of the field.
|
|
389
|
+
*
|
|
390
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
391
|
+
* ```typescript
|
|
392
|
+
* // Load an existing PDF document
|
|
393
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
394
|
+
* // Access the form field at index 0
|
|
395
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
396
|
+
* // Gets the border color of the field.
|
|
397
|
+
* let borderColor: number[] = field.borderColor;
|
|
398
|
+
* // Save the document
|
|
399
|
+
* document.save('output.pdf');
|
|
400
|
+
* // Destroy the document
|
|
401
|
+
* document.destroy();
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
/**
|
|
405
|
+
* Sets the border color of the field.
|
|
406
|
+
*
|
|
407
|
+
* @param {number[]} value R, G, B color values in between 0 to 255.
|
|
408
|
+
* ```typescript
|
|
409
|
+
* // Load an existing PDF document
|
|
410
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
411
|
+
* // Access the form field at index 0
|
|
412
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
413
|
+
* // Sets the border color of the field.
|
|
414
|
+
* field.borderColor = [255, 0, 0];
|
|
415
|
+
* // Save the document
|
|
416
|
+
* document.save('output.pdf');
|
|
417
|
+
* // Destroy the document
|
|
418
|
+
* document.destroy();
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
borderColor: number[];
|
|
422
|
+
/**
|
|
423
|
+
* Gets a value indicating whether read only.
|
|
424
|
+
*
|
|
425
|
+
* @returns {boolean} read only or not.
|
|
426
|
+
* ```typescript
|
|
427
|
+
* // Load an existing PDF document
|
|
428
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
429
|
+
* // Access the form field at index 0
|
|
430
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
431
|
+
* // Gets a value indicating whether read only.
|
|
432
|
+
* let readOnly: boolean = field.readOnly;
|
|
433
|
+
* // Save the document
|
|
434
|
+
* document.save('output.pdf');
|
|
435
|
+
* // Destroy the document
|
|
436
|
+
* document.destroy();
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
/**
|
|
440
|
+
* Sets a value indicating whether read only.
|
|
441
|
+
*
|
|
442
|
+
* @param {boolean} value read only or not.
|
|
443
|
+
* ```typescript
|
|
444
|
+
* // Load an existing PDF document
|
|
445
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
446
|
+
* // Access the form field at index 0
|
|
447
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
448
|
+
* // Sets a value indicating whether read only.
|
|
449
|
+
* field.readOnly = true;
|
|
450
|
+
* // Save the document
|
|
451
|
+
* document.save('output.pdf');
|
|
452
|
+
* // Destroy the document
|
|
453
|
+
* document.destroy();
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
readOnly: boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Gets a value indicating whether the field is required.
|
|
459
|
+
*
|
|
460
|
+
* @returns {boolean} required or not.
|
|
461
|
+
* ```typescript
|
|
462
|
+
* // Load an existing PDF document
|
|
463
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
464
|
+
* // Access the form field at index 0
|
|
465
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
466
|
+
* // Gets a value indicating whether the field is required.
|
|
467
|
+
* let required: boolean = field.required;
|
|
468
|
+
* // Save the document
|
|
469
|
+
* document.save('output.pdf');
|
|
470
|
+
* // Destroy the document
|
|
471
|
+
* document.destroy();
|
|
472
|
+
* ```
|
|
473
|
+
*/
|
|
474
|
+
/**
|
|
475
|
+
* Sets a value indicating whether the field is required.
|
|
476
|
+
*
|
|
477
|
+
* @param {boolean} value required or not.
|
|
478
|
+
* ```typescript
|
|
479
|
+
* // Load an existing PDF document
|
|
480
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
481
|
+
* // Access the form field at index 0
|
|
482
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
483
|
+
* // Sets a value indicating whether the field is required.
|
|
484
|
+
* field.required = true;
|
|
485
|
+
* // Save the document
|
|
486
|
+
* document.save('output.pdf');
|
|
487
|
+
* // Destroy the document
|
|
488
|
+
* document.destroy();
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
required: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Gets a value indicating the visibility of the field (Read only).
|
|
494
|
+
*
|
|
495
|
+
* @returns {boolean} visible or not.
|
|
496
|
+
* ```typescript
|
|
497
|
+
* // Load an existing PDF document
|
|
498
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
499
|
+
* // Access the form field at index 0
|
|
500
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
501
|
+
* // Gets a value indicating the visibility of the field.
|
|
502
|
+
* let visible: boolean = field.visible;
|
|
503
|
+
* // Save the document
|
|
504
|
+
* document.save('output.pdf');
|
|
505
|
+
* // Destroy the document
|
|
506
|
+
* document.destroy();
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
509
|
+
/**
|
|
510
|
+
* Sets a value indicating the visibility of the field.
|
|
511
|
+
* Only applicable for newly created PDF form fields.
|
|
512
|
+
*
|
|
513
|
+
* @param {boolean} value or not.
|
|
514
|
+
* ```typescript
|
|
515
|
+
* // Load an existing PDF document
|
|
516
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
517
|
+
* // Access the form field at index 0
|
|
518
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
519
|
+
* // Sets a value indicating the visibility of the field
|
|
520
|
+
* field.visible = true;
|
|
521
|
+
* // Save the document
|
|
522
|
+
* document.save('output.pdf');
|
|
523
|
+
* // Destroy the document
|
|
524
|
+
* document.destroy();
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
visible: boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Gets the width, style and dash of the border of the field.
|
|
530
|
+
*
|
|
531
|
+
* @returns {PdfInteractiveBorder} Border properties.
|
|
532
|
+
* ```typescript
|
|
533
|
+
* // Load an existing PDF document
|
|
534
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
535
|
+
* // Access the form field at index 0
|
|
536
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
537
|
+
* // Gets the width, style and dash of the border of the field.
|
|
538
|
+
* let border: PdfInteractiveBorder = field.border;
|
|
539
|
+
* // Save the document
|
|
540
|
+
* document.save('output.pdf');
|
|
541
|
+
* // Destroy the document
|
|
542
|
+
* document.destroy();
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
/**
|
|
546
|
+
* Sets the width, style and dash of the border of the field.
|
|
547
|
+
*
|
|
548
|
+
* @param {PdfInteractiveBorder} value Border properties.
|
|
549
|
+
* ```typescript
|
|
550
|
+
* // Load an existing PDF document
|
|
551
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
552
|
+
* // Access the form field at index 0
|
|
553
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
554
|
+
* // Sets the width, style and dash of the border of the field.
|
|
555
|
+
* field.border = new PdfInteractiveBorder(2, PdfBorderStyle.solid);
|
|
556
|
+
* // Save the document
|
|
557
|
+
* document.save('output.pdf');
|
|
558
|
+
* // Destroy the document
|
|
559
|
+
* document.destroy();
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
562
|
+
border: PdfInteractiveBorder;
|
|
563
|
+
/**
|
|
564
|
+
* Gets the rotation of the field (Read only).
|
|
565
|
+
*
|
|
566
|
+
* @returns {PdfRotationAngle} Rotation angle.
|
|
567
|
+
* ```typescript
|
|
568
|
+
* // Load an existing PDF document
|
|
569
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
570
|
+
* // Access the form field at index 0
|
|
571
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
572
|
+
* // Gets the rotation of the field.
|
|
573
|
+
* let rotate: PdfRotationAngle = field.rotationAngle;
|
|
574
|
+
* // Save the document
|
|
575
|
+
* document.save('output.pdf');
|
|
576
|
+
* // Destroy the document
|
|
577
|
+
* document.destroy();
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
readonly rotationAngle: PdfRotationAngle;
|
|
581
|
+
/**
|
|
582
|
+
* Gets a value indicating whether the field is allow to export data or not.
|
|
583
|
+
*
|
|
584
|
+
* @returns {boolean} Allow to export data or not.
|
|
585
|
+
* ```typescript
|
|
586
|
+
* // Load an existing PDF document
|
|
587
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
588
|
+
* // Access the form field at index 0
|
|
589
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
590
|
+
* // Gets a value indicating whether the field is allow to export data or not.
|
|
591
|
+
* let export: boolean = field.export;
|
|
592
|
+
* // Save the document
|
|
593
|
+
* document.save('output.pdf');
|
|
594
|
+
* // Destroy the document
|
|
595
|
+
* document.destroy();
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
/**
|
|
599
|
+
* Sets a value indicating whether the field is allow to export data or not.
|
|
600
|
+
*
|
|
601
|
+
* @param {boolean} value Allow to export data or not.
|
|
602
|
+
* ```typescript
|
|
603
|
+
* // Load an existing PDF document
|
|
604
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
605
|
+
* // Access the form field at index 0
|
|
606
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
607
|
+
* // Sets a value indicating whether the field is allow to export data or not.
|
|
608
|
+
* field.export = true;
|
|
609
|
+
* // Save the document
|
|
610
|
+
* document.save('output.pdf');
|
|
611
|
+
* // Destroy the document
|
|
612
|
+
* document.destroy();
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
export: boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Gets the tab index of annotation in current page.
|
|
618
|
+
*
|
|
619
|
+
* @returns {number} tab index.
|
|
620
|
+
* ```typescript
|
|
621
|
+
* // Load an existing PDF document
|
|
622
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
623
|
+
* // Access the form field at index 0
|
|
624
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
625
|
+
* // Gets the tab index of annotation in current page.
|
|
626
|
+
* let tabIndex: number = field.tabIndex;
|
|
627
|
+
* // Save the document
|
|
628
|
+
* document.save('output.pdf');
|
|
629
|
+
* // Destroy the document
|
|
630
|
+
* document.destroy();
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
/**
|
|
634
|
+
* Sets the tab index of a annotation in the current page.
|
|
635
|
+
*
|
|
636
|
+
* @param {number} value index.
|
|
637
|
+
* ```typescript
|
|
638
|
+
* // Load an existing PDF document
|
|
639
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
640
|
+
* // Access the form field at index 0
|
|
641
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
642
|
+
* // Sets the tab index of annotation in current page.
|
|
643
|
+
* field.tabIndex = 5;
|
|
644
|
+
* // Save the document
|
|
645
|
+
* document.save('output.pdf');
|
|
646
|
+
* // Destroy the document
|
|
647
|
+
* document.destroy();
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
tabIndex: number;
|
|
651
|
+
/**
|
|
652
|
+
* Gets the page object of the form field (Read only).
|
|
653
|
+
*
|
|
654
|
+
* @returns {PdfPage} Page object.
|
|
655
|
+
* ```typescript
|
|
656
|
+
* // Load an existing PDF document
|
|
657
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
658
|
+
* // Access the form field at index 0
|
|
659
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
660
|
+
* // Gets the page object of the form field.
|
|
661
|
+
* let page: PdfPage = field.page;
|
|
662
|
+
* // Save the document
|
|
663
|
+
* document.save('output.pdf');
|
|
664
|
+
* // Destroy the document
|
|
665
|
+
* document.destroy();
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
readonly page: PdfPage;
|
|
669
|
+
/**
|
|
670
|
+
* Gets the boolean flag indicating whether the form field have been flattened or not.
|
|
671
|
+
*
|
|
672
|
+
* @returns {boolean} Flatten.
|
|
673
|
+
*
|
|
674
|
+
* ```typescript
|
|
675
|
+
* // Load an existing PDF document
|
|
676
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
677
|
+
* // Get the first field
|
|
678
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
679
|
+
* // Gets the boolean flag indicating whether the form field have been flattened or not.
|
|
680
|
+
* let flatten: boolean = field.flatten;
|
|
681
|
+
* // Destroy the document
|
|
682
|
+
* document.destroy();
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
/**
|
|
686
|
+
* Sets the boolean flag indicating whether the form field have been flattened or not.
|
|
687
|
+
*
|
|
688
|
+
* @param {boolean} value Flatten.
|
|
689
|
+
*
|
|
690
|
+
* ```typescript
|
|
691
|
+
* // Load an existing PDF document
|
|
692
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
693
|
+
* // Get the first field
|
|
694
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
695
|
+
* // Sets the boolean flag indicating whether the form field have been flattened or not.
|
|
696
|
+
* field.flatten = true;
|
|
697
|
+
* // Destroy the document
|
|
698
|
+
* document.destroy();
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
flatten: boolean;
|
|
702
|
+
readonly _grayBrush: PdfBrush;
|
|
703
|
+
readonly _silverBrush: PdfBrush;
|
|
704
|
+
readonly _whiteBrush: PdfBrush;
|
|
705
|
+
readonly _blackBrush: PdfBrush;
|
|
706
|
+
readonly _kidsCount: number;
|
|
707
|
+
/**
|
|
708
|
+
* Gets the field item as `PdfWidgetAnnotation` at the specified index.
|
|
709
|
+
*
|
|
710
|
+
* @param {number} index Item index.
|
|
711
|
+
* @returns {PdfWidgetAnnotation} Loaded PDF form field item at the specified index.
|
|
712
|
+
*
|
|
713
|
+
* ```typescript
|
|
714
|
+
* // Load an existing PDF document
|
|
715
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
716
|
+
* // Access the loaded form field
|
|
717
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
718
|
+
* // Access the count of the field items.
|
|
719
|
+
* let count: number = field.count;
|
|
720
|
+
* // Access the first item
|
|
721
|
+
* let item: PdfWidgetAnnotation = field.itemAt(0);
|
|
722
|
+
* // Save the document
|
|
723
|
+
* document.save('output.pdf');
|
|
724
|
+
* // Destroy the document
|
|
725
|
+
* document.destroy();
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
itemAt(index: number): PdfWidgetAnnotation;
|
|
729
|
+
/**
|
|
730
|
+
* Sets the flag to indicate the new appearance creation.
|
|
731
|
+
*
|
|
732
|
+
* @param {boolean} value Set appearance.
|
|
733
|
+
* @returns {void} Nothing.
|
|
734
|
+
*
|
|
735
|
+
* ```typescript
|
|
736
|
+
* // Load an existing PDF document
|
|
737
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
738
|
+
* // Set boolean flag to create a new appearance stream for form fields.
|
|
739
|
+
* document.form.fieldAt(0).setAppearance(true);
|
|
740
|
+
* // Save the document
|
|
741
|
+
* document.save('output.pdf');
|
|
742
|
+
* // Destroy the document
|
|
743
|
+
* document.destroy();
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
setAppearance(value: boolean): void;
|
|
747
|
+
/**
|
|
748
|
+
* Gets the value associated with the specified key.
|
|
749
|
+
*
|
|
750
|
+
* @param {string} name Key.
|
|
751
|
+
* @returns {string} Value associated with the key.
|
|
752
|
+
*
|
|
753
|
+
* ```typescript
|
|
754
|
+
* // Load an existing PDF document
|
|
755
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
756
|
+
* // Gets the value associated with the key 'Author'.
|
|
757
|
+
* let value: string = document.form.fieldAt(0).getValue('Author');
|
|
758
|
+
* // Save the document
|
|
759
|
+
* document.save('output.pdf');
|
|
760
|
+
* // Destroy the document
|
|
761
|
+
* document.destroy();
|
|
762
|
+
* ```
|
|
763
|
+
*/
|
|
764
|
+
getValue(name: string): string;
|
|
765
|
+
/**
|
|
766
|
+
* Sets the value associated with the specified key.
|
|
767
|
+
*
|
|
768
|
+
* @param {string} name Key.
|
|
769
|
+
* @param {string} value Value associated with the key..
|
|
770
|
+
* @returns {void} Nothing.
|
|
771
|
+
*
|
|
772
|
+
* ```typescript
|
|
773
|
+
* // Load an existing PDF document
|
|
774
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
775
|
+
* // Access the form field at index 0
|
|
776
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
777
|
+
* // Set custom value
|
|
778
|
+
* field.setValue('Author', 'John');
|
|
779
|
+
* // Save the document
|
|
780
|
+
* document.save('output.pdf');
|
|
781
|
+
* // Destroy the document
|
|
782
|
+
* document.destroy();
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
setValue(name: string, value: string): void;
|
|
786
|
+
/**
|
|
787
|
+
* Remove the form field item from the specified index.
|
|
788
|
+
*
|
|
789
|
+
* @param {number} index Item index to remove.
|
|
790
|
+
* @returns {void} Nothing.
|
|
791
|
+
*
|
|
792
|
+
* ```typescript
|
|
793
|
+
* // Load an existing PDF document
|
|
794
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
795
|
+
* // Access the form field at index 0
|
|
796
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
797
|
+
* // Remove the first item of the form field
|
|
798
|
+
* field.removeItemAt(0);
|
|
799
|
+
* // Save the document
|
|
800
|
+
* document.save('output.pdf');
|
|
801
|
+
* // Destroy the document
|
|
802
|
+
* document.destroy();
|
|
803
|
+
* ```
|
|
804
|
+
*/
|
|
805
|
+
removeItemAt(index: number): void;
|
|
806
|
+
/**
|
|
807
|
+
* Remove the specified form field item.
|
|
808
|
+
*
|
|
809
|
+
* @param {PdfWidgetAnnotation} item Item to remove.
|
|
810
|
+
* @returns {void} Nothing.
|
|
811
|
+
*
|
|
812
|
+
* ```typescript
|
|
813
|
+
* // Load an existing PDF document
|
|
814
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
815
|
+
* // Access the form field at index 0
|
|
816
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
817
|
+
* // Remove the first item of the form field
|
|
818
|
+
* field.removeItem(field.itemAt(0));
|
|
819
|
+
* // Save the document
|
|
820
|
+
* document.save('output.pdf');
|
|
821
|
+
* // Destroy the document
|
|
822
|
+
* document.destroy();
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
removeItem(item: PdfWidgetAnnotation): void;
|
|
826
|
+
_fieldFlags: _FieldFlag;
|
|
827
|
+
readonly _defaultAppearance: _PdfDefaultAppearance;
|
|
828
|
+
readonly _mkDictionary: _PdfDictionary;
|
|
829
|
+
_updateBorder(dictionary: _PdfDictionary, value: PdfInteractiveBorder): void;
|
|
830
|
+
abstract _doPostProcess(isFlatten?: boolean): void;
|
|
831
|
+
_checkFieldFlag(dictionary: _PdfDictionary): boolean;
|
|
832
|
+
_initializeFont(font: PdfFont): void;
|
|
833
|
+
_drawRectangularControl(g: PdfGraphics, parameter: _PaintParameter): void;
|
|
834
|
+
_drawBorder(g: PdfGraphics, bounds: number[], borderPen: PdfPen, style: PdfBorderStyle, borderWidth: number): void;
|
|
835
|
+
_drawLeftTopShadow(g: PdfGraphics, bounds: number[], width: number, brush: PdfBrush): void;
|
|
836
|
+
_drawRightBottomShadow(g: PdfGraphics, bounds: number[], width: number, brush: PdfBrush): void;
|
|
837
|
+
_drawRadioButton(graphics: PdfGraphics, parameter: _PaintParameter, checkSymbol: string, state: _PdfCheckFieldState): void;
|
|
838
|
+
_drawRoundBorder(graphics: PdfGraphics, bounds: number[], borderPen: PdfPen, borderWidth: number): void;
|
|
839
|
+
_drawRoundShadow(graphics: PdfGraphics, parameter: _PaintParameter, state: _PdfCheckFieldState): void;
|
|
840
|
+
_drawCheckBox(graphics: PdfGraphics, parameter: _PaintParameter, checkSymbol: string, state: _PdfCheckFieldState, font?: PdfFont): void;
|
|
841
|
+
_addToKid(item: PdfWidgetAnnotation): void;
|
|
842
|
+
_drawTemplate(template: PdfTemplate, page: PdfPage, bounds: {
|
|
843
|
+
x: number;
|
|
844
|
+
y: number;
|
|
845
|
+
width: number;
|
|
846
|
+
height: number;
|
|
847
|
+
}): void;
|
|
848
|
+
_addToOptions(item: PdfListFieldItem, field: PdfListField): void;
|
|
849
|
+
_addAppearance(dictionary: _PdfDictionary, template: PdfTemplate, key: string): void;
|
|
850
|
+
_rotateTextBox(rect: number[], size: number[], angle: PdfRotationAngle): number[];
|
|
851
|
+
_checkIndex(value: number, length: number): void;
|
|
852
|
+
_getAppearanceStateValue(): string;
|
|
853
|
+
_getTextAlignment(): PdfTextAlignment;
|
|
854
|
+
_setTextAlignment(value: PdfTextAlignment): void;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* `PdfTextBoxField` class represents the text box field objects.
|
|
858
|
+
* ```typescript
|
|
859
|
+
* // Load an existing PDF document
|
|
860
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
861
|
+
* // Access text box field
|
|
862
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
863
|
+
* // Save the document
|
|
864
|
+
* document.save('output.pdf');
|
|
865
|
+
* // Destroy the document
|
|
866
|
+
* document.destroy();
|
|
867
|
+
* ```
|
|
868
|
+
*/
|
|
869
|
+
export declare class PdfTextBoxField extends PdfField {
|
|
870
|
+
_text: string;
|
|
871
|
+
_defaultValue: string;
|
|
872
|
+
_spellCheck: boolean;
|
|
873
|
+
_insertSpaces: boolean;
|
|
874
|
+
_multiline: boolean;
|
|
875
|
+
_password: boolean;
|
|
876
|
+
_scrollable: boolean;
|
|
877
|
+
_autoResizeText: boolean;
|
|
878
|
+
/**
|
|
879
|
+
* Represents a text box field of the PDF document.
|
|
880
|
+
*
|
|
881
|
+
* @private
|
|
882
|
+
*/
|
|
883
|
+
constructor();
|
|
884
|
+
/**
|
|
885
|
+
* Represents a text box field of the PDF document.
|
|
886
|
+
*
|
|
887
|
+
* @param {PdfPage} page The page where the field is drawn.
|
|
888
|
+
* @param {string} name The name of the field.
|
|
889
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds The bounds of the field.
|
|
890
|
+
* ```typescript
|
|
891
|
+
* // Load an existing PDF document
|
|
892
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
893
|
+
* // Gets the first page of the document
|
|
894
|
+
* let page: PdfPage = document.getPage(0);
|
|
895
|
+
* // Access the PDF form
|
|
896
|
+
* let form: PdfForm = document.form;
|
|
897
|
+
* // Create a new text box field
|
|
898
|
+
* let field: PdfTextBoxField = new PdfTextBoxField(page, 'FirstName', {x: 10, y: 10, width: 100, height: 50});
|
|
899
|
+
* // Add the field into PDF form
|
|
900
|
+
* form.add(field);
|
|
901
|
+
* // Save the document
|
|
902
|
+
* document.save('output.pdf');
|
|
903
|
+
* // Destroy the document
|
|
904
|
+
* document.destroy();
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
constructor(page: PdfPage, name: string, bounds: {
|
|
908
|
+
x: number;
|
|
909
|
+
y: number;
|
|
910
|
+
width: number;
|
|
911
|
+
height: number;
|
|
912
|
+
});
|
|
913
|
+
/**
|
|
914
|
+
* Parse an existing text box field.
|
|
915
|
+
*
|
|
916
|
+
* @private
|
|
917
|
+
* @param {PdfForm} form Form object.
|
|
918
|
+
* @param {_PdfDictionary} dictionary Field dictionary.
|
|
919
|
+
* @param {_PdfCrossReference} crossReference Cross reference object.
|
|
920
|
+
* @param {_PdfReference} reference Field reference.
|
|
921
|
+
* @returns {PdfTextBoxField} Text box field.
|
|
922
|
+
*/
|
|
923
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfTextBoxField;
|
|
924
|
+
/**
|
|
925
|
+
* Gets the value of the text box field.
|
|
926
|
+
*
|
|
927
|
+
* @returns {string} Text.
|
|
928
|
+
* ```typescript
|
|
929
|
+
* // Load an existing PDF document
|
|
930
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
931
|
+
* // Access text box field
|
|
932
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
933
|
+
* // Gets the text value from text box field
|
|
934
|
+
* let text: string = field.text;
|
|
935
|
+
* // Save the document
|
|
936
|
+
* document.save('output.pdf');
|
|
937
|
+
* // Destroy the document
|
|
938
|
+
* document.destroy();
|
|
939
|
+
* ```
|
|
940
|
+
*/
|
|
941
|
+
/**
|
|
942
|
+
* Sets the value of the text box field.
|
|
943
|
+
*
|
|
944
|
+
* @param {string} value Text.
|
|
945
|
+
* ```typescript
|
|
946
|
+
* // Load an existing PDF document
|
|
947
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
948
|
+
* // Access text box field
|
|
949
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
950
|
+
* // Sets the text value to text box field
|
|
951
|
+
* field.text = ‘Syncfusion’;
|
|
952
|
+
* // Save the document
|
|
953
|
+
* document.save('output.pdf');
|
|
954
|
+
* // Destroy the document
|
|
955
|
+
* document.destroy();
|
|
956
|
+
* ```
|
|
957
|
+
*/
|
|
958
|
+
text: string;
|
|
959
|
+
/**
|
|
960
|
+
* Gets the text alignment in a text box.
|
|
961
|
+
*
|
|
962
|
+
* @returns {PdfTextAlignment} Text alignment.
|
|
963
|
+
* ```typescript
|
|
964
|
+
* // Load an existing PDF document
|
|
965
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
966
|
+
* // Access text box field
|
|
967
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
968
|
+
* // Gets the text alignment from text box field
|
|
969
|
+
* let alignment: PdfTextAlignment = field.textAlignment;
|
|
970
|
+
* // Save the document
|
|
971
|
+
* document.save('output.pdf');
|
|
972
|
+
* // Destroy the document
|
|
973
|
+
* document.destroy();
|
|
974
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
/**
|
|
977
|
+
* Sets the text alignment in a text box.
|
|
978
|
+
*
|
|
979
|
+
* @param {PdfTextAlignment} value Text alignment.
|
|
980
|
+
* ```typescript
|
|
981
|
+
* // Load an existing PDF document
|
|
982
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
983
|
+
* // Access text box field
|
|
984
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
985
|
+
* // Sets the text alignment of form field as center
|
|
986
|
+
* field.textAlignment = PdfTextAlignment.center;
|
|
987
|
+
* // Save the document
|
|
988
|
+
* document.save('output.pdf');
|
|
989
|
+
* // Destroy the document
|
|
990
|
+
* document.destroy();
|
|
991
|
+
* ```
|
|
992
|
+
*/
|
|
993
|
+
textAlignment: PdfTextAlignment;
|
|
994
|
+
/**
|
|
995
|
+
* Gets the default value of the field.
|
|
996
|
+
*
|
|
997
|
+
* @returns {string} Default value.
|
|
998
|
+
* ```typescript
|
|
999
|
+
* // Load an existing PDF document
|
|
1000
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1001
|
+
* // Access text box field
|
|
1002
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1003
|
+
* // Gets the default value from the text box field
|
|
1004
|
+
* let value: string = field.defaultValue;
|
|
1005
|
+
* // Save the document
|
|
1006
|
+
* document.save('output.pdf');
|
|
1007
|
+
* // Destroy the document
|
|
1008
|
+
* document.destroy();
|
|
1009
|
+
* ```
|
|
1010
|
+
*/
|
|
1011
|
+
/**
|
|
1012
|
+
* Sets the default value of the field.
|
|
1013
|
+
*
|
|
1014
|
+
* @param {string} value Default value.
|
|
1015
|
+
* ```typescript
|
|
1016
|
+
* // Load an existing PDF document
|
|
1017
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1018
|
+
* // Access text box field
|
|
1019
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1020
|
+
* // Sets the default value of the text box field
|
|
1021
|
+
* field.defaultValue = 'Syncfusion';
|
|
1022
|
+
* // Save the document
|
|
1023
|
+
* document.save('output.pdf');
|
|
1024
|
+
* // Destroy the document
|
|
1025
|
+
* document.destroy();
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1028
|
+
defaultValue: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* Gets a value indicating whether this `PdfTextBoxField` is multiline.
|
|
1031
|
+
*
|
|
1032
|
+
* @returns {boolean} multiline.
|
|
1033
|
+
* ```typescript
|
|
1034
|
+
* // Load an existing PDF document
|
|
1035
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1036
|
+
* // Access text box field
|
|
1037
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1038
|
+
* // Gets a value indicating whether this `PdfTextBoxField` is multiline.
|
|
1039
|
+
* let multiLine: boolean = field.multiLine;
|
|
1040
|
+
* // Save the document
|
|
1041
|
+
* document.save('output.pdf');
|
|
1042
|
+
* // Destroy the document
|
|
1043
|
+
* document.destroy();
|
|
1044
|
+
* ```
|
|
1045
|
+
*/
|
|
1046
|
+
/**
|
|
1047
|
+
* Sets a value indicating whether this `PdfTextBoxField` is multiline.
|
|
1048
|
+
*
|
|
1049
|
+
* @param {boolean} value multiLine or not.
|
|
1050
|
+
* ```typescript
|
|
1051
|
+
* // Load an existing PDF document
|
|
1052
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1053
|
+
* // Access text box field
|
|
1054
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1055
|
+
* // Sets a value indicating whether this `PdfTextBoxField` is multiline.
|
|
1056
|
+
* field.multiLine = false;
|
|
1057
|
+
* // Save the document
|
|
1058
|
+
* document.save('output.pdf');
|
|
1059
|
+
* // Destroy the document
|
|
1060
|
+
* document.destroy();
|
|
1061
|
+
* ```
|
|
1062
|
+
*/
|
|
1063
|
+
multiLine: boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* Gets a value indicating whether this `PdfTextBoxField` is password.
|
|
1066
|
+
*
|
|
1067
|
+
* @returns {boolean} password.
|
|
1068
|
+
* ```typescript
|
|
1069
|
+
* // Load an existing PDF document
|
|
1070
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1071
|
+
* // Access text box field
|
|
1072
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1073
|
+
* // Gets a value indicating whether this `PdfTextBoxField` is password.
|
|
1074
|
+
* let password: boolean = field.password;
|
|
1075
|
+
* // Save the document
|
|
1076
|
+
* document.save('output.pdf');
|
|
1077
|
+
* // Destroy the document
|
|
1078
|
+
* document.destroy();
|
|
1079
|
+
* ```
|
|
1080
|
+
*/
|
|
1081
|
+
/**
|
|
1082
|
+
* Sets a value indicating whether this `PdfTextBoxField` is password.
|
|
1083
|
+
*
|
|
1084
|
+
* @param {boolean} value password or not.
|
|
1085
|
+
* ```typescript
|
|
1086
|
+
* // Load an existing PDF document
|
|
1087
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1088
|
+
* // Access text box field
|
|
1089
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1090
|
+
* // Sets a value indicating whether this `PdfTextBoxField` is password.
|
|
1091
|
+
* field.password = false;
|
|
1092
|
+
* // Save the document
|
|
1093
|
+
* document.save('output.pdf');
|
|
1094
|
+
* // Destroy the document
|
|
1095
|
+
* document.destroy();
|
|
1096
|
+
* ```
|
|
1097
|
+
*/
|
|
1098
|
+
password: boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* Gets a value indicating whether this `PdfTextBoxField` is scrollable.
|
|
1101
|
+
*
|
|
1102
|
+
* @returns {boolean} scrollable.
|
|
1103
|
+
* ```typescript
|
|
1104
|
+
* // Load an existing PDF document
|
|
1105
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1106
|
+
* // Access text box field
|
|
1107
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1108
|
+
* // Gets a value indicating whether this `PdfTextBoxField` is scrollable.
|
|
1109
|
+
* let scrollable: boolean = field.scrollable;
|
|
1110
|
+
* // Save the document
|
|
1111
|
+
* document.save('output.pdf');
|
|
1112
|
+
* // Destroy the document
|
|
1113
|
+
* document.destroy();
|
|
1114
|
+
* ```
|
|
1115
|
+
*/
|
|
1116
|
+
/**
|
|
1117
|
+
* Sets a value indicating whether this `PdfTextBoxField` is scrollable.
|
|
1118
|
+
*
|
|
1119
|
+
* @param {boolean} value scrollable or not.
|
|
1120
|
+
* ```typescript
|
|
1121
|
+
* // Load an existing PDF document
|
|
1122
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1123
|
+
* // Access text box field
|
|
1124
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1125
|
+
* // Sets a value indicating whether this `PdfTextBoxField` is scrollable.
|
|
1126
|
+
* field.scrollable = false;
|
|
1127
|
+
* // Save the document
|
|
1128
|
+
* document.save('output.pdf');
|
|
1129
|
+
* // Destroy the document
|
|
1130
|
+
* document.destroy();
|
|
1131
|
+
* ```
|
|
1132
|
+
*/
|
|
1133
|
+
scrollable: boolean;
|
|
1134
|
+
/**
|
|
1135
|
+
* Gets a value indicating whether to check spelling.
|
|
1136
|
+
*
|
|
1137
|
+
* @returns {boolean} spellCheck.
|
|
1138
|
+
* ```typescript
|
|
1139
|
+
* // Load an existing PDF document
|
|
1140
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1141
|
+
* // Access text box field
|
|
1142
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1143
|
+
* // Gets a value indicating whether to check spelling
|
|
1144
|
+
* let spellCheck: boolean = field.spellCheck;
|
|
1145
|
+
* // Save the document
|
|
1146
|
+
* document.save('output.pdf');
|
|
1147
|
+
* // Destroy the document
|
|
1148
|
+
* document.destroy();
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
/**
|
|
1152
|
+
* Sets a value indicating whether to check spelling.
|
|
1153
|
+
*
|
|
1154
|
+
* @param {boolean} value spellCheck or not.
|
|
1155
|
+
* ```typescript
|
|
1156
|
+
* // Load an existing PDF document
|
|
1157
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1158
|
+
* // Access text box field
|
|
1159
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1160
|
+
* // Sets a value indicating whether to check spelling
|
|
1161
|
+
* field.spellCheck = false;
|
|
1162
|
+
* // Save the document
|
|
1163
|
+
* document.save('output.pdf');
|
|
1164
|
+
* // Destroy the document
|
|
1165
|
+
* document.destroy();
|
|
1166
|
+
* ```
|
|
1167
|
+
*/
|
|
1168
|
+
spellCheck: boolean;
|
|
1169
|
+
/**
|
|
1170
|
+
* Meaningful only if the MaxLength property is set and the Multiline, Password properties are false.
|
|
1171
|
+
* If set, the field is automatically divided into as many equally spaced positions, or combs,
|
|
1172
|
+
* as the value of MaxLength, and the text is laid out into those combs.
|
|
1173
|
+
*
|
|
1174
|
+
* @returns {boolean} insertSpaces.
|
|
1175
|
+
* ```typescript
|
|
1176
|
+
* // Load an existing PDF document
|
|
1177
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1178
|
+
* // Access text box field
|
|
1179
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1180
|
+
* // Gets a value indicating whether this `PdfTextBoxField` is insertSpaces.
|
|
1181
|
+
* let insertSpaces: boolean = field.insertSpaces;
|
|
1182
|
+
* // Save the document
|
|
1183
|
+
* document.save('output.pdf');
|
|
1184
|
+
* // Destroy the document
|
|
1185
|
+
* document.destroy();
|
|
1186
|
+
* ```
|
|
1187
|
+
*/
|
|
1188
|
+
/**
|
|
1189
|
+
* Meaningful only if the MaxLength property is set and the Multiline, Password properties are false.
|
|
1190
|
+
* If set, the field is automatically divided into as many equally spaced positions, or combs,
|
|
1191
|
+
* as the value of MaxLength, and the text is laid out into those combs.
|
|
1192
|
+
*
|
|
1193
|
+
* @param {boolean} value insertSpaces.
|
|
1194
|
+
* ```typescript
|
|
1195
|
+
* // Load an existing PDF document
|
|
1196
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1197
|
+
* // Access text box field
|
|
1198
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1199
|
+
* // Sets a value indicating whether this `PdfTextBoxField` is insertSpaces.
|
|
1200
|
+
* field.insertSpaces = false;
|
|
1201
|
+
* // Save the document
|
|
1202
|
+
* document.save('output.pdf');
|
|
1203
|
+
* // Destroy the document
|
|
1204
|
+
* document.destroy();
|
|
1205
|
+
* ```
|
|
1206
|
+
*/
|
|
1207
|
+
insertSpaces: boolean;
|
|
1208
|
+
/**
|
|
1209
|
+
* Gets the highlight mode of the field.
|
|
1210
|
+
*
|
|
1211
|
+
* @returns {PdfHighlightMode} highlight mode.
|
|
1212
|
+
* ```typescript
|
|
1213
|
+
* // Load an existing PDF document
|
|
1214
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1215
|
+
* // Access text box field
|
|
1216
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1217
|
+
* // Gets the highlight mode of text box field
|
|
1218
|
+
* let mode: PdfHighlightMode = field.highlightMode;
|
|
1219
|
+
* // Save the document
|
|
1220
|
+
* document.save('output.pdf');
|
|
1221
|
+
* // Destroy the document
|
|
1222
|
+
* document.destroy();
|
|
1223
|
+
* ```
|
|
1224
|
+
*/
|
|
1225
|
+
/**
|
|
1226
|
+
* Sets the highlight mode of the field.
|
|
1227
|
+
*
|
|
1228
|
+
* @param {PdfHighlightMode} value highlight mode.
|
|
1229
|
+
* ```typescript
|
|
1230
|
+
* // Load an existing PDF document
|
|
1231
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1232
|
+
* // Access text box field
|
|
1233
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1234
|
+
* // Sets the highlight mode of text box field as outline
|
|
1235
|
+
* field.highlightMode = PdfHighlightMode.outline;
|
|
1236
|
+
* // Save the document
|
|
1237
|
+
* document.save('output.pdf');
|
|
1238
|
+
* // Destroy the document
|
|
1239
|
+
* document.destroy();
|
|
1240
|
+
* ```
|
|
1241
|
+
*/
|
|
1242
|
+
highlightMode: PdfHighlightMode;
|
|
1243
|
+
/**
|
|
1244
|
+
* Gets the maximum length of the field, in characters.
|
|
1245
|
+
*
|
|
1246
|
+
* @returns {number} maximum length.
|
|
1247
|
+
* ```typescript
|
|
1248
|
+
* // Load an existing PDF document
|
|
1249
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1250
|
+
* // Access text box field
|
|
1251
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1252
|
+
* // Gets the maximum length of the field, in characters.
|
|
1253
|
+
* let maxLength: number = field.maxLength;
|
|
1254
|
+
* // Save the document
|
|
1255
|
+
* document.save('output.pdf');
|
|
1256
|
+
* // Destroy the document
|
|
1257
|
+
* document.destroy();
|
|
1258
|
+
* ```
|
|
1259
|
+
*/
|
|
1260
|
+
/**
|
|
1261
|
+
* Sets the maximum length of the field, in characters.
|
|
1262
|
+
*
|
|
1263
|
+
* @param {number} value maximum length.
|
|
1264
|
+
* ```typescript
|
|
1265
|
+
* // Load an existing PDF document
|
|
1266
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1267
|
+
* // Access text box field
|
|
1268
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1269
|
+
* // Sets the maximum length of the field, in characters.
|
|
1270
|
+
* field.maxLength = 20;
|
|
1271
|
+
* // Save the document
|
|
1272
|
+
* document.save('output.pdf');
|
|
1273
|
+
* // Destroy the document
|
|
1274
|
+
* document.destroy();
|
|
1275
|
+
* ```
|
|
1276
|
+
*/
|
|
1277
|
+
maxLength: number;
|
|
1278
|
+
/**
|
|
1279
|
+
* Gets the flag indicating whether the auto resize text enabled or not.
|
|
1280
|
+
* Note: Applicable only for newly created PDF fields.
|
|
1281
|
+
*
|
|
1282
|
+
* @returns {boolean} Enable or disable auto resize text.
|
|
1283
|
+
* ```typescript
|
|
1284
|
+
* // Load an existing PDF document
|
|
1285
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1286
|
+
* // Access text box field
|
|
1287
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1288
|
+
* // Gets the flag indicating whether the auto resize text enabled or not.
|
|
1289
|
+
* let isAutoResize: boolean = field.isAutoResizeText;
|
|
1290
|
+
* // Save the document
|
|
1291
|
+
* document.save('output.pdf');
|
|
1292
|
+
* // Destroy the document
|
|
1293
|
+
* document.destroy();
|
|
1294
|
+
* ```
|
|
1295
|
+
*/
|
|
1296
|
+
/**
|
|
1297
|
+
* Sets the flag indicating whether the auto resize text enabled or not.
|
|
1298
|
+
* Note: Applicable only for newly created PDF fields.
|
|
1299
|
+
*
|
|
1300
|
+
* @param {boolean} value Enable or disable auto resize text.
|
|
1301
|
+
* ```typescript
|
|
1302
|
+
* // Load an existing PDF document
|
|
1303
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1304
|
+
* // Access text box field
|
|
1305
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1306
|
+
* // Sets the flag indicating whether the auto resize text enabled or not.
|
|
1307
|
+
* field.isAutoResizeText = false;
|
|
1308
|
+
* // Save the document
|
|
1309
|
+
* document.save('output.pdf');
|
|
1310
|
+
* // Destroy the document
|
|
1311
|
+
* document.destroy();
|
|
1312
|
+
* ```
|
|
1313
|
+
*/
|
|
1314
|
+
isAutoResizeText: boolean;
|
|
1315
|
+
/**
|
|
1316
|
+
* Gets the font of the field.
|
|
1317
|
+
*
|
|
1318
|
+
* @returns {PdfFont} font.
|
|
1319
|
+
*
|
|
1320
|
+
* ```typescript
|
|
1321
|
+
* // Load an existing PDF document
|
|
1322
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1323
|
+
* // Access the form field at index 0
|
|
1324
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1325
|
+
* // Gets the font of the field.
|
|
1326
|
+
* let font: PdfFont = field.font;
|
|
1327
|
+
* // Save the document
|
|
1328
|
+
* document.save('output.pdf');
|
|
1329
|
+
* // Destroy the document
|
|
1330
|
+
* document.destroy();
|
|
1331
|
+
* ```
|
|
1332
|
+
*/
|
|
1333
|
+
/**
|
|
1334
|
+
* Sets the font of the field.
|
|
1335
|
+
*
|
|
1336
|
+
* @param {PdfFont} value font.
|
|
1337
|
+
*
|
|
1338
|
+
* ```typescript
|
|
1339
|
+
* // Load an existing PDF document
|
|
1340
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1341
|
+
* // Access the form field at index 0
|
|
1342
|
+
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
|
|
1343
|
+
* // Sets the font of the field
|
|
1344
|
+
* field.font = new PdfStandardFont(PdfFontFamily.helvetica, 12, PdfFontStyle.bold);
|
|
1345
|
+
* // Save the document
|
|
1346
|
+
* document.save('output.pdf');
|
|
1347
|
+
* // Destroy the document
|
|
1348
|
+
* document.destroy();
|
|
1349
|
+
* ```
|
|
1350
|
+
*/
|
|
1351
|
+
font: PdfFont;
|
|
1352
|
+
_initialize(page: PdfPage, name: string, bounds: {
|
|
1353
|
+
x: number;
|
|
1354
|
+
y: number;
|
|
1355
|
+
width: number;
|
|
1356
|
+
height: number;
|
|
1357
|
+
}): void;
|
|
1358
|
+
_createItem(bounds: {
|
|
1359
|
+
x: number;
|
|
1360
|
+
y: number;
|
|
1361
|
+
width: number;
|
|
1362
|
+
height: number;
|
|
1363
|
+
}): void;
|
|
1364
|
+
_doPostProcess(isFlatten?: boolean): void;
|
|
1365
|
+
_postProcess(isFlatten: boolean, widget?: PdfWidgetAnnotation): void;
|
|
1366
|
+
_createAppearance(isFlatten: boolean, widget: PdfWidgetAnnotation | PdfTextBoxField): PdfTemplate;
|
|
1367
|
+
_drawTextBox(g: PdfGraphics, parameter: _PaintParameter, text: string, font: PdfFont, format: PdfStringFormat, multiline: boolean, scroll: boolean, maxLength?: number): void;
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* `PdfButtonField` class represents the button field objects.
|
|
1371
|
+
* ```typescript
|
|
1372
|
+
* // Load an existing PDF document
|
|
1373
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1374
|
+
* // Gets the first page of the document
|
|
1375
|
+
* let page: PdfPage = document.getPage(0);
|
|
1376
|
+
* // Access the PDF form
|
|
1377
|
+
* let form: PdfForm = document.form;
|
|
1378
|
+
* // Create a new button field
|
|
1379
|
+
* let field: PdfButtonField = new PdfButtonField(page , 'Button1', {x: 100, y: 40, width: 100, height: 20});
|
|
1380
|
+
* // Add the field into PDF form
|
|
1381
|
+
* form.add(field);
|
|
1382
|
+
* // Save the document
|
|
1383
|
+
* document.save('output.pdf');
|
|
1384
|
+
* // Destroy the document
|
|
1385
|
+
* document.destroy();
|
|
1386
|
+
* ```
|
|
1387
|
+
*/
|
|
1388
|
+
export declare class PdfButtonField extends PdfField {
|
|
1389
|
+
_text: string;
|
|
1390
|
+
_appearance: PdfAppearance;
|
|
1391
|
+
/**
|
|
1392
|
+
* Represents a button field of the PDF document.
|
|
1393
|
+
*
|
|
1394
|
+
* @private
|
|
1395
|
+
*/
|
|
1396
|
+
constructor();
|
|
1397
|
+
/**
|
|
1398
|
+
* Represents a button box field of the PDF document.
|
|
1399
|
+
*
|
|
1400
|
+
* @param {PdfPage} page The page where the field is drawn.
|
|
1401
|
+
* @param {string} name The name of the field.
|
|
1402
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds The bounds of the field.
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* // Load an existing PDF document
|
|
1405
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1406
|
+
* // Gets the first page of the document
|
|
1407
|
+
* let page: PdfPage = document.getPage(0);
|
|
1408
|
+
* // Access the PDF form
|
|
1409
|
+
* let form: PdfForm = document.form;
|
|
1410
|
+
* // Create a new button field
|
|
1411
|
+
* let field: PdfButtonField = new PdfButtonField(page , 'Button1', {x: 100, y: 40, width: 100, height: 20});
|
|
1412
|
+
* // Add the field into PDF form
|
|
1413
|
+
* form.add(field);
|
|
1414
|
+
* // Save the document
|
|
1415
|
+
* document.save('output.pdf');
|
|
1416
|
+
* // Destroy the document
|
|
1417
|
+
* document.destroy();
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
constructor(page: PdfPage, name: string, bounds: {
|
|
1421
|
+
x: number;
|
|
1422
|
+
y: number;
|
|
1423
|
+
width: number;
|
|
1424
|
+
height: number;
|
|
1425
|
+
});
|
|
1426
|
+
/**
|
|
1427
|
+
* Gets value of the text box field.
|
|
1428
|
+
*
|
|
1429
|
+
* @returns {string} Text.
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* // Load an existing PDF document
|
|
1432
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1433
|
+
* // Access text box field
|
|
1434
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1435
|
+
* // Gets the text value from button field
|
|
1436
|
+
* let text: string = field.text;
|
|
1437
|
+
* // Save the document
|
|
1438
|
+
* document.save('output.pdf');
|
|
1439
|
+
* // Destroy the document
|
|
1440
|
+
* document.destroy();
|
|
1441
|
+
* ```
|
|
1442
|
+
*/
|
|
1443
|
+
/**
|
|
1444
|
+
* Sets value of the text box field.
|
|
1445
|
+
*
|
|
1446
|
+
* @param {string} value Text.
|
|
1447
|
+
* ```typescript
|
|
1448
|
+
* // Load an existing PDF document
|
|
1449
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1450
|
+
* // Access button field
|
|
1451
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1452
|
+
* // Sets the text value of form field
|
|
1453
|
+
* field.text = ’Click to submit’;
|
|
1454
|
+
* // Save the document
|
|
1455
|
+
* document.save('output.pdf');
|
|
1456
|
+
* // Destroy the document
|
|
1457
|
+
* document.destroy();
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
text: string;
|
|
1461
|
+
/**
|
|
1462
|
+
* Gets the text alignment in a button field.
|
|
1463
|
+
*
|
|
1464
|
+
* @returns {PdfTextAlignment} Text alignment.
|
|
1465
|
+
* ```typescript
|
|
1466
|
+
* // Load an existing PDF document
|
|
1467
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1468
|
+
* // Access button field
|
|
1469
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1470
|
+
* // Gets the text alignment from button field
|
|
1471
|
+
* let alignment: PdfTextAlignment = field.textAlignment;
|
|
1472
|
+
* // Save the document
|
|
1473
|
+
* document.save('output.pdf');
|
|
1474
|
+
* // Destroy the document
|
|
1475
|
+
* document.destroy();
|
|
1476
|
+
* ```
|
|
1477
|
+
*/
|
|
1478
|
+
/**
|
|
1479
|
+
* Sets the text alignment in a button field.
|
|
1480
|
+
*
|
|
1481
|
+
* @param {PdfTextAlignment} value Text alignment.
|
|
1482
|
+
* ```typescript
|
|
1483
|
+
* // Load an existing PDF document
|
|
1484
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1485
|
+
* // Access button field
|
|
1486
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1487
|
+
* // Sets the text alignment of form field as center
|
|
1488
|
+
* field.textAlignment = PdfTextAlignment.center;
|
|
1489
|
+
* // Save the document
|
|
1490
|
+
* document.save('output.pdf');
|
|
1491
|
+
* // Destroy the document
|
|
1492
|
+
* document.destroy();
|
|
1493
|
+
* ```
|
|
1494
|
+
*/
|
|
1495
|
+
textAlignment: PdfTextAlignment;
|
|
1496
|
+
/**
|
|
1497
|
+
* Gets the highlight mode of the field.
|
|
1498
|
+
*
|
|
1499
|
+
* @returns {PdfHighlightMode} highlight mode.
|
|
1500
|
+
* ```typescript
|
|
1501
|
+
* // Load an existing PDF document
|
|
1502
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1503
|
+
* // Access button field
|
|
1504
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1505
|
+
* // Gets the highlight mode from button field
|
|
1506
|
+
* let highlightMode: PdfHighlightMode = field. highlightMode;
|
|
1507
|
+
* // Save the document
|
|
1508
|
+
* document.save('output.pdf');
|
|
1509
|
+
* // Destroy the document
|
|
1510
|
+
* document.destroy();
|
|
1511
|
+
* ```
|
|
1512
|
+
*/
|
|
1513
|
+
/**
|
|
1514
|
+
* Sets the highlight mode of the field.
|
|
1515
|
+
*
|
|
1516
|
+
* @param {PdfHighlightMode} value highlight mode.
|
|
1517
|
+
* ```typescript
|
|
1518
|
+
* // Load an existing PDF document
|
|
1519
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1520
|
+
* // Access button field
|
|
1521
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1522
|
+
* // Sets the highlight mode of button field as outline
|
|
1523
|
+
* field.highlightMode = PdfHighlightMode.outline;
|
|
1524
|
+
* // Save the document
|
|
1525
|
+
* document.save('output.pdf');
|
|
1526
|
+
* // Destroy the document
|
|
1527
|
+
* document.destroy();
|
|
1528
|
+
* ```
|
|
1529
|
+
*/
|
|
1530
|
+
highlightMode: PdfHighlightMode;
|
|
1531
|
+
/**
|
|
1532
|
+
* Gets the font of the field.
|
|
1533
|
+
*
|
|
1534
|
+
* @returns {PdfFont} font.
|
|
1535
|
+
*
|
|
1536
|
+
* ```typescript
|
|
1537
|
+
* // Load an existing PDF document
|
|
1538
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1539
|
+
* // Access the form field at index 0
|
|
1540
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1541
|
+
* // Gets the font of the field.
|
|
1542
|
+
* let font: PdfFont = field.font;
|
|
1543
|
+
* // Save the document
|
|
1544
|
+
* document.save('output.pdf');
|
|
1545
|
+
* // Destroy the document
|
|
1546
|
+
* document.destroy();
|
|
1547
|
+
* ```
|
|
1548
|
+
*/
|
|
1549
|
+
/**
|
|
1550
|
+
* Sets the font of the field.
|
|
1551
|
+
*
|
|
1552
|
+
* @param {PdfFont} value font.
|
|
1553
|
+
*
|
|
1554
|
+
* ```typescript
|
|
1555
|
+
* // Load an existing PDF document
|
|
1556
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1557
|
+
* // Access the form field at index 0
|
|
1558
|
+
* let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
|
|
1559
|
+
* // Sets the font of the field
|
|
1560
|
+
* field.font = new PdfStandardFont(PdfFontFamily.helvetica, 12, PdfFontStyle.bold);
|
|
1561
|
+
* // Save the document
|
|
1562
|
+
* document.save('output.pdf');
|
|
1563
|
+
* // Destroy the document
|
|
1564
|
+
* document.destroy();
|
|
1565
|
+
* ```
|
|
1566
|
+
*/
|
|
1567
|
+
font: PdfFont;
|
|
1568
|
+
_assignText(fieldDictionary: _PdfDictionary, value: string): void;
|
|
1569
|
+
/**
|
|
1570
|
+
* Parse an existing button field.
|
|
1571
|
+
*
|
|
1572
|
+
* @private
|
|
1573
|
+
* @param {PdfForm} form Form object.
|
|
1574
|
+
* @param {_PdfDictionary} dictionary Field dictionary.
|
|
1575
|
+
* @param {_PdfCrossReference} crossReference Cross reference object.
|
|
1576
|
+
* @param {_PdfReference} reference Field reference.
|
|
1577
|
+
* @returns {PdfButtonField} Button field.
|
|
1578
|
+
*/
|
|
1579
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfButtonField;
|
|
1580
|
+
_initialize(page: PdfPage, name: string, bounds: {
|
|
1581
|
+
x: number;
|
|
1582
|
+
y: number;
|
|
1583
|
+
width: number;
|
|
1584
|
+
height: number;
|
|
1585
|
+
}): void;
|
|
1586
|
+
_createItem(bounds: {
|
|
1587
|
+
x: number;
|
|
1588
|
+
y: number;
|
|
1589
|
+
width: number;
|
|
1590
|
+
height: number;
|
|
1591
|
+
}): void;
|
|
1592
|
+
_doPostProcess(isFlatten?: boolean): void;
|
|
1593
|
+
_postProcess(isFlatten: boolean, widget?: PdfWidgetAnnotation): void;
|
|
1594
|
+
_createAppearance(widget: PdfWidgetAnnotation | PdfButtonField, isPressed?: boolean): PdfTemplate;
|
|
1595
|
+
_drawButton(g: PdfGraphics, parameter: _PaintParameter, text: string, font: PdfFont, format: PdfStringFormat): void;
|
|
1596
|
+
_drawPressedButton(g: PdfGraphics, parameter: _PaintParameter, text: string, font: PdfFont, format: PdfStringFormat): void;
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* `PdfCheckBoxField` class represents the check box field objects.
|
|
1600
|
+
* ```typescript
|
|
1601
|
+
* // Load an existing PDF document
|
|
1602
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1603
|
+
* // Gets the first page of the document
|
|
1604
|
+
* let page: PdfPage = document.getPage(0);
|
|
1605
|
+
* // Access the PDF form
|
|
1606
|
+
* let form: PdfForm = document.form;
|
|
1607
|
+
* // Create a new check box field
|
|
1608
|
+
* let field: PdfCheckBoxField = new PdfCheckBoxField('CheckBox1', {x: 100, y: 40, width: 20, height: 20}, page);
|
|
1609
|
+
* // Sets the checked flag as true.
|
|
1610
|
+
* field.checked = true;
|
|
1611
|
+
* // Sets the tool tip value
|
|
1612
|
+
* field.toolTip = 'Checked';
|
|
1613
|
+
* // Add the field into PDF form
|
|
1614
|
+
* form.add(field);
|
|
1615
|
+
* // Save the document
|
|
1616
|
+
* document.save('output.pdf');
|
|
1617
|
+
* // Destroy the document
|
|
1618
|
+
* document.destroy();
|
|
1619
|
+
* ```
|
|
1620
|
+
*/
|
|
1621
|
+
export declare class PdfCheckBoxField extends PdfField {
|
|
1622
|
+
_parsedItems: Map<number, PdfStateItem>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Represents a check box field of the PDF document.
|
|
1625
|
+
*
|
|
1626
|
+
* @private
|
|
1627
|
+
*/
|
|
1628
|
+
constructor();
|
|
1629
|
+
/**
|
|
1630
|
+
* Represents a check box field of the PDF document.
|
|
1631
|
+
*
|
|
1632
|
+
* @param {string} name The name of the field.
|
|
1633
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds The bounds of the field.
|
|
1634
|
+
* @param {PdfPage} page The page where the field is drawn.
|
|
1635
|
+
* ```typescript
|
|
1636
|
+
* // Load an existing PDF document
|
|
1637
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1638
|
+
* // Gets the first page of the document
|
|
1639
|
+
* let page: PdfPage = document.getPage(0);
|
|
1640
|
+
* // Access the PDF form
|
|
1641
|
+
* let form: PdfForm = document.form;
|
|
1642
|
+
* // Create a new check box field
|
|
1643
|
+
* let field: PdfCheckBoxField = new PdfCheckBoxField('CheckBox1', {x: 100, y: 40, width: 20, height: 20}, page);
|
|
1644
|
+
* // Sets the checked flag as true.
|
|
1645
|
+
* field.checked = true;
|
|
1646
|
+
* // Sets the tool tip value
|
|
1647
|
+
* field.toolTip = 'Checked';
|
|
1648
|
+
* // Add the field into PDF form
|
|
1649
|
+
* form.add(field);
|
|
1650
|
+
* // Save the document
|
|
1651
|
+
* document.save('output.pdf');
|
|
1652
|
+
* // Destroy the document
|
|
1653
|
+
* document.destroy();
|
|
1654
|
+
* ```
|
|
1655
|
+
*/
|
|
1656
|
+
constructor(name: string, bounds: {
|
|
1657
|
+
x: number;
|
|
1658
|
+
y: number;
|
|
1659
|
+
width: number;
|
|
1660
|
+
height: number;
|
|
1661
|
+
}, page: PdfPage);
|
|
1662
|
+
/**
|
|
1663
|
+
* Parse an existing check box field.
|
|
1664
|
+
*
|
|
1665
|
+
* @private
|
|
1666
|
+
* @param {PdfForm} form Form object.
|
|
1667
|
+
* @param {_PdfDictionary} dictionary Field dictionary.
|
|
1668
|
+
* @param {_PdfCrossReference} crossReference Cross reference object.
|
|
1669
|
+
* @param {_PdfReference} reference Field reference.
|
|
1670
|
+
* @returns {PdfCheckBoxField} Check box field.
|
|
1671
|
+
*/
|
|
1672
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfCheckBoxField;
|
|
1673
|
+
/**
|
|
1674
|
+
* Gets the item at the specified index.
|
|
1675
|
+
*
|
|
1676
|
+
* @param {number} index Index of the field item.
|
|
1677
|
+
* @returns {PdfStateItem} Field item at the index.
|
|
1678
|
+
* ```typescript
|
|
1679
|
+
* // Load an existing PDF document
|
|
1680
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1681
|
+
* // Gets the first page of the document
|
|
1682
|
+
* let page: PdfPage = document.getPage(0);
|
|
1683
|
+
* // Access the PDF form
|
|
1684
|
+
* let form: PdfForm = document.form;
|
|
1685
|
+
* // Access the check box field
|
|
1686
|
+
* let field: PdfCheckBoxField = form.fieldAt(0) as PdfCheckBoxField;
|
|
1687
|
+
* // Gets the first list item.
|
|
1688
|
+
* let item: PdfStateItem = field.itemAt(0);
|
|
1689
|
+
* // Save the document
|
|
1690
|
+
* document.save('output.pdf');
|
|
1691
|
+
* // Destroy the document
|
|
1692
|
+
* document.destroy();
|
|
1693
|
+
* ```
|
|
1694
|
+
*/
|
|
1695
|
+
itemAt(index: number): PdfStateItem;
|
|
1696
|
+
/**
|
|
1697
|
+
* Gets the font of the field.
|
|
1698
|
+
*
|
|
1699
|
+
* @returns {PdfFont} font.
|
|
1700
|
+
*
|
|
1701
|
+
* ```typescript
|
|
1702
|
+
* // Load an existing PDF document
|
|
1703
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1704
|
+
* // Access the form field at index 0
|
|
1705
|
+
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
|
|
1706
|
+
* // Gets the font of the field.
|
|
1707
|
+
* let font: PdfFont = field.font;
|
|
1708
|
+
* // Save the document
|
|
1709
|
+
* document.save('output.pdf');
|
|
1710
|
+
* // Destroy the document
|
|
1711
|
+
* document.destroy();
|
|
1712
|
+
* ```
|
|
1713
|
+
*/
|
|
1714
|
+
/**
|
|
1715
|
+
* Sets the font of the field.
|
|
1716
|
+
*
|
|
1717
|
+
* @param {PdfFont} value font.
|
|
1718
|
+
*
|
|
1719
|
+
* ```typescript
|
|
1720
|
+
* // Load an existing PDF document
|
|
1721
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1722
|
+
* // Access the form field at index 0
|
|
1723
|
+
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
|
|
1724
|
+
* // Sets the font of the field
|
|
1725
|
+
* field.font = new PdfStandardFont(PdfFontFamily.helvetica, 12, PdfFontStyle.bold);
|
|
1726
|
+
* // Save the document
|
|
1727
|
+
* document.save('output.pdf');
|
|
1728
|
+
* // Destroy the document
|
|
1729
|
+
* document.destroy();
|
|
1730
|
+
* ```
|
|
1731
|
+
*/
|
|
1732
|
+
font: PdfFont;
|
|
1733
|
+
/**
|
|
1734
|
+
* Gets the flag indicating whether the field is checked or not.
|
|
1735
|
+
*
|
|
1736
|
+
* @returns {boolean} Checked.
|
|
1737
|
+
* ```typescript
|
|
1738
|
+
* // Load an existing PDF document
|
|
1739
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1740
|
+
* // Gets the first page of the document
|
|
1741
|
+
* let page: PdfPage = document.getPage(0);
|
|
1742
|
+
* // Access the PDF form
|
|
1743
|
+
* let form: PdfForm = document.form;
|
|
1744
|
+
* // Access the check box field
|
|
1745
|
+
* let field: PdfCheckBoxField = form.fieldAt(0) as PdfCheckBoxField;
|
|
1746
|
+
* // Gets the flag indicating whether the field is checked or not.
|
|
1747
|
+
* let checked: Boolean = field.checked;
|
|
1748
|
+
* // Save the document
|
|
1749
|
+
* document.save('output.pdf');
|
|
1750
|
+
* // Destroy the document
|
|
1751
|
+
* document.destroy();
|
|
1752
|
+
* ```
|
|
1753
|
+
*/
|
|
1754
|
+
/**
|
|
1755
|
+
* Sets the flag indicating whether the field is checked or not.
|
|
1756
|
+
*
|
|
1757
|
+
* @param {boolean} value Checked.
|
|
1758
|
+
* ```typescript
|
|
1759
|
+
* // Load an existing PDF document
|
|
1760
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1761
|
+
* // Gets the first page of the document
|
|
1762
|
+
* let page: PdfPage = document.getPage(0);
|
|
1763
|
+
* // Access the PDF form
|
|
1764
|
+
* let form: PdfForm = document.form;
|
|
1765
|
+
* // Access the check box field
|
|
1766
|
+
* let field: PdfCheckBoxField = form.fieldAt(0) as PdfCheckBoxField;
|
|
1767
|
+
* // Sets the flag indicating whether the field is checked or not.
|
|
1768
|
+
* field.checked = true;
|
|
1769
|
+
* // Save the document
|
|
1770
|
+
* document.save('output.pdf');
|
|
1771
|
+
* // Destroy the document
|
|
1772
|
+
* document.destroy();
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
checked: boolean;
|
|
1776
|
+
/**
|
|
1777
|
+
* Gets the text alignment in a check box field.
|
|
1778
|
+
*
|
|
1779
|
+
* @returns {PdfTextAlignment} Text alignment.
|
|
1780
|
+
*
|
|
1781
|
+
* ```typescript
|
|
1782
|
+
* // Load an existing PDF document
|
|
1783
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1784
|
+
* // Access check box field
|
|
1785
|
+
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
|
|
1786
|
+
* // Gets the text alignment from check box field
|
|
1787
|
+
* let alignment: PdfTextAlignment = field.textAlignment;
|
|
1788
|
+
* // Save the document
|
|
1789
|
+
* document.save('output.pdf');
|
|
1790
|
+
* // Destroy the document
|
|
1791
|
+
* document.destroy();
|
|
1792
|
+
* ```
|
|
1793
|
+
*/
|
|
1794
|
+
/**
|
|
1795
|
+
* Sets the text alignment in a check box field.
|
|
1796
|
+
*
|
|
1797
|
+
* @param {PdfTextAlignment} value Text alignment.
|
|
1798
|
+
*
|
|
1799
|
+
* ```typescript
|
|
1800
|
+
* // Load an existing PDF document
|
|
1801
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1802
|
+
* // Access check box field
|
|
1803
|
+
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
|
|
1804
|
+
* // Sets the text alignment of form field as center
|
|
1805
|
+
* field.textAlignment = PdfTextAlignment.center;
|
|
1806
|
+
* // Save the document
|
|
1807
|
+
* document.save('output.pdf');
|
|
1808
|
+
* // Destroy the document
|
|
1809
|
+
* document.destroy();
|
|
1810
|
+
* ```
|
|
1811
|
+
*/
|
|
1812
|
+
textAlignment: PdfTextAlignment;
|
|
1813
|
+
_initialize(page: PdfPage, name: string, bounds: {
|
|
1814
|
+
x: number;
|
|
1815
|
+
y: number;
|
|
1816
|
+
width: number;
|
|
1817
|
+
height: number;
|
|
1818
|
+
}): void;
|
|
1819
|
+
_createItem(bounds: {
|
|
1820
|
+
x: number;
|
|
1821
|
+
y: number;
|
|
1822
|
+
width: number;
|
|
1823
|
+
height: number;
|
|
1824
|
+
}): void;
|
|
1825
|
+
_doPostProcess(isFlatten?: boolean): void;
|
|
1826
|
+
_createAppearance(widget: PdfStateItem, state: _PdfCheckFieldState): PdfTemplate;
|
|
1827
|
+
_drawAppearance(item: PdfStateItem): void;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* `PdfRadioButtonListField` class represents the radio button field objects.
|
|
1831
|
+
* ```typescript
|
|
1832
|
+
* // Load an existing PDF document
|
|
1833
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1834
|
+
* // Gets the first page of the document
|
|
1835
|
+
* let page: PdfPage = document.getPage(0);
|
|
1836
|
+
* // Access the PDF form
|
|
1837
|
+
* let form: PdfForm = document.form;
|
|
1838
|
+
* // Create a new radio button list field
|
|
1839
|
+
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
|
|
1840
|
+
* // Create and add first item
|
|
1841
|
+
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
|
|
1842
|
+
* // Create and add second item
|
|
1843
|
+
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
|
|
1844
|
+
* field.add(second);
|
|
1845
|
+
* // Sets selected index of the radio button list field
|
|
1846
|
+
* field.selectedIndex = 0;
|
|
1847
|
+
* // Add the field into PDF form
|
|
1848
|
+
* form.add(field);
|
|
1849
|
+
* // Save the document
|
|
1850
|
+
* document.save('output.pdf');
|
|
1851
|
+
* // Destroy the document
|
|
1852
|
+
* document.destroy();
|
|
1853
|
+
* ```
|
|
1854
|
+
*/
|
|
1855
|
+
export declare class PdfRadioButtonListField extends PdfField {
|
|
1856
|
+
_parsedItems: Map<number, PdfRadioButtonListItem>;
|
|
1857
|
+
_selectedIndex: number;
|
|
1858
|
+
/**
|
|
1859
|
+
* Represents a radio button list field of the PDF document.
|
|
1860
|
+
*
|
|
1861
|
+
* @private
|
|
1862
|
+
*/
|
|
1863
|
+
constructor();
|
|
1864
|
+
/**
|
|
1865
|
+
* Represents a radio button list field of the PDF document.
|
|
1866
|
+
*
|
|
1867
|
+
* @param {PdfPage} page The page where the field is drawn.
|
|
1868
|
+
* @param {string} name The name of the field.
|
|
1869
|
+
* ```typescript
|
|
1870
|
+
* // Load an existing PDF document
|
|
1871
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1872
|
+
* // Gets the first page of the document
|
|
1873
|
+
* let page: PdfPage = document.getPage(0);
|
|
1874
|
+
* // Access the PDF form
|
|
1875
|
+
* let form: PdfForm = document.form;
|
|
1876
|
+
* // Create a new radio button list field
|
|
1877
|
+
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
|
|
1878
|
+
* // Create and add first item
|
|
1879
|
+
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
|
|
1880
|
+
* // Create and add second item
|
|
1881
|
+
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
|
|
1882
|
+
* field.add(second);
|
|
1883
|
+
* // Sets selected index of the radio button list field
|
|
1884
|
+
* field.selectedIndex = 0;
|
|
1885
|
+
* // Add the field into PDF form
|
|
1886
|
+
* form.add(field);
|
|
1887
|
+
* // Save the document
|
|
1888
|
+
* document.save('output.pdf');
|
|
1889
|
+
* // Destroy the document
|
|
1890
|
+
* document.destroy();
|
|
1891
|
+
* ```
|
|
1892
|
+
*/
|
|
1893
|
+
constructor(page: PdfPage, name: string);
|
|
1894
|
+
/**
|
|
1895
|
+
* Parse an existing radio button list field.
|
|
1896
|
+
*
|
|
1897
|
+
* @private
|
|
1898
|
+
* @param {PdfForm} form Form object.
|
|
1899
|
+
* @param {_PdfDictionary} dictionary Field dictionary.
|
|
1900
|
+
* @param {_PdfCrossReference} crossReference Cross reference object.
|
|
1901
|
+
* @param {_PdfReference} reference Field reference.
|
|
1902
|
+
* @returns {PdfRadioButtonListField} Radio button list field.
|
|
1903
|
+
*/
|
|
1904
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfRadioButtonListField;
|
|
1905
|
+
/**
|
|
1906
|
+
* Gets the flag indicating whether the field is checked or not (Read only).
|
|
1907
|
+
*
|
|
1908
|
+
* @returns {boolean} Checked.
|
|
1909
|
+
* ```typescript
|
|
1910
|
+
* // Load an existing PDF document
|
|
1911
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1912
|
+
* // Gets the first page of the document
|
|
1913
|
+
* let page: PdfPage = document.getPage(0);
|
|
1914
|
+
* // Access the PDF form
|
|
1915
|
+
* let form: PdfForm = document.form;
|
|
1916
|
+
* // Access the radio button list field
|
|
1917
|
+
* let field: PdfRadioButtonListField = form.fieldAt(0) as PdfRadioButtonListField;
|
|
1918
|
+
* // Gets the flag indicating whether the field is checked or not.
|
|
1919
|
+
* let checked: boolean = field.checked;
|
|
1920
|
+
* // Save the document
|
|
1921
|
+
* document.save('output.pdf');
|
|
1922
|
+
* // Destroy the document
|
|
1923
|
+
* document.destroy();
|
|
1924
|
+
* ```
|
|
1925
|
+
*/
|
|
1926
|
+
readonly checked: boolean;
|
|
1927
|
+
/**
|
|
1928
|
+
* Gets the selected item index.
|
|
1929
|
+
*
|
|
1930
|
+
* @returns {number} Index.
|
|
1931
|
+
* ```typescript
|
|
1932
|
+
* // Load an existing PDF document
|
|
1933
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1934
|
+
* // Gets the first page of the document
|
|
1935
|
+
* let page: PdfPage = document.getPage(0);
|
|
1936
|
+
* // Access the PDF form
|
|
1937
|
+
* let form: PdfForm = document.form;
|
|
1938
|
+
* // Access the radio button list field
|
|
1939
|
+
* let field: PdfRadioButtonListField = form.fieldAt(0) as PdfRadioButtonListField;
|
|
1940
|
+
* // Gets the selected index.
|
|
1941
|
+
* let index: number = field.selectedIndex;
|
|
1942
|
+
* // Save the document
|
|
1943
|
+
* document.save('output.pdf');
|
|
1944
|
+
* // Destroy the document
|
|
1945
|
+
* document.destroy();
|
|
1946
|
+
* ```
|
|
1947
|
+
*/
|
|
1948
|
+
/**
|
|
1949
|
+
* Sets the selected item index.
|
|
1950
|
+
*
|
|
1951
|
+
* @param {number} value Selected index.
|
|
1952
|
+
* ```typescript
|
|
1953
|
+
* // Load an existing PDF document
|
|
1954
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1955
|
+
* // Gets the first page of the document
|
|
1956
|
+
* let page: PdfPage = document.getPage(0);
|
|
1957
|
+
* // Access the PDF form
|
|
1958
|
+
* let form: PdfForm = document.form;
|
|
1959
|
+
* // Create a new radio button list field
|
|
1960
|
+
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
|
|
1961
|
+
* // Create and add first item
|
|
1962
|
+
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
|
|
1963
|
+
* // Create and add second item
|
|
1964
|
+
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
|
|
1965
|
+
* field.add(second);
|
|
1966
|
+
* // Sets selected index of the radio button list field
|
|
1967
|
+
* field.selectedIndex = 0;
|
|
1968
|
+
* // Add the field into PDF form
|
|
1969
|
+
* form.add(field);
|
|
1970
|
+
* // Save the document
|
|
1971
|
+
* document.save('output.pdf');
|
|
1972
|
+
* // Destroy the document
|
|
1973
|
+
* document.destroy();
|
|
1974
|
+
* ```
|
|
1975
|
+
*/
|
|
1976
|
+
selectedIndex: number;
|
|
1977
|
+
/**
|
|
1978
|
+
* Gets the item at the specified index.
|
|
1979
|
+
*
|
|
1980
|
+
* @param {number} index Index of the field item.
|
|
1981
|
+
* @returns {PdfRadioButtonListItem} Field item at the index.
|
|
1982
|
+
* ```typescript
|
|
1983
|
+
* // Load an existing PDF document
|
|
1984
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
1985
|
+
* // Gets the first page of the document
|
|
1986
|
+
* let page: PdfPage = document.getPage(0);
|
|
1987
|
+
* // Access the PDF form
|
|
1988
|
+
* let form: PdfForm = document.form;
|
|
1989
|
+
* // Access the radio button list field
|
|
1990
|
+
* let field: PdfRadioButtonListField = form.fieldAt(0) as PdfRadioButtonListField;
|
|
1991
|
+
* // Gets the first list item.
|
|
1992
|
+
* let item: PdfRadioButtonListField = field.itemAt(0);
|
|
1993
|
+
* // Save the document
|
|
1994
|
+
* document.save('output.pdf');
|
|
1995
|
+
* // Destroy the document
|
|
1996
|
+
* document.destroy();
|
|
1997
|
+
* ```
|
|
1998
|
+
*/
|
|
1999
|
+
itemAt(index: number): PdfRadioButtonListItem;
|
|
2000
|
+
/**
|
|
2001
|
+
* Add list item to the field.
|
|
2002
|
+
*
|
|
2003
|
+
* @param {PdfRadioButtonListItem} item List item.
|
|
2004
|
+
* @returns {number} Index of the added item.
|
|
2005
|
+
* ```typescript
|
|
2006
|
+
* // Load an existing PDF document
|
|
2007
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2008
|
+
* // Gets the first page of the document
|
|
2009
|
+
* let page: PdfPage = document.getPage(0);
|
|
2010
|
+
* // Access the PDF form
|
|
2011
|
+
* let form: PdfForm = document.form;
|
|
2012
|
+
* // Create a new radio button list field
|
|
2013
|
+
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
|
|
2014
|
+
* // Create and add first item
|
|
2015
|
+
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
|
|
2016
|
+
* // Create and add second item
|
|
2017
|
+
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
|
|
2018
|
+
* Add list item to the field
|
|
2019
|
+
* field.add(second);
|
|
2020
|
+
* // Sets selected index of the radio button list field
|
|
2021
|
+
* field.selectedIndex = 0;
|
|
2022
|
+
* // Add the field into PDF form
|
|
2023
|
+
* form.add(field);
|
|
2024
|
+
* // Save the document
|
|
2025
|
+
* document.save('output.pdf');
|
|
2026
|
+
* // Destroy the document
|
|
2027
|
+
* document.destroy();
|
|
2028
|
+
* ```
|
|
2029
|
+
*/
|
|
2030
|
+
add(item: PdfRadioButtonListItem): number;
|
|
2031
|
+
/**
|
|
2032
|
+
* Add list item to the field.
|
|
2033
|
+
*
|
|
2034
|
+
* @param {string} value Name of the list item.
|
|
2035
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds Bounds of the list item.
|
|
2036
|
+
* @returns {PdfRadioButtonListItem} Added item.
|
|
2037
|
+
* ```typescript
|
|
2038
|
+
* // Load an existing PDF document
|
|
2039
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2040
|
+
* // Gets the first page of the document
|
|
2041
|
+
* let page: PdfPage = document.getPage(0);
|
|
2042
|
+
* // Access the PDF form
|
|
2043
|
+
* let form: PdfForm = document.form;
|
|
2044
|
+
* // Create a new radio button list field
|
|
2045
|
+
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
|
|
2046
|
+
* // Create and add first item
|
|
2047
|
+
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
|
|
2048
|
+
* // Create and add second item
|
|
2049
|
+
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
|
|
2050
|
+
* Add list item to the field
|
|
2051
|
+
* field.add(second);
|
|
2052
|
+
* // Sets selected index of the radio button list field
|
|
2053
|
+
* field.selectedIndex = 0;
|
|
2054
|
+
* // Add the field into PDF form
|
|
2055
|
+
* form.add(field);
|
|
2056
|
+
* // Save the document
|
|
2057
|
+
* document.save('output.pdf');
|
|
2058
|
+
* // Destroy the document
|
|
2059
|
+
* document.destroy();
|
|
2060
|
+
* ```
|
|
2061
|
+
*/
|
|
2062
|
+
add(value: string, bounds: {
|
|
2063
|
+
x: number;
|
|
2064
|
+
y: number;
|
|
2065
|
+
width: number;
|
|
2066
|
+
height: number;
|
|
2067
|
+
}): PdfRadioButtonListItem;
|
|
2068
|
+
/**
|
|
2069
|
+
* Remove the radio button list item from the specified index.
|
|
2070
|
+
*
|
|
2071
|
+
* @param {number} index Item index to remove.
|
|
2072
|
+
* @returns {void} Nothing.
|
|
2073
|
+
*
|
|
2074
|
+
* ```typescript
|
|
2075
|
+
* // Load an existing PDF document
|
|
2076
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2077
|
+
* // Access the form field at index 0
|
|
2078
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
2079
|
+
* // Remove the first item of the form field
|
|
2080
|
+
* field.removeItemAt(0);
|
|
2081
|
+
* // Save the document
|
|
2082
|
+
* document.save('output.pdf');
|
|
2083
|
+
* // Destroy the document
|
|
2084
|
+
* document.destroy();
|
|
2085
|
+
* ```
|
|
2086
|
+
*/
|
|
2087
|
+
removeItemAt(index: number): void;
|
|
2088
|
+
/**
|
|
2089
|
+
* Remove the specified radio button list field item.
|
|
2090
|
+
*
|
|
2091
|
+
* @param {PdfRadioButtonListItem} item Item to remove.
|
|
2092
|
+
* @returns {void} Nothing.
|
|
2093
|
+
*
|
|
2094
|
+
* ```typescript
|
|
2095
|
+
* // Load an existing PDF document
|
|
2096
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2097
|
+
* // Access the form field at index 0
|
|
2098
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
2099
|
+
* // Remove the first item of the form field
|
|
2100
|
+
* field.removeItem(field.itemAt(0));
|
|
2101
|
+
* // Save the document
|
|
2102
|
+
* document.save('output.pdf');
|
|
2103
|
+
* // Destroy the document
|
|
2104
|
+
* document.destroy();
|
|
2105
|
+
* ```
|
|
2106
|
+
*/
|
|
2107
|
+
removeItem(item: PdfRadioButtonListItem): void;
|
|
2108
|
+
_initialize(page: PdfPage, name: string): void;
|
|
2109
|
+
_retrieveOptionValue(): void;
|
|
2110
|
+
_obtainSelectedIndex(): number;
|
|
2111
|
+
_doPostProcess(isFlatten?: boolean): void;
|
|
2112
|
+
_createAppearance(widget: PdfRadioButtonListItem, state: _PdfCheckFieldState): PdfTemplate;
|
|
2113
|
+
_drawAppearance(item: PdfRadioButtonListItem): void;
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Represents the base class for list box and combo box fields.
|
|
2117
|
+
*
|
|
2118
|
+
* ```typescript
|
|
2119
|
+
* // Load an existing PDF document
|
|
2120
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2121
|
+
* // Gets the first page of the document
|
|
2122
|
+
* let page: PdfPage = document.getPage(0);
|
|
2123
|
+
* // Access the PDF form
|
|
2124
|
+
* let form: PdfForm = document.form;
|
|
2125
|
+
* // Access the combo box field
|
|
2126
|
+
* let comboBoxField: PdfListField = form.fieldAt(0) as PdfListField;
|
|
2127
|
+
* // Gets the count of the loaded combo box field items.
|
|
2128
|
+
* let comboItemsCount: number = comboBoxField.itemsCount;
|
|
2129
|
+
* // Access the list box field
|
|
2130
|
+
* let listBoxField: PdfListField = form.fieldAt(1) as PdfListField;
|
|
2131
|
+
* // Gets the count of the loaded list box field items.
|
|
2132
|
+
* let ListItemsCount: number = listBoxField.itemsCount;
|
|
2133
|
+
* // Save the document
|
|
2134
|
+
* document.save('output.pdf');
|
|
2135
|
+
* // Destroy the document
|
|
2136
|
+
* document.destroy();
|
|
2137
|
+
* ```
|
|
2138
|
+
*/
|
|
2139
|
+
export declare abstract class PdfListField extends PdfField {
|
|
2140
|
+
_optionArray: Array<string[]>;
|
|
2141
|
+
_parsedItems: Map<number, PdfListFieldItem>;
|
|
2142
|
+
_listValues: string[];
|
|
2143
|
+
_selectedIndex: number;
|
|
2144
|
+
_multiSelect: boolean;
|
|
2145
|
+
_editable: boolean;
|
|
2146
|
+
_widgetAnnot: PdfWidgetAnnotation;
|
|
2147
|
+
_bounds: {
|
|
2148
|
+
x: number;
|
|
2149
|
+
y: number;
|
|
2150
|
+
width: number;
|
|
2151
|
+
height: number;
|
|
2152
|
+
};
|
|
2153
|
+
/**
|
|
2154
|
+
* Gets the count of the loaded field items (Read only).
|
|
2155
|
+
*
|
|
2156
|
+
* @returns {number} Items count.
|
|
2157
|
+
* ```typescript
|
|
2158
|
+
* // Load an existing PDF document
|
|
2159
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2160
|
+
* // Gets the first page of the document
|
|
2161
|
+
* let page: PdfPage = document.getPage(0);
|
|
2162
|
+
* // Access the PDF form
|
|
2163
|
+
* let form: PdfForm = document.form;
|
|
2164
|
+
* // Access the combo box field
|
|
2165
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(0) as PdfComboBoxField;
|
|
2166
|
+
* // Gets the count of the loaded combo box field items.
|
|
2167
|
+
* let comboItemsCount: number = comboBoxField.itemsCount;
|
|
2168
|
+
* // Access the list box field
|
|
2169
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(1) as PdfListBoxField;
|
|
2170
|
+
* // Gets the count of the loaded list box field items.
|
|
2171
|
+
* let ListItemsCount: number = listBoxField.itemsCount;
|
|
2172
|
+
* // Save the document
|
|
2173
|
+
* document.save('output.pdf');
|
|
2174
|
+
* // Destroy the document
|
|
2175
|
+
* document.destroy();
|
|
2176
|
+
* ```
|
|
2177
|
+
*/
|
|
2178
|
+
readonly itemsCount: number;
|
|
2179
|
+
/**
|
|
2180
|
+
* Gets the bounds.
|
|
2181
|
+
*
|
|
2182
|
+
* @returns {{ x: number, y: number, width: number, height: number }} Bounds.
|
|
2183
|
+
* ```typescript
|
|
2184
|
+
* // Load an existing PDF document
|
|
2185
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2186
|
+
* // Gets the first page of the document
|
|
2187
|
+
* let page: PdfPage = document.getPage(0);
|
|
2188
|
+
* // Access the PDF form
|
|
2189
|
+
* let form: PdfForm = document.form;
|
|
2190
|
+
* // Access the combo box field
|
|
2191
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(0) as PdfComboBoxField;
|
|
2192
|
+
* // Gets the bounds of combo box field.
|
|
2193
|
+
* let comboBoxBounds: {x: number, y: number, width: number, height: number} = comboBoxField.bounds;
|
|
2194
|
+
* // Access the combo box field
|
|
2195
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(1) as PdfListBoxField;
|
|
2196
|
+
* // Gets the bounds of list box field.
|
|
2197
|
+
* let listBoxBounds: {x: number, y: number, width: number, height: number} = listBoxField.bounds;
|
|
2198
|
+
* // Save the document
|
|
2199
|
+
* document.save('output.pdf');
|
|
2200
|
+
* // Destroy the document
|
|
2201
|
+
* document.destroy();
|
|
2202
|
+
* ```
|
|
2203
|
+
*/
|
|
2204
|
+
/**
|
|
2205
|
+
* Sets the bounds.
|
|
2206
|
+
*
|
|
2207
|
+
* @param {{ x: number, y: number, width: number, height: number }} value bounds.
|
|
2208
|
+
* ```typescript
|
|
2209
|
+
* // Load an existing PDF document
|
|
2210
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2211
|
+
* // Gets the first page of the document
|
|
2212
|
+
* let page: PdfPage = document.getPage(0);
|
|
2213
|
+
* // Access the PDF form
|
|
2214
|
+
* let form: PdfForm = document.form;
|
|
2215
|
+
* // Access the combo box field
|
|
2216
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(0) as PdfComboBoxField;
|
|
2217
|
+
* // Sets the bounds of combo box field.
|
|
2218
|
+
* comboBoxField.bounds = {x: 10, y: 10, width: 100, height: 30};
|
|
2219
|
+
* // Access the list box field
|
|
2220
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(1) as PdfListBoxField;
|
|
2221
|
+
* // Sets the bounds of list box field.
|
|
2222
|
+
* listBoxField.bounds = {x: 10, y: 50, width: 100, height: 30};
|
|
2223
|
+
* // Save the document
|
|
2224
|
+
* document.save('output.pdf');
|
|
2225
|
+
* // Destroy the document
|
|
2226
|
+
* document.destroy();
|
|
2227
|
+
* ```
|
|
2228
|
+
*/
|
|
2229
|
+
bounds: {
|
|
2230
|
+
x: number;
|
|
2231
|
+
y: number;
|
|
2232
|
+
width: number;
|
|
2233
|
+
height: number;
|
|
2234
|
+
};
|
|
2235
|
+
/**
|
|
2236
|
+
* Gets the selected item index or indexes.
|
|
2237
|
+
*
|
|
2238
|
+
* @returns {number | number[]} Index.
|
|
2239
|
+
* ```typescript
|
|
2240
|
+
* // Load an existing PDF document
|
|
2241
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2242
|
+
* // Gets the first page of the document
|
|
2243
|
+
* let page: PdfPage = document.getPage(0);
|
|
2244
|
+
* // Access the PDF form
|
|
2245
|
+
* let form: PdfForm = document.form;
|
|
2246
|
+
* // Access the combo box field
|
|
2247
|
+
* let comboBoxfield: PdfComboBoxField = form.fieldAt(0) as PdfComboBoxField;
|
|
2248
|
+
* // Gets the selected item index or indexes from combo box field.
|
|
2249
|
+
* let comboBoxIndex: number = comboBoxfield.selectedIndex;
|
|
2250
|
+
* // Access the list box field
|
|
2251
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(1) as PdfListBoxField;
|
|
2252
|
+
* // Gets the selected item index or indexes from list box field.
|
|
2253
|
+
* let listBoxIndex: number = listBoxField.selectedIndex;
|
|
2254
|
+
* // Save the document
|
|
2255
|
+
* document.save('output.pdf');
|
|
2256
|
+
* // Destroy the document
|
|
2257
|
+
* document.destroy();
|
|
2258
|
+
* ```
|
|
2259
|
+
*/
|
|
2260
|
+
/**
|
|
2261
|
+
* Sets the selected item index or indexes.
|
|
2262
|
+
*
|
|
2263
|
+
* @param {number | number[]} value Selected index.
|
|
2264
|
+
* ```typescript
|
|
2265
|
+
* // Load an existing PDF document
|
|
2266
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2267
|
+
* // Gets the first page of the document
|
|
2268
|
+
* let page: PdfPage = document.getPage(0);
|
|
2269
|
+
* // Access the PDF form
|
|
2270
|
+
* let form: PdfForm = document.form;
|
|
2271
|
+
* // Create a new list box field
|
|
2272
|
+
* let listField: PdfListField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2273
|
+
* // Add list items to the field.
|
|
2274
|
+
* listField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2275
|
+
* listField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2276
|
+
* listField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2277
|
+
* // Sets the selected index
|
|
2278
|
+
* listField.selectedIndex = 2;
|
|
2279
|
+
* // Sets the flag indicates whether the list box allows multiple selections.
|
|
2280
|
+
* listField.multiSelect = true;
|
|
2281
|
+
* // Add the field into PDF form
|
|
2282
|
+
* form.add(listField);
|
|
2283
|
+
* // Create a new combo box field
|
|
2284
|
+
* let comboField: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 160, width: 100, height: 50});
|
|
2285
|
+
* // Add list items to the field.
|
|
2286
|
+
* comboField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2287
|
+
* comboField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2288
|
+
* comboField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2289
|
+
* // Sets the selected index
|
|
2290
|
+
* comboField.selectedIndex = 2;
|
|
2291
|
+
* // Sets the flag indicates whether the combo box allows multiple selections.
|
|
2292
|
+
* comboField.multiSelect = true;
|
|
2293
|
+
* // Add the field into PDF form
|
|
2294
|
+
* form.add(comboField);
|
|
2295
|
+
* // Save the document
|
|
2296
|
+
* document.save('output.pdf');
|
|
2297
|
+
* // Destroy the document
|
|
2298
|
+
* document.destroy();
|
|
2299
|
+
* ```
|
|
2300
|
+
*/
|
|
2301
|
+
selectedIndex: number | number[];
|
|
2302
|
+
/**
|
|
2303
|
+
* Gets the selected item value or values.
|
|
2304
|
+
*
|
|
2305
|
+
* @returns {string | string[]} Selected values.
|
|
2306
|
+
* ```typescript
|
|
2307
|
+
* // Load an existing PDF document
|
|
2308
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2309
|
+
* // Gets the first page of the document
|
|
2310
|
+
* let page: PdfPage = document.getPage(0);
|
|
2311
|
+
* // Access the PDF form
|
|
2312
|
+
* let form: PdfForm = document.form;
|
|
2313
|
+
* // Access the list box field
|
|
2314
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
|
|
2315
|
+
* // Gets the selected item value or values from list box field.
|
|
2316
|
+
* if (listBoxField.multiSelect) {
|
|
2317
|
+
* let listBoxValues: string[]; = listBoxField.selectedValue;
|
|
2318
|
+
* } else {
|
|
2319
|
+
* let listBoxValues: string = listBoxField.selectedValue;
|
|
2320
|
+
* }
|
|
2321
|
+
* // Save the document
|
|
2322
|
+
* document.save('output.pdf');
|
|
2323
|
+
* // Destroy the document
|
|
2324
|
+
* document.destroy();
|
|
2325
|
+
* ```
|
|
2326
|
+
*/
|
|
2327
|
+
/**
|
|
2328
|
+
* Sets the selected item value or values.
|
|
2329
|
+
*
|
|
2330
|
+
* @param {string | string[]} value Selected values.
|
|
2331
|
+
* ```typescript
|
|
2332
|
+
* // Load an existing PDF document
|
|
2333
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2334
|
+
* // Gets the first page of the document
|
|
2335
|
+
* let page: PdfPage = document.getPage(0);
|
|
2336
|
+
* // Access the PDF form
|
|
2337
|
+
* let form: PdfForm = document.form;
|
|
2338
|
+
* // Create a new list box field
|
|
2339
|
+
* let listField: PdfListField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2340
|
+
* // Add list items to the field.
|
|
2341
|
+
* listField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2342
|
+
* listField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2343
|
+
* listField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2344
|
+
* // Sets the flag indicates whether the list box allows multiple selections.
|
|
2345
|
+
* listField.multiSelect = true;
|
|
2346
|
+
* // Sets the selected values
|
|
2347
|
+
* listField.selectedValue = ['English', 'German'];
|
|
2348
|
+
* // Add the field into PDF form
|
|
2349
|
+
* form.add(listField);
|
|
2350
|
+
* // Create a new combo box field
|
|
2351
|
+
* let comboField: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 160, width: 100, height: 50});
|
|
2352
|
+
* // Add list items to the field.
|
|
2353
|
+
* comboField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2354
|
+
* comboField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2355
|
+
* comboField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2356
|
+
* // Sets the selected value
|
|
2357
|
+
* comboField.selectedValue = ['French'];
|
|
2358
|
+
* // Add the field into PDF form
|
|
2359
|
+
* form.add(comboField);
|
|
2360
|
+
* // Save the document
|
|
2361
|
+
* document.save('output.pdf');
|
|
2362
|
+
* // Destroy the document
|
|
2363
|
+
* document.destroy();
|
|
2364
|
+
* ```
|
|
2365
|
+
*/
|
|
2366
|
+
selectedValue: string | string[];
|
|
2367
|
+
/**
|
|
2368
|
+
* Gets the flag indicates whether the list field allows multiple selections.
|
|
2369
|
+
*
|
|
2370
|
+
* @returns {boolean} Value indicates whether the list field allows multiple selections.
|
|
2371
|
+
* ```typescript
|
|
2372
|
+
* // Load an existing PDF document
|
|
2373
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2374
|
+
* // Gets the first page of the document
|
|
2375
|
+
* let page: PdfPage = document.getPage(0);
|
|
2376
|
+
* // Access the PDF form
|
|
2377
|
+
* let form: PdfForm = document.form;
|
|
2378
|
+
* // Access the combo box field
|
|
2379
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(0) as PdfComboBoxField;
|
|
2380
|
+
* // Gets the flag indicates whether the combo box allows multiple selections.
|
|
2381
|
+
* let comboBoxFlag: Boolean = comboBoxField.multiSelect;
|
|
2382
|
+
* // Access the list box field
|
|
2383
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(1) as PdfListBoxField;
|
|
2384
|
+
* // Gets the flag indicates whether the list box allows multiple selections.
|
|
2385
|
+
* let listBoxFlag: boolean = listBoxField.multiSelect;
|
|
2386
|
+
* // Save the document
|
|
2387
|
+
* document.save('output.pdf');
|
|
2388
|
+
* // Destroy the document
|
|
2389
|
+
* document.destroy();
|
|
2390
|
+
* ```
|
|
2391
|
+
*/
|
|
2392
|
+
/**
|
|
2393
|
+
* Sets the flag indicates whether the list field allows multiple selections.
|
|
2394
|
+
*
|
|
2395
|
+
* @param {boolean} value Indicates whether the list field allows multiple selections.
|
|
2396
|
+
* ```typescript
|
|
2397
|
+
* // Load an existing PDF document
|
|
2398
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2399
|
+
* // Gets the first page of the document
|
|
2400
|
+
* let page: PdfPage = document.getPage(0);
|
|
2401
|
+
* // Access the PDF form
|
|
2402
|
+
* let form: PdfForm = document.form;
|
|
2403
|
+
* // Create a new list box field
|
|
2404
|
+
* let listField: PdfListField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2405
|
+
* // Add list items to the field.
|
|
2406
|
+
* listField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2407
|
+
* listField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2408
|
+
* listField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2409
|
+
* // Sets the selected index
|
|
2410
|
+
* listField.selectedIndex = 2;
|
|
2411
|
+
* // Sets the flag indicates whether the list box allows multiple selections.
|
|
2412
|
+
* listField.multiSelect = true;
|
|
2413
|
+
* // Add the field into PDF form
|
|
2414
|
+
* form.add(listField);
|
|
2415
|
+
* // Create a new combo box field
|
|
2416
|
+
* let comboField: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 160, width: 100, height: 50});
|
|
2417
|
+
* // Add list items to the field.
|
|
2418
|
+
* comboField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2419
|
+
* comboField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2420
|
+
* comboField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2421
|
+
* // Sets the selected index
|
|
2422
|
+
* comboField.selectedIndex = 2;
|
|
2423
|
+
* // Sets the flag indicates whether the combo box allows multiple selections.
|
|
2424
|
+
* comboField.multiSelect = true;
|
|
2425
|
+
* // Add the field into PDF form
|
|
2426
|
+
* form.add(comboField);
|
|
2427
|
+
* // Save the document
|
|
2428
|
+
* document.save('output.pdf');
|
|
2429
|
+
* // Destroy the document
|
|
2430
|
+
* document.destroy();
|
|
2431
|
+
* ```
|
|
2432
|
+
*/
|
|
2433
|
+
multiSelect: boolean;
|
|
2434
|
+
/**
|
|
2435
|
+
* Gets the flag indicates whether the list field is editable.
|
|
2436
|
+
*
|
|
2437
|
+
* @returns {boolean} Value indicates whether the list field is editable.
|
|
2438
|
+
* ```typescript
|
|
2439
|
+
* // Load an existing PDF document
|
|
2440
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2441
|
+
* // Gets the first page of the document
|
|
2442
|
+
* let page: PdfPage = document.getPage(0);
|
|
2443
|
+
* // Access the PDF form
|
|
2444
|
+
* let form: PdfForm = document.form;
|
|
2445
|
+
* // Access the combo box field
|
|
2446
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(0) as PdfComboBoxField;
|
|
2447
|
+
* // Gets the flag indicates whether the combo box is editable.
|
|
2448
|
+
* let comboBoxFlag: Boolean = comboBoxField.editable;
|
|
2449
|
+
* // Access the list box field
|
|
2450
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(1) as PdfListBoxField;
|
|
2451
|
+
* // Gets the flag indicates whether the list box is editable.
|
|
2452
|
+
* let listBoxFlag: boolean = listBoxField.editable;
|
|
2453
|
+
* // Save the document
|
|
2454
|
+
* document.save('output.pdf');
|
|
2455
|
+
* // Destroy the document
|
|
2456
|
+
* document.destroy();
|
|
2457
|
+
* ```
|
|
2458
|
+
*/
|
|
2459
|
+
/**
|
|
2460
|
+
* Sets the flag indicates whether the list field is editable.
|
|
2461
|
+
*
|
|
2462
|
+
* @param {boolean} value Indicates whether the list field is editable.
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* // Load an existing PDF document
|
|
2465
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2466
|
+
* // Gets the first page of the document
|
|
2467
|
+
* let page: PdfPage = document.getPage(0);
|
|
2468
|
+
* // Access the PDF form
|
|
2469
|
+
* let form: PdfForm = document.form;
|
|
2470
|
+
* // Create a new list box field
|
|
2471
|
+
* let listField: PdfListField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2472
|
+
* // Add list items to the field.
|
|
2473
|
+
* listField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2474
|
+
* listField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2475
|
+
* listField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2476
|
+
* // Sets the selected index
|
|
2477
|
+
* listField.selectedIndex = 2;
|
|
2478
|
+
* // Sets the flag indicates whether the list box is editable.
|
|
2479
|
+
* listField.editable = true;
|
|
2480
|
+
* // Add the field into PDF form
|
|
2481
|
+
* form.add(listField);
|
|
2482
|
+
* // Create a new combo box field
|
|
2483
|
+
* let comboField: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 160, width: 100, height: 50});
|
|
2484
|
+
* // Add list items to the field.
|
|
2485
|
+
* comboField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2486
|
+
* comboField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2487
|
+
* comboField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2488
|
+
* // Sets the selected index
|
|
2489
|
+
* comboField.selectedIndex = 2;
|
|
2490
|
+
* // Sets the flag indicates whether the combo box is editable.
|
|
2491
|
+
* comboField.editable = true;
|
|
2492
|
+
* // Add the field into PDF form
|
|
2493
|
+
* form.add(comboField);
|
|
2494
|
+
* // Save the document
|
|
2495
|
+
* document.save('output.pdf');
|
|
2496
|
+
* // Destroy the document
|
|
2497
|
+
* document.destroy();
|
|
2498
|
+
* ```
|
|
2499
|
+
*/
|
|
2500
|
+
editable: boolean;
|
|
2501
|
+
/**
|
|
2502
|
+
* Gets the font of the field.
|
|
2503
|
+
*
|
|
2504
|
+
* @returns {PdfFont} font.
|
|
2505
|
+
*
|
|
2506
|
+
* ```typescript
|
|
2507
|
+
* // Load an existing PDF document
|
|
2508
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2509
|
+
* // Access the form field at index 0
|
|
2510
|
+
* let field: PdfListBoxField = document.form.fieldAt(0) as PdfListBoxField;
|
|
2511
|
+
* // Gets the font of the field.
|
|
2512
|
+
* let font: PdfFont = field.font;
|
|
2513
|
+
* // Save the document
|
|
2514
|
+
* document.save('output.pdf');
|
|
2515
|
+
* // Destroy the document
|
|
2516
|
+
* document.destroy();
|
|
2517
|
+
* ```
|
|
2518
|
+
*/
|
|
2519
|
+
/**
|
|
2520
|
+
* Sets the font of the field.
|
|
2521
|
+
*
|
|
2522
|
+
* @param {PdfFont} value font.
|
|
2523
|
+
*
|
|
2524
|
+
* ```typescript
|
|
2525
|
+
* // Load an existing PDF document
|
|
2526
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2527
|
+
* // Access the form field at index 0
|
|
2528
|
+
* let field: PdfListBoxField = document.form.fieldAt(0) as PdfListBoxField;
|
|
2529
|
+
* // Sets the font of the field
|
|
2530
|
+
* field.font = new PdfStandardFont(PdfFontFamily.helvetica, 12, PdfFontStyle.bold);
|
|
2531
|
+
* // Save the document
|
|
2532
|
+
* document.save('output.pdf');
|
|
2533
|
+
* // Destroy the document
|
|
2534
|
+
* document.destroy();
|
|
2535
|
+
* ```
|
|
2536
|
+
*/
|
|
2537
|
+
font: PdfFont;
|
|
2538
|
+
/**
|
|
2539
|
+
* Gets the text alignment in a combo box field.
|
|
2540
|
+
*
|
|
2541
|
+
* @returns {PdfTextAlignment} Text alignment.
|
|
2542
|
+
*
|
|
2543
|
+
* ```typescript
|
|
2544
|
+
* // Load an existing PDF document
|
|
2545
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2546
|
+
* // Access combo box field
|
|
2547
|
+
* let field: PdfComboBoxField = document.form.fieldAt(0) as PdfComboBoxField;
|
|
2548
|
+
* // Gets the text alignment from combo box field
|
|
2549
|
+
* let alignment: PdfTextAlignment = field.textAlignment;
|
|
2550
|
+
* // Save the document
|
|
2551
|
+
* document.save('output.pdf');
|
|
2552
|
+
* // Destroy the document
|
|
2553
|
+
* document.destroy();
|
|
2554
|
+
* ```
|
|
2555
|
+
*/
|
|
2556
|
+
/**
|
|
2557
|
+
* Sets the text alignment in a combo box field.
|
|
2558
|
+
*
|
|
2559
|
+
* @param {PdfTextAlignment} value Text alignment.
|
|
2560
|
+
*
|
|
2561
|
+
* ```typescript
|
|
2562
|
+
* // Load an existing PDF document
|
|
2563
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2564
|
+
* // Access combo box field
|
|
2565
|
+
* let field: PdfComboBoxField = document.form.fieldAt(0) as PdfComboBoxField;
|
|
2566
|
+
* // Sets the text alignment of form field as center
|
|
2567
|
+
* field.textAlignment = PdfTextAlignment.center;
|
|
2568
|
+
* // Save the document
|
|
2569
|
+
* document.save('output.pdf');
|
|
2570
|
+
* // Destroy the document
|
|
2571
|
+
* document.destroy();
|
|
2572
|
+
* ```
|
|
2573
|
+
*/
|
|
2574
|
+
textAlignment: PdfTextAlignment;
|
|
2575
|
+
readonly _options: Array<string[]>;
|
|
2576
|
+
/**
|
|
2577
|
+
* Gets the item at the specified index.
|
|
2578
|
+
*
|
|
2579
|
+
* @param {number} index Index of the field item.
|
|
2580
|
+
* @returns {PdfListFieldItem} Field item at the index.
|
|
2581
|
+
* ```typescript
|
|
2582
|
+
* // Load an existing PDF document
|
|
2583
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2584
|
+
* // Gets the first page of the document
|
|
2585
|
+
* let page: PdfPage = document.getPage(0);
|
|
2586
|
+
* // Access the PDF form
|
|
2587
|
+
* let form: PdfForm = document.form;
|
|
2588
|
+
* // Access the list box field
|
|
2589
|
+
* let listBox: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
|
|
2590
|
+
* // Gets the first list item.
|
|
2591
|
+
* let listBoxItem: PdfListFieldItem = listBox.itemAt(0);
|
|
2592
|
+
* // Access the combo box field
|
|
2593
|
+
* let comboBox: PdfComboBoxField = form.fieldAt(1) as PdfComboBoxField;
|
|
2594
|
+
* // Gets the first list item.
|
|
2595
|
+
* let comboBoxItem: PdfListFieldItem = comboBox.itemAt(0);
|
|
2596
|
+
* // Save the document
|
|
2597
|
+
* document.save('output.pdf');
|
|
2598
|
+
* // Destroy the document
|
|
2599
|
+
* document.destroy();
|
|
2600
|
+
* ```
|
|
2601
|
+
*/
|
|
2602
|
+
itemAt(index: number): PdfListFieldItem;
|
|
2603
|
+
/**
|
|
2604
|
+
* Add list item.
|
|
2605
|
+
*
|
|
2606
|
+
* @param {PdfListFieldItem} item Item to add.
|
|
2607
|
+
* @returns {number} Index of the field item.
|
|
2608
|
+
* ```typescript
|
|
2609
|
+
* // Load an existing PDF document
|
|
2610
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2611
|
+
* // Gets the first page of the document
|
|
2612
|
+
* let page: PdfPage = document.getPage(0);
|
|
2613
|
+
* // Access the PDF form
|
|
2614
|
+
* let form: PdfForm = document.form;
|
|
2615
|
+
* // Create a new list box field
|
|
2616
|
+
* let listField: PdfListField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2617
|
+
* // Add list items to the field.
|
|
2618
|
+
* listField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2619
|
+
* listField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2620
|
+
* listField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2621
|
+
* // Sets the selected index
|
|
2622
|
+
* listField.selectedIndex = 2;
|
|
2623
|
+
* // Sets the flag indicates whether the list box allows multiple selections.
|
|
2624
|
+
* listField.multiSelect = true;
|
|
2625
|
+
* // Add the field into PDF form
|
|
2626
|
+
* form.add(listField);
|
|
2627
|
+
* // Create a new combo box field
|
|
2628
|
+
* let comboField: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 160, width: 100, height: 50});
|
|
2629
|
+
* // Add list items to the field.
|
|
2630
|
+
* comboField.addItem(new PdfListFieldItem('English', 'English'));
|
|
2631
|
+
* comboField.addItem(new PdfListFieldItem('French', 'French'));
|
|
2632
|
+
* comboField.addItem(new PdfListFieldItem('German', 'German'));
|
|
2633
|
+
* // Sets the selected index
|
|
2634
|
+
* comboField.selectedIndex = 2;
|
|
2635
|
+
* // Sets the flag indicates whether the combo box allows multiple selections.
|
|
2636
|
+
* comboField.multiSelect = true;
|
|
2637
|
+
* // Add the field into PDF form
|
|
2638
|
+
* form.add(comboField);
|
|
2639
|
+
* // Save the document
|
|
2640
|
+
* document.save('output.pdf');
|
|
2641
|
+
* // Destroy the document
|
|
2642
|
+
* document.destroy();
|
|
2643
|
+
* ```
|
|
2644
|
+
*/
|
|
2645
|
+
addItem(item: PdfListFieldItem): number;
|
|
2646
|
+
/**
|
|
2647
|
+
* Remove the list item from the specified index.
|
|
2648
|
+
*
|
|
2649
|
+
* @param {number} index Item index to remove.
|
|
2650
|
+
* @returns {void} Nothing.
|
|
2651
|
+
* ```typescript
|
|
2652
|
+
* // Load an existing PDF document
|
|
2653
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2654
|
+
* // Gets the first page of the document
|
|
2655
|
+
* let page: PdfPage = document.getPage(0);
|
|
2656
|
+
* // Access the PDF form
|
|
2657
|
+
* let form: PdfForm = document.form;
|
|
2658
|
+
* // Access the list box field
|
|
2659
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
|
|
2660
|
+
* // Remove the list item from the list box field
|
|
2661
|
+
* listBoxField.removeItemAt(1);
|
|
2662
|
+
* // Access the combo box field
|
|
2663
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(1) as PdfComboBoxField;
|
|
2664
|
+
* // Remove the list item from the combo box field
|
|
2665
|
+
* comboBoxField.removeItemAt(0);
|
|
2666
|
+
* // Save the document
|
|
2667
|
+
* document.save('output.pdf');
|
|
2668
|
+
* // Destroy the document
|
|
2669
|
+
* document.destroy();
|
|
2670
|
+
* ```
|
|
2671
|
+
*/
|
|
2672
|
+
removeItemAt(index: number): void;
|
|
2673
|
+
/**
|
|
2674
|
+
* Remove the list item.
|
|
2675
|
+
*
|
|
2676
|
+
* @param {PdfListFieldItem} item Item to remove.
|
|
2677
|
+
* @returns {void} Nothing.
|
|
2678
|
+
* ```typescript
|
|
2679
|
+
* // Load an existing PDF document
|
|
2680
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2681
|
+
* // Gets the first page of the document
|
|
2682
|
+
* let page: PdfPage = document.getPage(0);
|
|
2683
|
+
* // Access the PDF form
|
|
2684
|
+
* let form: PdfForm = document.form;
|
|
2685
|
+
* // Access the list box field
|
|
2686
|
+
* let listBoxField: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
|
|
2687
|
+
* // Remove the list item from the list box field
|
|
2688
|
+
* listBoxField.removeItem(listBoxField.itemAt(1));
|
|
2689
|
+
* // Access the combo box field
|
|
2690
|
+
* let comboBoxField: PdfComboBoxField = form.fieldAt(1) as PdfComboBoxField;
|
|
2691
|
+
* // Remove the list item from the combo box field
|
|
2692
|
+
* comboBoxField.removeItem(comboBoxField.itemAt(0));
|
|
2693
|
+
* // Save the document
|
|
2694
|
+
* document.save('output.pdf');
|
|
2695
|
+
* // Destroy the document
|
|
2696
|
+
* document.destroy();
|
|
2697
|
+
* ```
|
|
2698
|
+
*/
|
|
2699
|
+
removeItem(item: PdfListFieldItem): void;
|
|
2700
|
+
_initialize(page: PdfPage, name: string, bounds: {
|
|
2701
|
+
x: number;
|
|
2702
|
+
y: number;
|
|
2703
|
+
width: number;
|
|
2704
|
+
height: number;
|
|
2705
|
+
}): void;
|
|
2706
|
+
abstract _getFontHeight(font: PdfFontFamily): number;
|
|
2707
|
+
abstract _createAppearance(item?: PdfListFieldItem): PdfTemplate;
|
|
2708
|
+
_obtainFont(item?: PdfListFieldItem): PdfFont;
|
|
2709
|
+
_obtainSelectedValue(): string[];
|
|
2710
|
+
_doPostProcess(isFlatten?: boolean): void;
|
|
2711
|
+
_tryGetIndex(value: string): number;
|
|
2712
|
+
_addEmptyWidget(): void;
|
|
2713
|
+
}
|
|
2714
|
+
/**
|
|
2715
|
+
* `PdfComboBoxField` class represents the combo box field objects.
|
|
2716
|
+
* ```typescript
|
|
2717
|
+
* // Load an existing PDF document
|
|
2718
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2719
|
+
* // Gets the first page of the document
|
|
2720
|
+
* let page: PdfPage = document.getPage(0);
|
|
2721
|
+
* // Access the PDF form
|
|
2722
|
+
* let form: PdfForm = document.form;
|
|
2723
|
+
* // Create a new combo box field
|
|
2724
|
+
* let field: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2725
|
+
* // Add list items to the field.
|
|
2726
|
+
* field.addItem(new PdfListFieldItem('English', 'English'));
|
|
2727
|
+
* field.addItem(new PdfListFieldItem('French', 'French'));
|
|
2728
|
+
* field.addItem(new PdfListFieldItem('German', 'German'));
|
|
2729
|
+
* // Sets the selected index
|
|
2730
|
+
* field.selectedIndex = 2;
|
|
2731
|
+
* // Sets the flag indicates whether the combo box allows multiple selections.
|
|
2732
|
+
* field.multiSelect = true;
|
|
2733
|
+
* // Add the field into PDF form
|
|
2734
|
+
* form.add(field);
|
|
2735
|
+
* // Save the document
|
|
2736
|
+
* document.save('output.pdf');
|
|
2737
|
+
* // Destroy the document
|
|
2738
|
+
* document.destroy();
|
|
2739
|
+
* ```
|
|
2740
|
+
*/
|
|
2741
|
+
export declare class PdfComboBoxField extends PdfListField {
|
|
2742
|
+
/**
|
|
2743
|
+
* Represents a combo box field of the PDF document.
|
|
2744
|
+
*
|
|
2745
|
+
* @private
|
|
2746
|
+
*/
|
|
2747
|
+
constructor();
|
|
2748
|
+
/**
|
|
2749
|
+
* Represents a combo box field of the PDF document.
|
|
2750
|
+
*
|
|
2751
|
+
* @param {PdfPage} page The page where the field is drawn.
|
|
2752
|
+
* @param {string} name The name of the field.
|
|
2753
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds The bounds of the field.
|
|
2754
|
+
* ```typescript
|
|
2755
|
+
* // Load an existing PDF document
|
|
2756
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2757
|
+
* // Gets the first page of the document
|
|
2758
|
+
* let page: PdfPage = document.getPage(0);
|
|
2759
|
+
* // Access the PDF form
|
|
2760
|
+
* let form: PdfForm = document.form;
|
|
2761
|
+
* // Create a new combo box field
|
|
2762
|
+
* let field: PdfComboBoxField = new PdfComboBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2763
|
+
* // Add list items to the field.
|
|
2764
|
+
* field.addItem(new PdfListFieldItem('English', 'English'));
|
|
2765
|
+
* field.addItem(new PdfListFieldItem('French', 'French'));
|
|
2766
|
+
* field.addItem(new PdfListFieldItem('German', 'German'));
|
|
2767
|
+
* // Sets the selected index
|
|
2768
|
+
* field.selectedIndex = 2;
|
|
2769
|
+
* // Sets the flag indicates whether the combo box allows multiple selections.
|
|
2770
|
+
* field.multiSelect = true;
|
|
2771
|
+
* // Add the field into PDF form
|
|
2772
|
+
* form.add(field);
|
|
2773
|
+
* // Save the document
|
|
2774
|
+
* document.save('output.pdf');
|
|
2775
|
+
* // Destroy the document
|
|
2776
|
+
* document.destroy();
|
|
2777
|
+
* ```
|
|
2778
|
+
*/
|
|
2779
|
+
constructor(page: PdfPage, name: string, bounds: {
|
|
2780
|
+
x: number;
|
|
2781
|
+
y: number;
|
|
2782
|
+
width: number;
|
|
2783
|
+
height: number;
|
|
2784
|
+
});
|
|
2785
|
+
/**
|
|
2786
|
+
* Gets the boolean flag indicates whether the combo box field is auto size.
|
|
2787
|
+
*
|
|
2788
|
+
* @private
|
|
2789
|
+
* @returns {boolean} Returns the boolean value to check auto size.
|
|
2790
|
+
*/
|
|
2791
|
+
readonly _isAutoFontSize: boolean;
|
|
2792
|
+
/**
|
|
2793
|
+
* Parse an existing combo box field.
|
|
2794
|
+
*
|
|
2795
|
+
* @private
|
|
2796
|
+
* @param {PdfForm} form Form object.
|
|
2797
|
+
* @param {_PdfDictionary} dictionary Field dictionary.
|
|
2798
|
+
* @param {_PdfCrossReference} crossReference Cross reference object.
|
|
2799
|
+
* @param {_PdfReference} reference Field reference.
|
|
2800
|
+
* @returns {PdfComboBoxField} Combo box field.
|
|
2801
|
+
*/
|
|
2802
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfComboBoxField;
|
|
2803
|
+
_retrieveOptionValue(): void;
|
|
2804
|
+
_createAppearance(item?: PdfListFieldItem): PdfTemplate;
|
|
2805
|
+
_drawComboBox(graphics: PdfGraphics, parameter?: _PaintParameter, font?: PdfFont, stringFormat?: PdfStringFormat): void;
|
|
2806
|
+
_getFontHeight(fontFamily: PdfFontFamily): number;
|
|
2807
|
+
}
|
|
2808
|
+
/**
|
|
2809
|
+
* `PdfListBoxField` class represents the list box field objects.
|
|
2810
|
+
* ```typescript
|
|
2811
|
+
* // Load an existing PDF document
|
|
2812
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2813
|
+
* // Gets the first page of the document
|
|
2814
|
+
* let page: PdfPage = document.getPage(0);
|
|
2815
|
+
* // Access the PDF form
|
|
2816
|
+
* let form: PdfForm = document.form;
|
|
2817
|
+
* // Create a new list box field
|
|
2818
|
+
* let field: PdfListBoxField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2819
|
+
* // Add list items to the field.
|
|
2820
|
+
* field.addItem(new PdfListFieldItem('English', 'English'));
|
|
2821
|
+
* field.addItem(new PdfListFieldItem('French', 'French'));
|
|
2822
|
+
* field.addItem(new PdfListFieldItem('German', 'German'));
|
|
2823
|
+
* // Sets the selected index
|
|
2824
|
+
* field.selectedIndex = 2;
|
|
2825
|
+
* // Sets the flag indicates whether the list box allows multiple selections.
|
|
2826
|
+
* field.multiSelect = true;
|
|
2827
|
+
* // Add the field into PDF form
|
|
2828
|
+
* form.add(field);
|
|
2829
|
+
* // Save the document
|
|
2830
|
+
* document.save('output.pdf');
|
|
2831
|
+
* // Destroy the document
|
|
2832
|
+
* document.destroy();
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
export declare class PdfListBoxField extends PdfListField {
|
|
2836
|
+
/**
|
|
2837
|
+
* Represents a list box field of the PDF document.
|
|
2838
|
+
*
|
|
2839
|
+
* @private
|
|
2840
|
+
*/
|
|
2841
|
+
constructor();
|
|
2842
|
+
/**
|
|
2843
|
+
* Represents a list box field of the PDF document.
|
|
2844
|
+
*
|
|
2845
|
+
* @param {PdfPage} page The page where the field is drawn.
|
|
2846
|
+
* @param {string} name The name of the field.
|
|
2847
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds The bounds of the field.
|
|
2848
|
+
* ```typescript
|
|
2849
|
+
* // Load an existing PDF document
|
|
2850
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2851
|
+
* // Gets the first page of the document
|
|
2852
|
+
* let page: PdfPage = document.getPage(0);
|
|
2853
|
+
* // Access the PDF form
|
|
2854
|
+
* let form: PdfForm = document.form;
|
|
2855
|
+
* // Create a new list box field
|
|
2856
|
+
* let field: PdfListBoxField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
|
|
2857
|
+
* // Add list items to the field.
|
|
2858
|
+
* field.addItem(new PdfListFieldItem('English', 'English'));
|
|
2859
|
+
* field.addItem(new PdfListFieldItem('French', 'French'));
|
|
2860
|
+
* field.addItem(new PdfListFieldItem('German', 'German'));
|
|
2861
|
+
* // Sets the selected index
|
|
2862
|
+
* field.selectedIndex = 2;
|
|
2863
|
+
* // Sets the flag indicates whether the list box allows multiple selections.
|
|
2864
|
+
* field.multiSelect = true;
|
|
2865
|
+
* // Add the field into PDF form
|
|
2866
|
+
* form.add(field);
|
|
2867
|
+
* // Save the document
|
|
2868
|
+
* document.save('output.pdf');
|
|
2869
|
+
* // Destroy the document
|
|
2870
|
+
* document.destroy();
|
|
2871
|
+
* ```
|
|
2872
|
+
*/
|
|
2873
|
+
constructor(page: PdfPage, name: string, bounds: {
|
|
2874
|
+
x: number;
|
|
2875
|
+
y: number;
|
|
2876
|
+
width: number;
|
|
2877
|
+
height: number;
|
|
2878
|
+
});
|
|
2879
|
+
/**
|
|
2880
|
+
* Parse an existing list box field of the PDF document.
|
|
2881
|
+
*
|
|
2882
|
+
* @private
|
|
2883
|
+
* @param {number} form maximum length.
|
|
2884
|
+
* @param {_PdfDictionary} dictionary maximum length.
|
|
2885
|
+
* @param {_PdfCrossReference} crossReference maximum length.
|
|
2886
|
+
* @param {_PdfReference} reference maximum length.
|
|
2887
|
+
* @returns {PdfListBoxField} List box field.
|
|
2888
|
+
*/
|
|
2889
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfListBoxField;
|
|
2890
|
+
_retrieveOptionValue(): void;
|
|
2891
|
+
_createAppearance(item?: PdfListFieldItem): PdfTemplate;
|
|
2892
|
+
_drawListBox(graphics: PdfGraphics, parameter?: _PaintParameter, font?: PdfFont, stringFormat?: PdfStringFormat): void;
|
|
2893
|
+
_getFontHeight(fontFamily: PdfFontFamily): number;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* `PdfSignatureField` class represents the signature field objects.
|
|
2897
|
+
* ```typescript
|
|
2898
|
+
* // Load an existing PDF document
|
|
2899
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2900
|
+
* // Gets the first page of the document
|
|
2901
|
+
* let page: PdfPage = document.getPage(0);
|
|
2902
|
+
* // Access the PDF form
|
|
2903
|
+
* let form: PdfForm = document.form;
|
|
2904
|
+
* // Create a new signature field
|
|
2905
|
+
* let field: PdfSignatureField = new PdfSignatureField(page, 'Signature', {x: 10, y: 10, width: 100, height: 50});
|
|
2906
|
+
* // Add the field into PDF form
|
|
2907
|
+
* form.add(field);
|
|
2908
|
+
* // Save the document
|
|
2909
|
+
* document.save('output.pdf');
|
|
2910
|
+
* // Destroy the document
|
|
2911
|
+
* document.destroy();
|
|
2912
|
+
* ```
|
|
2913
|
+
*/
|
|
2914
|
+
export declare class PdfSignatureField extends PdfField {
|
|
2915
|
+
_isSigned: boolean;
|
|
2916
|
+
/**
|
|
2917
|
+
* Represents a signature field of the PDF document.
|
|
2918
|
+
*
|
|
2919
|
+
* @private
|
|
2920
|
+
*/
|
|
2921
|
+
constructor();
|
|
2922
|
+
/**
|
|
2923
|
+
* Represents a signature field of the PDF document.
|
|
2924
|
+
*
|
|
2925
|
+
* @private
|
|
2926
|
+
* @param {PdfPage} page The page to which the signature field is added.
|
|
2927
|
+
* @param {string} name The name of the signature field.
|
|
2928
|
+
* @param {{x: number, y: number, width: number, height: number}} bounds The bounds of the signature field.
|
|
2929
|
+
* ```typescript
|
|
2930
|
+
* // Load an existing PDF document
|
|
2931
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
2932
|
+
* // Gets the first page of the document
|
|
2933
|
+
* let page: PdfPage = document.getPage(0);
|
|
2934
|
+
* // Access the PDF form
|
|
2935
|
+
* let form: PdfForm = document.form;
|
|
2936
|
+
* // Create a new signature field
|
|
2937
|
+
* let field: PdfSignatureField = new PdfSignatureField(page, 'Signature', {x: 10, y: 10, width: 100, height: 50});
|
|
2938
|
+
* // Add the field into PDF form
|
|
2939
|
+
* form.add(field);
|
|
2940
|
+
* // Save the document
|
|
2941
|
+
* document.save('output.pdf');
|
|
2942
|
+
* // Destroy the document
|
|
2943
|
+
* document.destroy();
|
|
2944
|
+
* ```
|
|
2945
|
+
*/
|
|
2946
|
+
constructor(page: PdfPage, name: string, bounds: {
|
|
2947
|
+
x: number;
|
|
2948
|
+
y: number;
|
|
2949
|
+
width: number;
|
|
2950
|
+
height: number;
|
|
2951
|
+
});
|
|
2952
|
+
/**
|
|
2953
|
+
* Gets the flag to indicate whether the field is signed or not.
|
|
2954
|
+
*
|
|
2955
|
+
* @returns {boolean} Returns true if the field is signed; otherwise, false.
|
|
2956
|
+
*
|
|
2957
|
+
* ```typescript
|
|
2958
|
+
* // Load an existing PDF document
|
|
2959
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2960
|
+
* // Access the loaded signature field
|
|
2961
|
+
* let field: PdfSignatureField = document.form.fieldAt(0) as PdfSignatureField;
|
|
2962
|
+
* // Get the signed status of the field
|
|
2963
|
+
* let isSigned: boolean = field.isSigned;
|
|
2964
|
+
* // Destroy the document
|
|
2965
|
+
* document.destroy();
|
|
2966
|
+
* ```
|
|
2967
|
+
*/
|
|
2968
|
+
readonly isSigned: boolean;
|
|
2969
|
+
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfSignatureField;
|
|
2970
|
+
_initialize(page: PdfPage, name: string, bounds: {
|
|
2971
|
+
x: number;
|
|
2972
|
+
y: number;
|
|
2973
|
+
width: number;
|
|
2974
|
+
height: number;
|
|
2975
|
+
}): void;
|
|
2976
|
+
_createItem(bounds: {
|
|
2977
|
+
x: number;
|
|
2978
|
+
y: number;
|
|
2979
|
+
width: number;
|
|
2980
|
+
height: number;
|
|
2981
|
+
}): void;
|
|
2982
|
+
_doPostProcess(isFlatten?: boolean): void;
|
|
2983
|
+
_createAppearance(widget: PdfWidgetAnnotation, isFlatten: boolean): PdfTemplate;
|
|
2984
|
+
_flattenSignature(dictionary: _PdfDictionary, page: PdfPage, bounds: {
|
|
2985
|
+
x: number;
|
|
2986
|
+
y: number;
|
|
2987
|
+
width: number;
|
|
2988
|
+
height: number;
|
|
2989
|
+
}, signatureTemplate?: PdfTemplate): void;
|
|
2990
|
+
_calculateTemplateBounds(bounds: {
|
|
2991
|
+
x: number;
|
|
2992
|
+
y: number;
|
|
2993
|
+
width: number;
|
|
2994
|
+
height: number;
|
|
2995
|
+
}, page: PdfPage, template: PdfTemplate, graphics: PdfGraphics): {
|
|
2996
|
+
x: number;
|
|
2997
|
+
y: number;
|
|
2998
|
+
width: number;
|
|
2999
|
+
height: number;
|
|
3000
|
+
};
|
|
3001
|
+
_obtainGraphicsRotation(matrix: _PdfTransformationMatrix): number;
|
|
3002
|
+
_getItemTemplate(dictionary: _PdfDictionary): PdfTemplate;
|
|
3003
|
+
_checkSigned(): void;
|
|
3004
|
+
}
|
|
3005
|
+
export declare class _PdfDefaultAppearance {
|
|
3006
|
+
fontName: string;
|
|
3007
|
+
fontSize: number;
|
|
3008
|
+
color: number[];
|
|
3009
|
+
constructor(da?: string);
|
|
3010
|
+
toString(): string;
|
|
3011
|
+
}
|