@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,1682 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { PdfStringFormat } from './pdf-string-format';
|
|
15
|
+
import { _PdfFontMetrics, _CjkWidthTable, _StandardWidthTable, _CjkSameWidth, _CjkDifferentWidth } from './pdf-font-metrics';
|
|
16
|
+
import { _PdfDictionary, _PdfName } from './../pdf-primitives';
|
|
17
|
+
import { _PdfStringLayouter } from './string-layouter';
|
|
18
|
+
import { _UnicodeTrueTypeFont } from './unicode-true-type-font';
|
|
19
|
+
import { _fromRectangle } from './../utils';
|
|
20
|
+
import { PdfTextDirection } from './../../core/enumerator';
|
|
21
|
+
import { _RtlRenderer } from './../graphics/rightToLeft/text-renderer';
|
|
22
|
+
/**
|
|
23
|
+
* Represents the base class for font objects.`
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Load an existing PDF document
|
|
26
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
27
|
+
* // Gets the first page
|
|
28
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
29
|
+
* // Create a new PDF standard font
|
|
30
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
|
|
31
|
+
* // Create a new PDF string format
|
|
32
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
33
|
+
* // Draw the text
|
|
34
|
+
* page.graphics.drawString('Helvetica', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
35
|
+
* // Save the document
|
|
36
|
+
* document.save('output.pdf');
|
|
37
|
+
* // Destroy the document
|
|
38
|
+
* document.destroy();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
var PdfFont = /** @class */ (function () {
|
|
42
|
+
function PdfFont(size, style) {
|
|
43
|
+
if (typeof size === 'number' && typeof style === 'undefined') {
|
|
44
|
+
this._size = size;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this._size = size;
|
|
48
|
+
this._style = style;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
Object.defineProperty(PdfFont.prototype, "size", {
|
|
52
|
+
/**
|
|
53
|
+
* Gets the size of the PDF font.
|
|
54
|
+
*
|
|
55
|
+
* @returns {number} size.
|
|
56
|
+
*
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Load an existing PDF document
|
|
59
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
60
|
+
* // Gets the first page
|
|
61
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
62
|
+
* // Create a new PDF standard font
|
|
63
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
|
|
64
|
+
* // Gets the font size
|
|
65
|
+
* let size: number = font.size;
|
|
66
|
+
* // Destroy the document
|
|
67
|
+
* document.destroy();
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
get: function () {
|
|
71
|
+
return this._size;
|
|
72
|
+
},
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(PdfFont.prototype, "style", {
|
|
77
|
+
/**
|
|
78
|
+
* Gets the style of the PDF font.
|
|
79
|
+
*
|
|
80
|
+
* @returns {PdfFontStyle} size.
|
|
81
|
+
*
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Load an existing PDF document
|
|
84
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
85
|
+
* // Gets the first page
|
|
86
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
87
|
+
* // Create a new PDF standard font
|
|
88
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.italic);
|
|
89
|
+
* // Gets the font style
|
|
90
|
+
* let style: PdfFontStyle = font.style;
|
|
91
|
+
* // Destroy the document
|
|
92
|
+
* document.destroy();
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
get: function () {
|
|
96
|
+
return this._style;
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Sets the style of the PDF font.
|
|
100
|
+
*
|
|
101
|
+
* @param {PdfFontStyle} value to font style.
|
|
102
|
+
*
|
|
103
|
+
* ```typescript
|
|
104
|
+
* // Load an existing PDF document
|
|
105
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
106
|
+
* // Gets the first page
|
|
107
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
108
|
+
* // Create a new PDF standard font
|
|
109
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
|
|
110
|
+
* // Sets the font style
|
|
111
|
+
* font.style = PdfFontStyle.italic;
|
|
112
|
+
* // Destroy the document
|
|
113
|
+
* document.destroy();
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
set: function (value) {
|
|
117
|
+
this._style = value;
|
|
118
|
+
},
|
|
119
|
+
enumerable: true,
|
|
120
|
+
configurable: true
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(PdfFont.prototype, "isUnderline", {
|
|
123
|
+
/**
|
|
124
|
+
* Gets the boolean flag indicating whether the font has underline style or not.
|
|
125
|
+
*
|
|
126
|
+
* @returns {boolean} isUnderline.
|
|
127
|
+
*
|
|
128
|
+
* ```typescript
|
|
129
|
+
* // Load an existing PDF document
|
|
130
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
131
|
+
* // Gets the first page
|
|
132
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
133
|
+
* // Create a new PDF standard font
|
|
134
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.underline);
|
|
135
|
+
* // Gets the boolean flag indicating whether the font has underline style or not.
|
|
136
|
+
* let underline: boolean = font.isUnderline;
|
|
137
|
+
* // Destroy the document
|
|
138
|
+
* document.destroy();
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
get: function () {
|
|
142
|
+
return (this.style & PdfFontStyle.underline) > 0;
|
|
143
|
+
},
|
|
144
|
+
enumerable: true,
|
|
145
|
+
configurable: true
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(PdfFont.prototype, "isStrikeout", {
|
|
148
|
+
/**
|
|
149
|
+
* Gets the boolean flag indicating whether the font has strike out style or not.
|
|
150
|
+
*
|
|
151
|
+
* @returns {boolean} isStrikeout.
|
|
152
|
+
*
|
|
153
|
+
* ```typescript
|
|
154
|
+
* // Load an existing PDF document
|
|
155
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
156
|
+
* // Gets the first page
|
|
157
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
158
|
+
* // Create a new PDF standard font
|
|
159
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.strikeout);
|
|
160
|
+
* // Gets the boolean flag indicating whether the font has strike out style or not.
|
|
161
|
+
* let strikeout: boolean = font.isStrikeout;
|
|
162
|
+
* // Destroy the document
|
|
163
|
+
* document.destroy();
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
get: function () {
|
|
167
|
+
return (this.style & PdfFontStyle.strikeout) > 0;
|
|
168
|
+
},
|
|
169
|
+
enumerable: true,
|
|
170
|
+
configurable: true
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(PdfFont.prototype, "_metrics", {
|
|
173
|
+
get: function () {
|
|
174
|
+
return this._fontMetrics;
|
|
175
|
+
},
|
|
176
|
+
set: function (value) {
|
|
177
|
+
this._fontMetrics = value;
|
|
178
|
+
},
|
|
179
|
+
enumerable: true,
|
|
180
|
+
configurable: true
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(PdfFont.prototype, "isBold", {
|
|
183
|
+
/**
|
|
184
|
+
* Gets the boolean flag indicating whether the font has bold style or not.
|
|
185
|
+
*
|
|
186
|
+
* @returns {boolean} isBold.
|
|
187
|
+
*
|
|
188
|
+
* ```typescript
|
|
189
|
+
* // Load an existing PDF document
|
|
190
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
191
|
+
* // Gets the first page
|
|
192
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
193
|
+
* // Create a new PDF standard font
|
|
194
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.bold);
|
|
195
|
+
* // Gets the boolean flag indicating whether the font has bold style or not.
|
|
196
|
+
* let bold: boolean = font.isBold;
|
|
197
|
+
* // Destroy the document
|
|
198
|
+
* document.destroy();
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
get: function () {
|
|
202
|
+
return ((this.style & PdfFontStyle.bold) > 0);
|
|
203
|
+
},
|
|
204
|
+
enumerable: true,
|
|
205
|
+
configurable: true
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(PdfFont.prototype, "isItalic", {
|
|
208
|
+
/**
|
|
209
|
+
* Gets the boolean flag indicating whether the font has italic style or not.
|
|
210
|
+
*
|
|
211
|
+
* @returns {boolean} isItalic.
|
|
212
|
+
*
|
|
213
|
+
* ```typescript
|
|
214
|
+
* // Load an existing PDF document
|
|
215
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
216
|
+
* // Gets the first page
|
|
217
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
218
|
+
* // Create a new PDF standard font
|
|
219
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.italic);
|
|
220
|
+
* // Gets the boolean flag indicating whether the font has italic style or not.
|
|
221
|
+
* let italic: boolean = font.isItalic;
|
|
222
|
+
* // Destroy the document
|
|
223
|
+
* document.destroy();
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
get: function () {
|
|
227
|
+
return ((this.style & PdfFontStyle.italic) > 0);
|
|
228
|
+
},
|
|
229
|
+
enumerable: true,
|
|
230
|
+
configurable: true
|
|
231
|
+
});
|
|
232
|
+
Object.defineProperty(PdfFont.prototype, "height", {
|
|
233
|
+
/**
|
|
234
|
+
* Gets the font height.
|
|
235
|
+
*
|
|
236
|
+
* @returns {number} height.
|
|
237
|
+
*
|
|
238
|
+
* ```typescript
|
|
239
|
+
* // Load an existing PDF document
|
|
240
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
241
|
+
* // Gets the first page
|
|
242
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
243
|
+
* // Create a new PDF standard font
|
|
244
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.italic);
|
|
245
|
+
* // Gets the font height
|
|
246
|
+
* let height: number = font.height;
|
|
247
|
+
* // Destroy the document
|
|
248
|
+
* document.destroy();
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
get: function () {
|
|
252
|
+
return this._metrics._getHeight();
|
|
253
|
+
},
|
|
254
|
+
enumerable: true,
|
|
255
|
+
configurable: true
|
|
256
|
+
});
|
|
257
|
+
PdfFont.prototype._setInternals = function (internals) {
|
|
258
|
+
if (internals == null) {
|
|
259
|
+
throw new Error('ArgumentNullException:internals');
|
|
260
|
+
}
|
|
261
|
+
this._pdfFontInternals = internals;
|
|
262
|
+
};
|
|
263
|
+
PdfFont.prototype._getCharacterCount = function (text, symbols) {
|
|
264
|
+
if (typeof symbols === 'string') {
|
|
265
|
+
var numSymbols = 0;
|
|
266
|
+
var curIndex = 0;
|
|
267
|
+
curIndex = text.indexOf(symbols, curIndex);
|
|
268
|
+
while (curIndex !== -1) {
|
|
269
|
+
numSymbols++;
|
|
270
|
+
curIndex++;
|
|
271
|
+
curIndex = text.indexOf(symbols, curIndex);
|
|
272
|
+
}
|
|
273
|
+
return numSymbols;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
var count = 0;
|
|
277
|
+
for (var i = 0; i < text.length; i++) {
|
|
278
|
+
if (symbols.indexOf(text[Number.parseInt(i.toString(), 10)]) !== -1) {
|
|
279
|
+
count++;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return count;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
PdfFont.prototype.measureString = function (text, arg2, arg3, arg4, arg5) {
|
|
286
|
+
if (typeof text === 'string' && typeof arg2 === 'undefined') {
|
|
287
|
+
return this.measureString(text, null);
|
|
288
|
+
}
|
|
289
|
+
else if (typeof text === 'string' && (arg2 instanceof PdfStringFormat || arg2 == null) &&
|
|
290
|
+
typeof arg3 === 'undefined' && typeof arg4 === 'undefined') {
|
|
291
|
+
var temparg2 = arg2;
|
|
292
|
+
var charactersFitted = 0;
|
|
293
|
+
var linesFilled = 0;
|
|
294
|
+
return this.measureString(text, temparg2, charactersFitted, linesFilled);
|
|
295
|
+
}
|
|
296
|
+
else if (typeof text === 'string' && (arg2 instanceof PdfStringFormat || arg2 == null)
|
|
297
|
+
&& typeof arg3 === 'number' && typeof arg4 === 'number') {
|
|
298
|
+
var temparg2 = arg2;
|
|
299
|
+
return this.measureString(text, 0, temparg2, arg3, arg4);
|
|
300
|
+
}
|
|
301
|
+
else if (typeof text === 'string' && typeof arg2 === 'number'
|
|
302
|
+
&& (arg3 instanceof PdfStringFormat || arg3 == null) && typeof arg4 === 'number' && typeof arg5 === 'number') {
|
|
303
|
+
var layoutArea = [arg2, 0];
|
|
304
|
+
var temparg3 = arg3;
|
|
305
|
+
return this.measureString(text, layoutArea, temparg3, arg4, arg5);
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
var temparg2 = arg2;
|
|
309
|
+
var temparg3 = arg3;
|
|
310
|
+
var layouter = new _PdfStringLayouter();
|
|
311
|
+
var result = layouter._layout(text, this, temparg3, temparg2);
|
|
312
|
+
arg4 = text.length;
|
|
313
|
+
arg5 = (result._empty) ? 0 : result._lines.length;
|
|
314
|
+
return result._actualSize;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
PdfFont.prototype._applyFormatSettings = function (line, format, width) {
|
|
318
|
+
var realWidth = width;
|
|
319
|
+
if (typeof format !== 'undefined' && format !== null && width > 0) {
|
|
320
|
+
if (format.characterSpacing !== 0) {
|
|
321
|
+
realWidth += (line.length - 1) * format.characterSpacing;
|
|
322
|
+
}
|
|
323
|
+
if (format.wordSpacing !== 0) {
|
|
324
|
+
realWidth += this._getCharacterCount(line, [' ', '\t']) * format.wordSpacing;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return realWidth;
|
|
328
|
+
};
|
|
329
|
+
return PdfFont;
|
|
330
|
+
}());
|
|
331
|
+
export { PdfFont };
|
|
332
|
+
/**
|
|
333
|
+
* Represents one of the 14 standard fonts.
|
|
334
|
+
* ```typescript
|
|
335
|
+
* // Load an existing PDF document
|
|
336
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
337
|
+
* // Gets the first page
|
|
338
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
339
|
+
* // Create a new PDF standard font
|
|
340
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
|
|
341
|
+
* // Create a new PDF string format
|
|
342
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
343
|
+
* // Draw the text
|
|
344
|
+
* page.graphics.drawString('Helvetica', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
345
|
+
* // Save the document
|
|
346
|
+
* document.save('output.pdf');
|
|
347
|
+
* // Destroy the document
|
|
348
|
+
* document.destroy();
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
var PdfStandardFont = /** @class */ (function (_super) {
|
|
352
|
+
__extends(PdfStandardFont, _super);
|
|
353
|
+
function PdfStandardFont(fontFamily, size, style) {
|
|
354
|
+
var _this = _super.call(this, size, (typeof style === 'undefined') ? PdfFontStyle.regular : style) || this;
|
|
355
|
+
_this._fontFamily = fontFamily;
|
|
356
|
+
_this._checkStyle();
|
|
357
|
+
_this._initializeInternals();
|
|
358
|
+
return _this;
|
|
359
|
+
}
|
|
360
|
+
Object.defineProperty(PdfStandardFont.prototype, "fontFamily", {
|
|
361
|
+
/**
|
|
362
|
+
* Gets the font family of the PDF standard font.
|
|
363
|
+
*
|
|
364
|
+
* @returns {PdfFontFamily} fontFamily.
|
|
365
|
+
*
|
|
366
|
+
* ```typescript
|
|
367
|
+
* // Load an existing PDF document
|
|
368
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
369
|
+
* // Gets the first page
|
|
370
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
371
|
+
* // Create a new PDF standard font
|
|
372
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.strikeout);
|
|
373
|
+
* // Gets the font family
|
|
374
|
+
* let fontFamily: PdfFontFamily = font.fontFamily;
|
|
375
|
+
* // Destroy the document
|
|
376
|
+
* document.destroy();
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
get: function () {
|
|
380
|
+
return this._fontFamily;
|
|
381
|
+
},
|
|
382
|
+
enumerable: true,
|
|
383
|
+
configurable: true
|
|
384
|
+
});
|
|
385
|
+
PdfStandardFont.prototype._checkStyle = function () {
|
|
386
|
+
if (this._fontFamily === PdfFontFamily.symbol || this._fontFamily === PdfFontFamily.zapfDingbats) {
|
|
387
|
+
this._style &= ~(PdfFontStyle.bold | PdfFontStyle.italic);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Gets the line width.
|
|
392
|
+
*
|
|
393
|
+
* @param {string} line Line.
|
|
394
|
+
* @param {PdfStringFormat} format String format.
|
|
395
|
+
* @returns {number} width.
|
|
396
|
+
*
|
|
397
|
+
* ```typescript
|
|
398
|
+
* // Load an existing PDF document
|
|
399
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
400
|
+
* // Gets the first page
|
|
401
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
402
|
+
* // Create a new PDF standard font
|
|
403
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.regular);
|
|
404
|
+
* // Create a new PDF string format
|
|
405
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
406
|
+
* // Get the text width
|
|
407
|
+
* let width: number = font.getLineWidth('Syncfusion', format);
|
|
408
|
+
* // Save the document
|
|
409
|
+
* document.save('output.pdf');
|
|
410
|
+
* // Destroy the document
|
|
411
|
+
* document.destroy();
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
PdfStandardFont.prototype.getLineWidth = function (line, format) {
|
|
415
|
+
var width = 0;
|
|
416
|
+
for (var i = 0, len = line.length; i < len; i++) {
|
|
417
|
+
width += this._getCharacterWidthInternal(line[Number.parseInt(i.toString(), 10)]);
|
|
418
|
+
}
|
|
419
|
+
width *= (0.001 * this._metrics._size);
|
|
420
|
+
width = this._applyFormatSettings(line, format, width);
|
|
421
|
+
return width;
|
|
422
|
+
};
|
|
423
|
+
PdfStandardFont.prototype._initializeInternals = function () {
|
|
424
|
+
this._metrics = _PdfStandardFontMetricsFactory._getMetrics(this._fontFamily, this._style, this._size);
|
|
425
|
+
this._dictionary = this._createInternals();
|
|
426
|
+
};
|
|
427
|
+
PdfStandardFont.prototype._createInternals = function () {
|
|
428
|
+
var dictionary = new _PdfDictionary();
|
|
429
|
+
dictionary._updated = true;
|
|
430
|
+
dictionary.set('Type', _PdfName.get('Font'));
|
|
431
|
+
dictionary.set('Subtype', _PdfName.get('Type1'));
|
|
432
|
+
dictionary.set('BaseFont', new _PdfName(this._metrics._postScriptName));
|
|
433
|
+
if (this._fontFamily !== PdfFontFamily.symbol && this._fontFamily !== PdfFontFamily.zapfDingbats) {
|
|
434
|
+
dictionary.set('Encoding', new _PdfName('WinAnsiEncoding'));
|
|
435
|
+
}
|
|
436
|
+
return dictionary;
|
|
437
|
+
};
|
|
438
|
+
PdfStandardFont.prototype._getCharacterWidthInternal = function (charCode) {
|
|
439
|
+
var width = 0;
|
|
440
|
+
var code = 0;
|
|
441
|
+
code = charCode.charCodeAt(0);
|
|
442
|
+
if (this._metrics._name === '0' ||
|
|
443
|
+
this._metrics._name === '1' ||
|
|
444
|
+
this._metrics._name === '2' ||
|
|
445
|
+
this._metrics._name === '3' ||
|
|
446
|
+
this._metrics._name === '4') {
|
|
447
|
+
code = code - 32;
|
|
448
|
+
}
|
|
449
|
+
code = (code >= 0 && code !== 128) ? code : 0;
|
|
450
|
+
var widthTable = this._metrics._widthTable;
|
|
451
|
+
width = widthTable._itemAt(code);
|
|
452
|
+
return width;
|
|
453
|
+
};
|
|
454
|
+
return PdfStandardFont;
|
|
455
|
+
}(PdfFont));
|
|
456
|
+
export { PdfStandardFont };
|
|
457
|
+
/**
|
|
458
|
+
* Represents one of the 7 CJK standard fonts.
|
|
459
|
+
* ```typescript
|
|
460
|
+
* // Load an existing PDF document
|
|
461
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
462
|
+
* // Gets the first page
|
|
463
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
464
|
+
* // Create a new PDF CJK standard font
|
|
465
|
+
* let font: PdfCjkStandardFont = new PdfCjkStandardFont(PdfCjkFontFamily.heiseiMinchoW3, 20);
|
|
466
|
+
* // Create a new PDF string format
|
|
467
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
468
|
+
* // Draw the text
|
|
469
|
+
* page.graphics.drawString('こんにちは世界', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
470
|
+
* // Save the document
|
|
471
|
+
* document.save('output.pdf');
|
|
472
|
+
* // Destroy the document
|
|
473
|
+
* document.destroy();
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
var PdfCjkStandardFont = /** @class */ (function (_super) {
|
|
477
|
+
__extends(PdfCjkStandardFont, _super);
|
|
478
|
+
function PdfCjkStandardFont(fontFamily, size, style) {
|
|
479
|
+
var _this = _super.call(this, size, (typeof style === 'undefined') ? PdfFontStyle.regular : style) || this;
|
|
480
|
+
_this._fontFamily = fontFamily;
|
|
481
|
+
_this._size = size;
|
|
482
|
+
_this._initializeInternals();
|
|
483
|
+
return _this;
|
|
484
|
+
}
|
|
485
|
+
Object.defineProperty(PdfCjkStandardFont.prototype, "fontFamily", {
|
|
486
|
+
/**
|
|
487
|
+
* Gets the font family of the PDF CJK font.
|
|
488
|
+
*
|
|
489
|
+
* @returns {PdfCjkFontFamily} fontFamily.
|
|
490
|
+
*
|
|
491
|
+
* ```typescript
|
|
492
|
+
* // Load an existing PDF document
|
|
493
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
494
|
+
* // Gets the first page
|
|
495
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
496
|
+
* // Create a new PDF CJK standard font
|
|
497
|
+
* let font: PdfCjkStandardFont = new PdfCjkStandardFont(PdfCjkFontFamily.heiseiMinchoW3, 20);
|
|
498
|
+
* // Gets the font family
|
|
499
|
+
* let fontFamily: PdfCjkFontFamily = font.fontFamily;
|
|
500
|
+
* // Destroy the document
|
|
501
|
+
* document.destroy();
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
get: function () {
|
|
505
|
+
return this._fontFamily;
|
|
506
|
+
},
|
|
507
|
+
enumerable: true,
|
|
508
|
+
configurable: true
|
|
509
|
+
});
|
|
510
|
+
PdfCjkStandardFont.prototype._initializeInternals = function () {
|
|
511
|
+
this._metrics = _PdfCjkStandardFontMetricsFactory._getMetrics(this._fontFamily, this._style, this._size);
|
|
512
|
+
this._dictionary = this._createInternals();
|
|
513
|
+
};
|
|
514
|
+
PdfCjkStandardFont.prototype._createInternals = function () {
|
|
515
|
+
var dictionary = new _PdfDictionary();
|
|
516
|
+
dictionary._updated = true;
|
|
517
|
+
dictionary.set('Type', _PdfName.get('Font'));
|
|
518
|
+
dictionary.set('Subtype', _PdfName.get('Type0'));
|
|
519
|
+
dictionary.set('BaseFont', new _PdfName(this._metrics._postScriptName));
|
|
520
|
+
dictionary.set('Encoding', this._getEncoding(this._fontFamily));
|
|
521
|
+
dictionary.set('DescendantFonts', this._getDescendantFont());
|
|
522
|
+
return dictionary;
|
|
523
|
+
};
|
|
524
|
+
PdfCjkStandardFont.prototype._getEncoding = function (fontFamily) {
|
|
525
|
+
var encoding = 'Unknown';
|
|
526
|
+
switch (fontFamily) {
|
|
527
|
+
case PdfCjkFontFamily.hanyangSystemsGothicMedium:
|
|
528
|
+
case PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:
|
|
529
|
+
encoding = 'UniKS-UCS2-H';
|
|
530
|
+
break;
|
|
531
|
+
case PdfCjkFontFamily.heiseiKakuGothicW5:
|
|
532
|
+
case PdfCjkFontFamily.heiseiMinchoW3:
|
|
533
|
+
encoding = 'UniJIS-UCS2-H';
|
|
534
|
+
break;
|
|
535
|
+
case PdfCjkFontFamily.monotypeHeiMedium:
|
|
536
|
+
case PdfCjkFontFamily.monotypeSungLight:
|
|
537
|
+
encoding = 'UniCNS-UCS2-H';
|
|
538
|
+
break;
|
|
539
|
+
case PdfCjkFontFamily.sinoTypeSongLight:
|
|
540
|
+
encoding = 'UniGB-UCS2-H';
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
return new _PdfName(encoding);
|
|
544
|
+
};
|
|
545
|
+
PdfCjkStandardFont.prototype._getDescendantFont = function () {
|
|
546
|
+
var dictionary = new _PdfDictionary();
|
|
547
|
+
dictionary._updated = true;
|
|
548
|
+
dictionary.set('Type', _PdfName.get('Font'));
|
|
549
|
+
dictionary.set('Subtype', _PdfName.get('CIDFontType2'));
|
|
550
|
+
dictionary.set('BaseFont', new _PdfName(this._metrics._postScriptName));
|
|
551
|
+
dictionary.set('DW', this._metrics._widthTable._defaultWidth);
|
|
552
|
+
dictionary.set('W', this._metrics._widthTable._toArray());
|
|
553
|
+
dictionary.set('FontDescriptor', _PdfCjkFontDescriptorFactory._getFontDescriptor(this._fontFamily, this._style, this._metrics));
|
|
554
|
+
dictionary.set('CIDSystemInfo', this._getSystemInformation());
|
|
555
|
+
return [dictionary];
|
|
556
|
+
};
|
|
557
|
+
PdfCjkStandardFont.prototype._getSystemInformation = function () {
|
|
558
|
+
var systemInformation = new _PdfDictionary();
|
|
559
|
+
systemInformation._updated = true;
|
|
560
|
+
systemInformation.set('Registry', 'Adobe');
|
|
561
|
+
switch (this._fontFamily) {
|
|
562
|
+
case PdfCjkFontFamily.hanyangSystemsGothicMedium:
|
|
563
|
+
case PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:
|
|
564
|
+
systemInformation.set('Ordering', 'Korea1');
|
|
565
|
+
systemInformation.set('Supplement', 1);
|
|
566
|
+
break;
|
|
567
|
+
case PdfCjkFontFamily.heiseiKakuGothicW5:
|
|
568
|
+
case PdfCjkFontFamily.heiseiMinchoW3:
|
|
569
|
+
systemInformation.set('Ordering', 'Japan1');
|
|
570
|
+
systemInformation.set('Supplement', 2);
|
|
571
|
+
break;
|
|
572
|
+
case PdfCjkFontFamily.monotypeHeiMedium:
|
|
573
|
+
case PdfCjkFontFamily.monotypeSungLight:
|
|
574
|
+
systemInformation.set('Ordering', 'CNS1');
|
|
575
|
+
systemInformation.set('Supplement', '0');
|
|
576
|
+
break;
|
|
577
|
+
case PdfCjkFontFamily.sinoTypeSongLight:
|
|
578
|
+
systemInformation.set('Ordering', 'GB1');
|
|
579
|
+
systemInformation.set('Supplement', 2);
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
return systemInformation;
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* Gets the line width.
|
|
586
|
+
*
|
|
587
|
+
* @param {string} line Line.
|
|
588
|
+
* @param {PdfStringFormat} format String format.
|
|
589
|
+
* @returns {number} width.
|
|
590
|
+
*
|
|
591
|
+
* ```typescript
|
|
592
|
+
* // Load an existing PDF document
|
|
593
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
594
|
+
* // Gets the first page
|
|
595
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
596
|
+
* // Create a new PDF CJK standard font
|
|
597
|
+
* let font: PdfCjkStandardFont = new PdfCjkStandardFont(PdfCjkFontFamily.heiseiMinchoW3, 20, PdfFontStyle.bold);
|
|
598
|
+
* // Create a new PDF string format
|
|
599
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
600
|
+
* // Get the text width
|
|
601
|
+
* let width: number = font.getLineWidth('Syncfusion', format);
|
|
602
|
+
* // Save the document
|
|
603
|
+
* document.save('output.pdf');
|
|
604
|
+
* // Destroy the document
|
|
605
|
+
* document.destroy();
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
PdfCjkStandardFont.prototype.getLineWidth = function (line, format) {
|
|
609
|
+
var width = 0;
|
|
610
|
+
for (var i = 0; i < line.length; i++) {
|
|
611
|
+
width += this._getCharacterWidthInternal(line.charCodeAt(i));
|
|
612
|
+
}
|
|
613
|
+
width *= (0.001 * this._metrics._size);
|
|
614
|
+
width = this._applyFormatSettings(line, format, width);
|
|
615
|
+
return width;
|
|
616
|
+
};
|
|
617
|
+
PdfCjkStandardFont.prototype._getCharacterWidthInternal = function (charCode) {
|
|
618
|
+
charCode = (charCode >= 0) ? charCode : 0;
|
|
619
|
+
return this._metrics._widthTable._itemAt(charCode);
|
|
620
|
+
};
|
|
621
|
+
return PdfCjkStandardFont;
|
|
622
|
+
}(PdfFont));
|
|
623
|
+
export { PdfCjkStandardFont };
|
|
624
|
+
/**
|
|
625
|
+
* Represents TrueType font.
|
|
626
|
+
* ```typescript
|
|
627
|
+
* // Load an existing PDF document
|
|
628
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
629
|
+
* // Gets the first page
|
|
630
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
631
|
+
* // Create a new PDF truetype font
|
|
632
|
+
* let font: PdfTrueTypeFont = new PdfTrueTypeFont(base64String, 10);
|
|
633
|
+
* // Create a new PDF string format
|
|
634
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
635
|
+
* // Draw the text
|
|
636
|
+
* page.graphics.drawString('Helvetica', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
637
|
+
* // Save the document
|
|
638
|
+
* document.save('output.pdf');
|
|
639
|
+
* // Destroy the document
|
|
640
|
+
* document.destroy();
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
var PdfTrueTypeFont = /** @class */ (function (_super) {
|
|
644
|
+
__extends(PdfTrueTypeFont, _super);
|
|
645
|
+
function PdfTrueTypeFont(base64String, size, style) {
|
|
646
|
+
var _this = _super.call(this, size, (typeof style === 'undefined') ? PdfFontStyle.regular : style) || this;
|
|
647
|
+
_this._isEmbedFont = false;
|
|
648
|
+
_this._isUnicode = true;
|
|
649
|
+
if (style !== undefined) {
|
|
650
|
+
_this._createFontInternal(base64String, style);
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
_this._createFontInternal(base64String, PdfFontStyle.regular);
|
|
654
|
+
}
|
|
655
|
+
return _this;
|
|
656
|
+
}
|
|
657
|
+
Object.defineProperty(PdfTrueTypeFont.prototype, "isUnicode", {
|
|
658
|
+
/**
|
|
659
|
+
* Gets the boolean flag indicating whether the font has unicode or not.
|
|
660
|
+
*
|
|
661
|
+
* @returns {boolean} unicode.
|
|
662
|
+
*
|
|
663
|
+
* ```typescript
|
|
664
|
+
* // Load an existing PDF document
|
|
665
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
666
|
+
* // Gets the first page
|
|
667
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
668
|
+
* // Create a new PDF truetype font
|
|
669
|
+
* let font: PdfTrueTypeFont = new PdfTrueTypeFont(base64String, 10);
|
|
670
|
+
* // Gets the boolean flag indicating whether the font has or not.
|
|
671
|
+
* let isUnicode: boolean = font.isUnicode;
|
|
672
|
+
* // Destroy the document
|
|
673
|
+
* document.destroy();
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
get: function () {
|
|
677
|
+
return this._isUnicode;
|
|
678
|
+
},
|
|
679
|
+
enumerable: true,
|
|
680
|
+
configurable: true
|
|
681
|
+
});
|
|
682
|
+
Object.defineProperty(PdfTrueTypeFont.prototype, "isEmbed", {
|
|
683
|
+
/**
|
|
684
|
+
* Gets the boolean flag indicating whether the font is embedded or not.
|
|
685
|
+
*
|
|
686
|
+
* @returns {boolean} isEmbed.
|
|
687
|
+
*
|
|
688
|
+
* ```typescript
|
|
689
|
+
* // Load an existing PDF document
|
|
690
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
691
|
+
* // Gets the first page
|
|
692
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
693
|
+
* // Create a new PDF truetype font
|
|
694
|
+
* let font: PdfTrueTypeFont = new PdfTrueTypeFont(base64String, 10);
|
|
695
|
+
* // Gets the boolean flag indicating whether the font is embedded or not.
|
|
696
|
+
* let isEmbed: boolean = font.isEmbed;
|
|
697
|
+
* // Destroy the document
|
|
698
|
+
* document.destroy();
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
get: function () {
|
|
702
|
+
return this._isEmbedFont;
|
|
703
|
+
},
|
|
704
|
+
enumerable: true,
|
|
705
|
+
configurable: true
|
|
706
|
+
});
|
|
707
|
+
PdfTrueTypeFont.prototype._createFontInternal = function (base64String, style) {
|
|
708
|
+
this._fontInternal = new _UnicodeTrueTypeFont(base64String, this._size);
|
|
709
|
+
this._calculateStyle(style);
|
|
710
|
+
this._initializeInternals();
|
|
711
|
+
};
|
|
712
|
+
PdfTrueTypeFont.prototype._calculateStyle = function (style) {
|
|
713
|
+
var iStyle = this._fontInternal._ttfMetrics._macStyle;
|
|
714
|
+
if ((style & PdfFontStyle.underline) !== 0) {
|
|
715
|
+
iStyle |= PdfFontStyle.underline;
|
|
716
|
+
}
|
|
717
|
+
if ((style & PdfFontStyle.strikeout) !== 0) {
|
|
718
|
+
iStyle |= PdfFontStyle.strikeout;
|
|
719
|
+
}
|
|
720
|
+
this.style = iStyle;
|
|
721
|
+
};
|
|
722
|
+
PdfTrueTypeFont.prototype._initializeInternals = function () {
|
|
723
|
+
var internals = null;
|
|
724
|
+
if (this._fontInternal instanceof _UnicodeTrueTypeFont) {
|
|
725
|
+
this._fontInternal._isEmbed = this._isEmbedFont;
|
|
726
|
+
}
|
|
727
|
+
this._fontInternal._createInternals();
|
|
728
|
+
internals = this._fontInternal._getInternals();
|
|
729
|
+
this._metrics = this._fontInternal._metrics;
|
|
730
|
+
this._metrics._isUnicodeFont = true;
|
|
731
|
+
this._setInternals(internals);
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* Gets the line width.
|
|
735
|
+
*
|
|
736
|
+
* @param {string} line Line.
|
|
737
|
+
* @param {PdfStringFormat} format String format.
|
|
738
|
+
* @returns {number} width.
|
|
739
|
+
*
|
|
740
|
+
* ```typescript
|
|
741
|
+
* // Load an existing PDF document
|
|
742
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
743
|
+
* // Gets the first page
|
|
744
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
745
|
+
* // Create a new PDF truetype font
|
|
746
|
+
* let font: PdfTrueTypeFont = new PdfTrueTypeFont(base64String, 10, PdfFontStyle.regular);
|
|
747
|
+
* // Create a new PDF string format
|
|
748
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
749
|
+
* // Get the text width
|
|
750
|
+
* let width: number = font.getLineWidth('Syncfusion', format);
|
|
751
|
+
* // Save the document
|
|
752
|
+
* document.save('output.pdf');
|
|
753
|
+
* // Destroy the document
|
|
754
|
+
* document.destroy();
|
|
755
|
+
* ```
|
|
756
|
+
*/
|
|
757
|
+
PdfTrueTypeFont.prototype.getLineWidth = function (line, format) {
|
|
758
|
+
var width = 0;
|
|
759
|
+
if (format !== null && typeof format !== 'undefined' && format.textDirection !== PdfTextDirection.none) {
|
|
760
|
+
width = this._getUnicodeLineWidth(line, width);
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
for (var i = 0, len = line.length; i < len; i++) {
|
|
764
|
+
width += this._getCharacterWidthInternal(line[Number.parseInt(i.toString(), 10)]);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
width *= (0.001 * this._metrics._size);
|
|
768
|
+
width = this._applyFormatSettings(line, format, width);
|
|
769
|
+
return width;
|
|
770
|
+
};
|
|
771
|
+
PdfTrueTypeFont.prototype._getUnicodeLineWidth = function (line, width) {
|
|
772
|
+
width = 0;
|
|
773
|
+
var glyphIndex = [];
|
|
774
|
+
var result = false;
|
|
775
|
+
var rtlRender = new _RtlRenderer();
|
|
776
|
+
var value = rtlRender._getGlyphIndex(line, this, glyphIndex);
|
|
777
|
+
result = value._result;
|
|
778
|
+
glyphIndex = value._glyphIndex;
|
|
779
|
+
if (result && glyphIndex !== null) {
|
|
780
|
+
var ttfReader = this._fontInternal._ttfReader;
|
|
781
|
+
for (var i = 0, len = glyphIndex.length; i < len; i++) {
|
|
782
|
+
var index = glyphIndex[Number.parseInt(i.toString(), 10)];
|
|
783
|
+
var glyph = ttfReader._getGlyph(index);
|
|
784
|
+
if (glyph !== null && typeof glyph !== 'undefined') {
|
|
785
|
+
width += glyph._width;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return width;
|
|
790
|
+
};
|
|
791
|
+
PdfTrueTypeFont.prototype._getCharacterWidth = function (charCode, format) {
|
|
792
|
+
var codeWidth = this._fontInternal._getCharacterWidth(charCode);
|
|
793
|
+
var size = this._metrics._getSize(format);
|
|
794
|
+
codeWidth *= (0.001 * size);
|
|
795
|
+
return codeWidth;
|
|
796
|
+
};
|
|
797
|
+
PdfTrueTypeFont.prototype._setSymbols = function (text) {
|
|
798
|
+
var internalFont = this._fontInternal;
|
|
799
|
+
if (internalFont !== null && typeof internalFont !== 'undefined') {
|
|
800
|
+
internalFont._setSymbols(text);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
PdfTrueTypeFont.prototype._getCharacterWidthInternal = function (charCode) {
|
|
804
|
+
var width = 0;
|
|
805
|
+
var code = 0;
|
|
806
|
+
code = charCode.charCodeAt(0);
|
|
807
|
+
if (this._metrics._name === '0' ||
|
|
808
|
+
this._metrics._name === '1' ||
|
|
809
|
+
this._metrics._name === '2' ||
|
|
810
|
+
this._metrics._name === '3' ||
|
|
811
|
+
this._metrics._name === '4') {
|
|
812
|
+
code = code - 32;
|
|
813
|
+
}
|
|
814
|
+
code = (code >= 0 && code !== 128) ? code : 0;
|
|
815
|
+
var widthTable = this._metrics._widthTable;
|
|
816
|
+
width = widthTable._itemAt(code);
|
|
817
|
+
return width;
|
|
818
|
+
};
|
|
819
|
+
return PdfTrueTypeFont;
|
|
820
|
+
}(PdfFont));
|
|
821
|
+
export { PdfTrueTypeFont };
|
|
822
|
+
var _PdfStandardFontMetricsFactory = /** @class */ (function () {
|
|
823
|
+
function _PdfStandardFontMetricsFactory() {
|
|
824
|
+
}
|
|
825
|
+
_PdfStandardFontMetricsFactory._getMetrics = function (fontFamily, fontStyle, size) {
|
|
826
|
+
var metrics = null;
|
|
827
|
+
switch (fontFamily) {
|
|
828
|
+
case PdfFontFamily.helvetica:
|
|
829
|
+
metrics = this._getHelveticaMetrics(fontStyle, size);
|
|
830
|
+
break;
|
|
831
|
+
case PdfFontFamily.courier:
|
|
832
|
+
metrics = this._getCourierMetrics(fontStyle, size);
|
|
833
|
+
break;
|
|
834
|
+
case PdfFontFamily.timesRoman:
|
|
835
|
+
metrics = this._getTimesMetrics(fontStyle, size);
|
|
836
|
+
break;
|
|
837
|
+
case PdfFontFamily.symbol:
|
|
838
|
+
metrics = this._getSymbolMetrics(size);
|
|
839
|
+
break;
|
|
840
|
+
case PdfFontFamily.zapfDingbats:
|
|
841
|
+
metrics = this._getZapfDingbatsMetrics(size);
|
|
842
|
+
break;
|
|
843
|
+
default:
|
|
844
|
+
metrics = this._getHelveticaMetrics(fontStyle, size);
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
metrics._name = fontFamily.toString();
|
|
848
|
+
metrics._subScriptSizeFactor = this._subSuperScriptFactor;
|
|
849
|
+
metrics._superscriptSizeFactor = this._subSuperScriptFactor;
|
|
850
|
+
return metrics;
|
|
851
|
+
};
|
|
852
|
+
_PdfStandardFontMetricsFactory._getHelveticaMetrics = function (fontStyle, size) {
|
|
853
|
+
var metrics = new _PdfFontMetrics();
|
|
854
|
+
if ((fontStyle & PdfFontStyle.bold) > 0 && (fontStyle & PdfFontStyle.italic) > 0) {
|
|
855
|
+
metrics._ascent = this._helveticaBoldItalicAscent;
|
|
856
|
+
metrics._descent = this._helveticaBoldItalicDescent;
|
|
857
|
+
metrics._postScriptName = this._helveticaBoldItalicName;
|
|
858
|
+
metrics._size = size;
|
|
859
|
+
metrics._widthTable = new _StandardWidthTable(this._arialBoldWidth);
|
|
860
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
861
|
+
}
|
|
862
|
+
else if ((fontStyle & PdfFontStyle.bold) > 0) {
|
|
863
|
+
metrics._ascent = this._helveticaBoldAscent;
|
|
864
|
+
metrics._descent = this._helveticaBoldDescent;
|
|
865
|
+
metrics._postScriptName = this._helveticaBoldName;
|
|
866
|
+
metrics._size = size;
|
|
867
|
+
metrics._widthTable = new _StandardWidthTable(this._arialBoldWidth);
|
|
868
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
869
|
+
}
|
|
870
|
+
else if ((fontStyle & PdfFontStyle.italic) > 0) {
|
|
871
|
+
metrics._ascent = this._helveticaItalicAscent;
|
|
872
|
+
metrics._descent = this._helveticaItalicDescent;
|
|
873
|
+
metrics._postScriptName = this._helveticaItalicName;
|
|
874
|
+
metrics._size = size;
|
|
875
|
+
metrics._widthTable = new _StandardWidthTable(this._arialWidth);
|
|
876
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
metrics._ascent = this._helveticaAscent;
|
|
880
|
+
metrics._descent = this._helveticaDescent;
|
|
881
|
+
metrics._postScriptName = this._helveticaName;
|
|
882
|
+
metrics._size = size;
|
|
883
|
+
metrics._widthTable = new _StandardWidthTable(this._arialWidth);
|
|
884
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
885
|
+
}
|
|
886
|
+
return metrics;
|
|
887
|
+
};
|
|
888
|
+
_PdfStandardFontMetricsFactory._getCourierMetrics = function (fontStyle, size) {
|
|
889
|
+
var metrics = new _PdfFontMetrics();
|
|
890
|
+
if ((fontStyle & PdfFontStyle.bold) > 0 && (fontStyle & PdfFontStyle.italic) > 0) {
|
|
891
|
+
metrics._ascent = this._courierBoldItalicAscent;
|
|
892
|
+
metrics._descent = this._courierBoldItalicDescent;
|
|
893
|
+
metrics._postScriptName = this._courierBoldItalicName;
|
|
894
|
+
metrics._size = size;
|
|
895
|
+
metrics._widthTable = new _StandardWidthTable(this._fixedWidth);
|
|
896
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
897
|
+
}
|
|
898
|
+
else if ((fontStyle & PdfFontStyle.bold) > 0) {
|
|
899
|
+
metrics._ascent = this._courierBoldAscent;
|
|
900
|
+
metrics._descent = this._courierBoldDescent;
|
|
901
|
+
metrics._postScriptName = this._courierBoldName;
|
|
902
|
+
metrics._size = size;
|
|
903
|
+
metrics._widthTable = new _StandardWidthTable(this._fixedWidth);
|
|
904
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
905
|
+
}
|
|
906
|
+
else if ((fontStyle & PdfFontStyle.italic) > 0) {
|
|
907
|
+
metrics._ascent = this._courierItalicAscent;
|
|
908
|
+
metrics._descent = this._courierItalicDescent;
|
|
909
|
+
metrics._postScriptName = this._courierItalicName;
|
|
910
|
+
metrics._size = size;
|
|
911
|
+
metrics._widthTable = new _StandardWidthTable(this._fixedWidth);
|
|
912
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
metrics._ascent = this._courierAscent;
|
|
916
|
+
metrics._descent = this._courierDescent;
|
|
917
|
+
metrics._postScriptName = this._courierName;
|
|
918
|
+
metrics._size = size;
|
|
919
|
+
metrics._widthTable = new _StandardWidthTable(this._fixedWidth);
|
|
920
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
921
|
+
}
|
|
922
|
+
return metrics;
|
|
923
|
+
};
|
|
924
|
+
_PdfStandardFontMetricsFactory._getTimesMetrics = function (fontStyle, size) {
|
|
925
|
+
var metrics = new _PdfFontMetrics();
|
|
926
|
+
if ((fontStyle & PdfFontStyle.bold) > 0 && (fontStyle & PdfFontStyle.italic) > 0) {
|
|
927
|
+
metrics._ascent = this._timesBoldItalicAscent;
|
|
928
|
+
metrics._descent = this._timesBoldItalicDescent;
|
|
929
|
+
metrics._postScriptName = this._timesBoldItalicName;
|
|
930
|
+
metrics._size = size;
|
|
931
|
+
metrics._widthTable = new _StandardWidthTable(this._timesRomanBoldItalicWidths);
|
|
932
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
933
|
+
}
|
|
934
|
+
else if ((fontStyle & PdfFontStyle.bold) > 0) {
|
|
935
|
+
metrics._ascent = this._timesBoldAscent;
|
|
936
|
+
metrics._descent = this._timesBoldDescent;
|
|
937
|
+
metrics._postScriptName = this._timesBoldName;
|
|
938
|
+
metrics._size = size;
|
|
939
|
+
metrics._widthTable = new _StandardWidthTable(this._timesRomanBoldWidth);
|
|
940
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
941
|
+
}
|
|
942
|
+
else if ((fontStyle & PdfFontStyle.italic) > 0) {
|
|
943
|
+
metrics._ascent = this._timesItalicAscent;
|
|
944
|
+
metrics._descent = this._timesItalicDescent;
|
|
945
|
+
metrics._postScriptName = this._timesItalicName;
|
|
946
|
+
metrics._size = size;
|
|
947
|
+
metrics._widthTable = new _StandardWidthTable(this._timesRomanItalicWidth);
|
|
948
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
metrics._ascent = this._timesAscent;
|
|
952
|
+
metrics._descent = this._timesDescent;
|
|
953
|
+
metrics._postScriptName = this._timesName;
|
|
954
|
+
metrics._size = size;
|
|
955
|
+
metrics._widthTable = new _StandardWidthTable(this._timesRomanWidth);
|
|
956
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
957
|
+
}
|
|
958
|
+
return metrics;
|
|
959
|
+
};
|
|
960
|
+
_PdfStandardFontMetricsFactory._getSymbolMetrics = function (size) {
|
|
961
|
+
var metrics = new _PdfFontMetrics();
|
|
962
|
+
metrics._ascent = this._symbolAscent;
|
|
963
|
+
metrics._descent = this._symbolDescent;
|
|
964
|
+
metrics._postScriptName = this._symbolName;
|
|
965
|
+
metrics._size = size;
|
|
966
|
+
metrics._widthTable = new _StandardWidthTable(this._symbolWidth);
|
|
967
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
968
|
+
return metrics;
|
|
969
|
+
};
|
|
970
|
+
_PdfStandardFontMetricsFactory._getZapfDingbatsMetrics = function (size) {
|
|
971
|
+
var metrics = new _PdfFontMetrics();
|
|
972
|
+
metrics._ascent = this._zapfDingbatsAscent;
|
|
973
|
+
metrics._descent = this._zapfDingbatsDescent;
|
|
974
|
+
metrics._postScriptName = this._zapfDingbatsName;
|
|
975
|
+
metrics._size = size;
|
|
976
|
+
metrics._widthTable = new _StandardWidthTable(this._zapfDingbatsWidth);
|
|
977
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
978
|
+
return metrics;
|
|
979
|
+
};
|
|
980
|
+
_PdfStandardFontMetricsFactory._subSuperScriptFactor = 1.52;
|
|
981
|
+
_PdfStandardFontMetricsFactory._helveticaAscent = 931;
|
|
982
|
+
_PdfStandardFontMetricsFactory._helveticaDescent = -225;
|
|
983
|
+
_PdfStandardFontMetricsFactory._helveticaName = 'Helvetica';
|
|
984
|
+
_PdfStandardFontMetricsFactory._helveticaBoldAscent = 962;
|
|
985
|
+
_PdfStandardFontMetricsFactory._helveticaBoldDescent = -228;
|
|
986
|
+
_PdfStandardFontMetricsFactory._helveticaBoldName = 'Helvetica-Bold';
|
|
987
|
+
_PdfStandardFontMetricsFactory._helveticaItalicAscent = 931;
|
|
988
|
+
_PdfStandardFontMetricsFactory._helveticaItalicDescent = -225;
|
|
989
|
+
_PdfStandardFontMetricsFactory._helveticaItalicName = 'Helvetica-Oblique';
|
|
990
|
+
_PdfStandardFontMetricsFactory._helveticaBoldItalicAscent = 962;
|
|
991
|
+
_PdfStandardFontMetricsFactory._helveticaBoldItalicDescent = -228;
|
|
992
|
+
_PdfStandardFontMetricsFactory._helveticaBoldItalicName = 'Helvetica-BoldOblique';
|
|
993
|
+
_PdfStandardFontMetricsFactory._courierAscent = 805;
|
|
994
|
+
_PdfStandardFontMetricsFactory._courierDescent = -250;
|
|
995
|
+
_PdfStandardFontMetricsFactory._courierName = 'Courier';
|
|
996
|
+
_PdfStandardFontMetricsFactory._courierBoldAscent = 801;
|
|
997
|
+
_PdfStandardFontMetricsFactory._courierBoldDescent = -250;
|
|
998
|
+
_PdfStandardFontMetricsFactory._courierBoldName = 'Courier-Bold';
|
|
999
|
+
_PdfStandardFontMetricsFactory._courierItalicAscent = 805;
|
|
1000
|
+
_PdfStandardFontMetricsFactory._courierItalicDescent = -250;
|
|
1001
|
+
_PdfStandardFontMetricsFactory._courierItalicName = 'Courier-Oblique';
|
|
1002
|
+
_PdfStandardFontMetricsFactory._courierBoldItalicAscent = 801;
|
|
1003
|
+
_PdfStandardFontMetricsFactory._courierBoldItalicDescent = -250;
|
|
1004
|
+
_PdfStandardFontMetricsFactory._courierBoldItalicName = 'Courier-BoldOblique';
|
|
1005
|
+
_PdfStandardFontMetricsFactory._timesAscent = 898;
|
|
1006
|
+
_PdfStandardFontMetricsFactory._timesDescent = -218;
|
|
1007
|
+
_PdfStandardFontMetricsFactory._timesName = 'Times-Roman';
|
|
1008
|
+
_PdfStandardFontMetricsFactory._timesBoldAscent = 935;
|
|
1009
|
+
_PdfStandardFontMetricsFactory._timesBoldDescent = -218;
|
|
1010
|
+
_PdfStandardFontMetricsFactory._timesBoldName = 'Times-Bold';
|
|
1011
|
+
_PdfStandardFontMetricsFactory._timesItalicAscent = 883;
|
|
1012
|
+
_PdfStandardFontMetricsFactory._timesItalicDescent = -217;
|
|
1013
|
+
_PdfStandardFontMetricsFactory._timesItalicName = 'Times-Italic';
|
|
1014
|
+
_PdfStandardFontMetricsFactory._timesBoldItalicAscent = 921;
|
|
1015
|
+
_PdfStandardFontMetricsFactory._timesBoldItalicDescent = -218;
|
|
1016
|
+
_PdfStandardFontMetricsFactory._timesBoldItalicName = 'Times-BoldItalic';
|
|
1017
|
+
_PdfStandardFontMetricsFactory._symbolAscent = 1010;
|
|
1018
|
+
_PdfStandardFontMetricsFactory._symbolDescent = -293;
|
|
1019
|
+
_PdfStandardFontMetricsFactory._symbolName = 'Symbol';
|
|
1020
|
+
_PdfStandardFontMetricsFactory._zapfDingbatsAscent = 820;
|
|
1021
|
+
_PdfStandardFontMetricsFactory._zapfDingbatsDescent = -143;
|
|
1022
|
+
_PdfStandardFontMetricsFactory._zapfDingbatsName = 'ZapfDingbats';
|
|
1023
|
+
_PdfStandardFontMetricsFactory._arialWidth = [
|
|
1024
|
+
278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333,
|
|
1025
|
+
278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584,
|
|
1026
|
+
584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833,
|
|
1027
|
+
722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278,
|
|
1028
|
+
469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833,
|
|
1029
|
+
556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334,
|
|
1030
|
+
584, 0, 556, 0, 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, 1000, 0,
|
|
1031
|
+
611, 0, 0, 222, 222, 333, 333, 350, 556, 1000, 333, 1000, 500, 333, 944, 0,
|
|
1032
|
+
500, 667, 0, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 0,
|
|
1033
|
+
737, 333, 400, 584, 333, 333, 333, 556, 537, 278, 333, 333, 365, 556, 834, 834,
|
|
1034
|
+
834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278,
|
|
1035
|
+
278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667,
|
|
1036
|
+
667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278,
|
|
1037
|
+
278, 278, 556, 556, 556, 556, 556, 556, 556, 584, 611, 556, 556, 556, 556, 500,
|
|
1038
|
+
556, 500
|
|
1039
|
+
];
|
|
1040
|
+
_PdfStandardFontMetricsFactory._arialBoldWidth = [
|
|
1041
|
+
278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333,
|
|
1042
|
+
278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584,
|
|
1043
|
+
584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833,
|
|
1044
|
+
722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333,
|
|
1045
|
+
584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889,
|
|
1046
|
+
611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389,
|
|
1047
|
+
584, 0, 556, 0, 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, 1000, 0,
|
|
1048
|
+
611, 0, 0, 278, 278, 500, 500, 350, 556, 1000, 333, 1000, 556, 333, 944, 0,
|
|
1049
|
+
500, 667, 0, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 0,
|
|
1050
|
+
737, 333, 400, 584, 333, 333, 333, 611, 556, 278, 333, 333, 365, 556, 834, 834,
|
|
1051
|
+
834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278,
|
|
1052
|
+
278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667,
|
|
1053
|
+
667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278,
|
|
1054
|
+
278, 278, 611, 611, 611, 611, 611, 611, 611, 584, 611, 611, 611, 611, 611, 556,
|
|
1055
|
+
611, 556
|
|
1056
|
+
];
|
|
1057
|
+
_PdfStandardFontMetricsFactory._fixedWidth = [
|
|
1058
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1059
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1060
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1061
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1062
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1063
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1064
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1065
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1066
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1067
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1068
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1069
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1070
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
|
|
1071
|
+
600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600
|
|
1072
|
+
];
|
|
1073
|
+
_PdfStandardFontMetricsFactory._timesRomanWidth = [
|
|
1074
|
+
250, 333, 408, 500, 500, 833, 778, 180, 333, 333, 500, 564, 250, 333,
|
|
1075
|
+
250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 564, 564,
|
|
1076
|
+
564, 444, 921, 722, 667, 667, 722, 611, 556, 722, 722, 333, 389, 722, 611, 889,
|
|
1077
|
+
722, 722, 556, 722, 667, 556, 611, 722, 722, 944, 722, 722, 611, 333, 278, 333,
|
|
1078
|
+
469, 500, 333, 444, 500, 444, 500, 444, 333, 500, 500, 278, 278, 500, 278, 778,
|
|
1079
|
+
500, 500, 500, 500, 333, 389, 278, 500, 500, 722, 500, 500, 444, 480, 200, 480,
|
|
1080
|
+
541, 0, 500, 0, 333, 500, 444, 1000, 500, 500, 333, 1000, 556, 333, 889, 0,
|
|
1081
|
+
611, 0, 0, 333, 333, 444, 444, 350, 500, 1000, 333, 980, 389, 333, 722, 0,
|
|
1082
|
+
444, 722, 0, 333, 500, 500, 500, 500, 200, 500, 333, 760, 276, 500, 564, 0,
|
|
1083
|
+
760, 333, 400, 564, 300, 300, 333, 500, 453, 250, 333, 300, 310, 500, 750, 750,
|
|
1084
|
+
750, 444, 722, 722, 722, 722, 722, 722, 889, 667, 611, 611, 611, 611, 333, 333,
|
|
1085
|
+
333, 333, 722, 722, 722, 722, 722, 722, 722, 564, 722, 722, 722, 722, 722, 722,
|
|
1086
|
+
556, 500, 444, 444, 444, 444, 444, 444, 667, 444, 444, 444, 444, 444, 278, 278,
|
|
1087
|
+
278, 278, 500, 500, 500, 500, 500, 500, 500, 564, 500, 500, 500, 500, 500, 500,
|
|
1088
|
+
500, 500
|
|
1089
|
+
];
|
|
1090
|
+
_PdfStandardFontMetricsFactory._timesRomanBoldWidth = [
|
|
1091
|
+
250, 333, 555, 500, 500, 1000, 833, 278, 333, 333, 500, 570, 250, 333,
|
|
1092
|
+
250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570,
|
|
1093
|
+
570, 500, 930, 722, 667, 722, 722, 667, 611, 778, 778, 389, 500, 778, 667, 944,
|
|
1094
|
+
722, 778, 611, 778, 722, 556, 667, 722, 722, 1000, 722, 722, 667, 333, 278, 333,
|
|
1095
|
+
581, 500, 333, 500, 556, 444, 556, 444, 333, 500, 556, 278, 333, 556, 278, 833,
|
|
1096
|
+
556, 500, 556, 556, 444, 389, 333, 556, 500, 722, 500, 500, 444, 394, 220, 394,
|
|
1097
|
+
520, 0, 500, 0, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 1000, 0,
|
|
1098
|
+
667, 0, 0, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 0,
|
|
1099
|
+
444, 722, 0, 333, 500, 500, 500, 500, 220, 500, 333, 747, 300, 500, 570, 0,
|
|
1100
|
+
747, 333, 400, 570, 300, 300, 333, 556, 540, 250, 333, 300, 330, 500, 750, 750,
|
|
1101
|
+
750, 500, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 389, 389,
|
|
1102
|
+
389, 389, 722, 722, 778, 778, 778, 778, 778, 570, 778, 722, 722, 722, 722, 722,
|
|
1103
|
+
611, 556, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278,
|
|
1104
|
+
278, 278, 500, 556, 500, 500, 500, 500, 500, 570, 500, 556, 556, 556, 556, 500,
|
|
1105
|
+
556, 500
|
|
1106
|
+
];
|
|
1107
|
+
_PdfStandardFontMetricsFactory._timesRomanItalicWidth = [
|
|
1108
|
+
250, 333, 420, 500, 500, 833, 778, 214, 333, 333, 500, 675, 250, 333,
|
|
1109
|
+
250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 675, 675,
|
|
1110
|
+
675, 500, 920, 611, 611, 667, 722, 611, 611, 722, 722, 333, 444, 667, 556, 833,
|
|
1111
|
+
667, 722, 611, 722, 611, 500, 556, 722, 611, 833, 611, 556, 556, 389, 278, 389,
|
|
1112
|
+
422, 500, 333, 500, 500, 444, 500, 444, 278, 500, 500, 278, 278, 444, 278, 722,
|
|
1113
|
+
500, 500, 500, 500, 389, 389, 278, 500, 444, 667, 444, 444, 389, 400, 275, 400,
|
|
1114
|
+
541, 0, 500, 0, 333, 500, 556, 889, 500, 500, 333, 1000, 500, 333, 944, 0,
|
|
1115
|
+
556, 0, 0, 333, 333, 556, 556, 350, 500, 889, 333, 980, 389, 333, 667, 0,
|
|
1116
|
+
389, 556, 0, 389, 500, 500, 500, 500, 275, 500, 333, 760, 276, 500, 675, 0,
|
|
1117
|
+
760, 333, 400, 675, 300, 300, 333, 500, 523, 250, 333, 300, 310, 500, 750, 750,
|
|
1118
|
+
750, 500, 611, 611, 611, 611, 611, 611, 889, 667, 611, 611, 611, 611, 333, 333,
|
|
1119
|
+
333, 333, 722, 667, 722, 722, 722, 722, 722, 675, 722, 722, 722, 722, 722, 556,
|
|
1120
|
+
611, 500, 500, 500, 500, 500, 500, 500, 667, 444, 444, 444, 444, 444, 278, 278,
|
|
1121
|
+
278, 278, 500, 500, 500, 500, 500, 500, 500, 675, 500, 500, 500, 500, 500, 444,
|
|
1122
|
+
500, 444
|
|
1123
|
+
];
|
|
1124
|
+
_PdfStandardFontMetricsFactory._timesRomanBoldItalicWidths = [
|
|
1125
|
+
250, 389, 555, 500, 500, 833, 778, 278, 333, 333, 500, 570, 250, 333,
|
|
1126
|
+
250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570,
|
|
1127
|
+
570, 500, 832, 667, 667, 667, 722, 667, 667, 722, 778, 389, 500, 667, 611, 889,
|
|
1128
|
+
722, 722, 611, 722, 667, 556, 611, 722, 667, 889, 667, 611, 611, 333, 278, 333,
|
|
1129
|
+
570, 500, 333, 500, 500, 444, 500, 444, 333, 500, 556, 278, 278, 500, 278, 778,
|
|
1130
|
+
556, 500, 500, 500, 389, 389, 278, 556, 444, 667, 500, 444, 389, 348, 220, 348,
|
|
1131
|
+
570, 0, 500, 0, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 944, 0,
|
|
1132
|
+
611, 0, 0, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 0,
|
|
1133
|
+
389, 611, 0, 389, 500, 500, 500, 500, 220, 500, 333, 747, 266, 500, 606, 0,
|
|
1134
|
+
747, 333, 400, 570, 300, 300, 333, 576, 500, 250, 333, 300, 300, 500, 750, 750,
|
|
1135
|
+
750, 500, 667, 667, 667, 667, 667, 667, 944, 667, 667, 667, 667, 667, 389, 389,
|
|
1136
|
+
389, 389, 722, 722, 722, 722, 722, 722, 722, 570, 722, 722, 722, 722, 722, 611,
|
|
1137
|
+
611, 500, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278,
|
|
1138
|
+
278, 278, 500, 556, 500, 500, 500, 500, 500, 570, 500, 556, 556, 556, 556, 444,
|
|
1139
|
+
500, 444
|
|
1140
|
+
];
|
|
1141
|
+
_PdfStandardFontMetricsFactory._symbolWidth = [
|
|
1142
|
+
250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549,
|
|
1143
|
+
250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278,
|
|
1144
|
+
549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333,
|
|
1145
|
+
631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768,
|
|
1146
|
+
645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439,
|
|
1147
|
+
521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603,
|
|
1148
|
+
439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 750, 620, 247,
|
|
1149
|
+
549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400,
|
|
1150
|
+
549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000,
|
|
1151
|
+
658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713,
|
|
1152
|
+
713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603,
|
|
1153
|
+
1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384,
|
|
1154
|
+
384, 384, 384, 494, 494, 494, 494, 329, 274, 686, 686, 686, 384, 384,
|
|
1155
|
+
384, 384, 384, 384, 494, 494, 494, -1
|
|
1156
|
+
];
|
|
1157
|
+
_PdfStandardFontMetricsFactory._zapfDingbatsWidth = [
|
|
1158
|
+
278, 974, 961, 974, 980, 719, 789, 790, 791, 690, 960, 939, 549, 855,
|
|
1159
|
+
911, 933, 911, 945, 974, 755, 846, 762, 761, 571, 677, 763, 760, 759,
|
|
1160
|
+
754, 494, 552, 537, 577, 692, 786, 788, 788, 790, 793, 794, 816, 823,
|
|
1161
|
+
789, 841, 823, 833, 816, 831, 923, 744, 723, 749, 790, 792, 695, 776,
|
|
1162
|
+
768, 792, 759, 707, 708, 682, 701, 826, 815, 789, 789, 707, 687, 696,
|
|
1163
|
+
689, 786, 787, 713, 791, 785, 791, 873, 761, 762, 762, 759, 759, 892,
|
|
1164
|
+
892, 788, 784, 438, 138, 277, 415, 392, 392, 668, 668, 390, 390, 317,
|
|
1165
|
+
317, 276, 276, 509, 509, 410, 410, 234, 234, 334, 334, 732, 544, 544,
|
|
1166
|
+
910, 667, 760, 760, 776, 595, 694, 626, 788, 788, 788, 788, 788, 788,
|
|
1167
|
+
788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788,
|
|
1168
|
+
788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788,
|
|
1169
|
+
788, 788, 788, 788, 788, 788, 894, 838, 1016, 458, 748, 924, 748, 918,
|
|
1170
|
+
927, 928, 928, 834, 873, 828, 924, 924, 917, 930, 931, 463, 883, 836,
|
|
1171
|
+
836, 867, 867, 696, 696, 874, 874, 760, 946, 771, 865, 771, 888, 967,
|
|
1172
|
+
888, 831, 873, 927, 970, 918
|
|
1173
|
+
];
|
|
1174
|
+
return _PdfStandardFontMetricsFactory;
|
|
1175
|
+
}());
|
|
1176
|
+
export { _PdfStandardFontMetricsFactory };
|
|
1177
|
+
var _PdfCjkStandardFontMetricsFactory = /** @class */ (function () {
|
|
1178
|
+
function _PdfCjkStandardFontMetricsFactory() {
|
|
1179
|
+
}
|
|
1180
|
+
_PdfCjkStandardFontMetricsFactory._getHanyangSystemsGothicMedium = function (fontStyle, size) {
|
|
1181
|
+
var metrics = new _PdfFontMetrics();
|
|
1182
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1183
|
+
widthTable._add(new _CjkSameWidth(1, 127, 500));
|
|
1184
|
+
widthTable._add(new _CjkSameWidth(8094, 8190, 500));
|
|
1185
|
+
metrics._widthTable = widthTable;
|
|
1186
|
+
metrics._ascent = 880;
|
|
1187
|
+
metrics._descent = -120;
|
|
1188
|
+
metrics._size = size;
|
|
1189
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1190
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1191
|
+
metrics._postScriptName = 'HYGoThic-Medium,BoldItalic';
|
|
1192
|
+
}
|
|
1193
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1194
|
+
metrics._postScriptName = 'HYGoThic-Medium,Bold';
|
|
1195
|
+
}
|
|
1196
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1197
|
+
metrics._postScriptName = 'HYGoThic-Medium,Italic';
|
|
1198
|
+
}
|
|
1199
|
+
else {
|
|
1200
|
+
metrics._postScriptName = 'HYGoThic-Medium';
|
|
1201
|
+
}
|
|
1202
|
+
return metrics;
|
|
1203
|
+
};
|
|
1204
|
+
_PdfCjkStandardFontMetricsFactory._getHanyangSystemsShinMyeongJoMedium = function (fontStyle, size) {
|
|
1205
|
+
var metrics = new _PdfFontMetrics();
|
|
1206
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1207
|
+
widthTable._add(new _CjkSameWidth(1, 95, 500));
|
|
1208
|
+
widthTable._add(new _CjkSameWidth(8094, 8190, 500));
|
|
1209
|
+
metrics._widthTable = widthTable;
|
|
1210
|
+
metrics._ascent = 880;
|
|
1211
|
+
metrics._descent = -120;
|
|
1212
|
+
metrics._size = size;
|
|
1213
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1214
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1215
|
+
metrics._postScriptName = 'HYSMyeongJo-Medium,BoldItalic';
|
|
1216
|
+
}
|
|
1217
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1218
|
+
metrics._postScriptName = 'HYSMyeongJo-Medium,Bold';
|
|
1219
|
+
}
|
|
1220
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1221
|
+
metrics._postScriptName = 'HYSMyeongJo-Medium,Italic';
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1224
|
+
metrics._postScriptName = 'HYSMyeongJo-Medium';
|
|
1225
|
+
}
|
|
1226
|
+
return metrics;
|
|
1227
|
+
};
|
|
1228
|
+
_PdfCjkStandardFontMetricsFactory._getHeiseiKakuGothicW5 = function (fontStyle, size) {
|
|
1229
|
+
var metrics = new _PdfFontMetrics();
|
|
1230
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1231
|
+
widthTable._add(new _CjkSameWidth(1, 95, 500));
|
|
1232
|
+
widthTable._add(new _CjkSameWidth(231, 632, 500));
|
|
1233
|
+
metrics._widthTable = widthTable;
|
|
1234
|
+
metrics._ascent = 857;
|
|
1235
|
+
metrics._descent = -125;
|
|
1236
|
+
metrics._size = size;
|
|
1237
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1238
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1239
|
+
metrics._postScriptName = 'HeiseiKakuGo-W5,BoldItalic';
|
|
1240
|
+
}
|
|
1241
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1242
|
+
metrics._postScriptName = 'HeiseiKakuGo-W5,Bold';
|
|
1243
|
+
}
|
|
1244
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1245
|
+
metrics._postScriptName = 'HeiseiKakuGo-W5,Italic';
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
metrics._postScriptName = 'HeiseiKakuGo-W5';
|
|
1249
|
+
}
|
|
1250
|
+
return metrics;
|
|
1251
|
+
};
|
|
1252
|
+
_PdfCjkStandardFontMetricsFactory._getHeiseiMinchoW3 = function (fontStyle, size) {
|
|
1253
|
+
var metrics = new _PdfFontMetrics();
|
|
1254
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1255
|
+
widthTable._add(new _CjkSameWidth(1, 95, 500));
|
|
1256
|
+
widthTable._add(new _CjkSameWidth(231, 632, 500));
|
|
1257
|
+
metrics._widthTable = widthTable;
|
|
1258
|
+
metrics._ascent = 857;
|
|
1259
|
+
metrics._descent = -143;
|
|
1260
|
+
metrics._size = size;
|
|
1261
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1262
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1263
|
+
metrics._postScriptName = 'HeiseiMin-W3,BoldItalic';
|
|
1264
|
+
}
|
|
1265
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1266
|
+
metrics._postScriptName = 'HeiseiMin-W3,Bold';
|
|
1267
|
+
}
|
|
1268
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1269
|
+
metrics._postScriptName = 'HeiseiMin-W3,Italic';
|
|
1270
|
+
}
|
|
1271
|
+
else {
|
|
1272
|
+
metrics._postScriptName = 'HeiseiMin-W3';
|
|
1273
|
+
}
|
|
1274
|
+
return metrics;
|
|
1275
|
+
};
|
|
1276
|
+
_PdfCjkStandardFontMetricsFactory._getMonotypeHeiMedium = function (fontStyle, size) {
|
|
1277
|
+
var metrics = new _PdfFontMetrics();
|
|
1278
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1279
|
+
widthTable._add(new _CjkSameWidth(1, 95, 500));
|
|
1280
|
+
widthTable._add(new _CjkSameWidth(13648, 13742, 500));
|
|
1281
|
+
metrics._widthTable = widthTable;
|
|
1282
|
+
metrics._ascent = 880;
|
|
1283
|
+
metrics._descent = -120;
|
|
1284
|
+
metrics._size = size;
|
|
1285
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1286
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1287
|
+
metrics._postScriptName = 'MHei-Medium,BoldItalic';
|
|
1288
|
+
}
|
|
1289
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1290
|
+
metrics._postScriptName = 'MHei-Medium,Bold';
|
|
1291
|
+
}
|
|
1292
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1293
|
+
metrics._postScriptName = 'MHei-Medium,Italic';
|
|
1294
|
+
}
|
|
1295
|
+
else {
|
|
1296
|
+
metrics._postScriptName = 'MHei-Medium';
|
|
1297
|
+
}
|
|
1298
|
+
return metrics;
|
|
1299
|
+
};
|
|
1300
|
+
_PdfCjkStandardFontMetricsFactory._getMonotypeSungLight = function (fontStyle, size) {
|
|
1301
|
+
var metrics = new _PdfFontMetrics();
|
|
1302
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1303
|
+
widthTable._add(new _CjkSameWidth(1, 95, 500));
|
|
1304
|
+
widthTable._add(new _CjkSameWidth(13648, 13742, 500));
|
|
1305
|
+
metrics._widthTable = widthTable;
|
|
1306
|
+
metrics._ascent = 880;
|
|
1307
|
+
metrics._descent = -120;
|
|
1308
|
+
metrics._size = size;
|
|
1309
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1310
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1311
|
+
metrics._postScriptName = 'MSung-Light,BoldItalic';
|
|
1312
|
+
}
|
|
1313
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1314
|
+
metrics._postScriptName = 'MSung-Light,Bold';
|
|
1315
|
+
}
|
|
1316
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1317
|
+
metrics._postScriptName = 'MSung-Light,Italic';
|
|
1318
|
+
}
|
|
1319
|
+
else {
|
|
1320
|
+
metrics._postScriptName = 'MSung-Light';
|
|
1321
|
+
}
|
|
1322
|
+
return metrics;
|
|
1323
|
+
};
|
|
1324
|
+
_PdfCjkStandardFontMetricsFactory._getSinoTypeSongLight = function (fontStyle, size) {
|
|
1325
|
+
var metrics = new _PdfFontMetrics();
|
|
1326
|
+
var widthTable = new _CjkWidthTable(1000);
|
|
1327
|
+
widthTable._add(new _CjkSameWidth(1, 95, 500));
|
|
1328
|
+
widthTable._add(new _CjkSameWidth(814, 939, 500));
|
|
1329
|
+
widthTable._add(new _CjkDifferentWidth(7712, [500]));
|
|
1330
|
+
widthTable._add(new _CjkDifferentWidth(7716, [500]));
|
|
1331
|
+
metrics._ascent = 880;
|
|
1332
|
+
metrics._descent = -120;
|
|
1333
|
+
metrics._size = size;
|
|
1334
|
+
metrics._height = metrics._ascent - metrics._descent;
|
|
1335
|
+
if ((fontStyle & PdfFontStyle.bold) !== 0 && (fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1336
|
+
metrics._postScriptName = 'STSong-Light,BoldItalic';
|
|
1337
|
+
}
|
|
1338
|
+
else if ((fontStyle & PdfFontStyle.bold) !== 0) {
|
|
1339
|
+
metrics._postScriptName = 'STSong-Light,Bold';
|
|
1340
|
+
}
|
|
1341
|
+
else if ((fontStyle & PdfFontStyle.italic) !== 0) {
|
|
1342
|
+
metrics._postScriptName = 'STSong-Light,Italic';
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
metrics._postScriptName = 'STSong-Light';
|
|
1346
|
+
}
|
|
1347
|
+
metrics._widthTable = widthTable;
|
|
1348
|
+
return metrics;
|
|
1349
|
+
};
|
|
1350
|
+
_PdfCjkStandardFontMetricsFactory._getMetrics = function (fontFamily, fontStyle, size) {
|
|
1351
|
+
var metrics;
|
|
1352
|
+
switch (fontFamily) {
|
|
1353
|
+
case PdfCjkFontFamily.hanyangSystemsGothicMedium:
|
|
1354
|
+
metrics = this._getHanyangSystemsGothicMedium(fontStyle, size);
|
|
1355
|
+
metrics._name = 'HanyangSystemsGothicMedium';
|
|
1356
|
+
break;
|
|
1357
|
+
case PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:
|
|
1358
|
+
metrics = this._getHanyangSystemsShinMyeongJoMedium(fontStyle, size);
|
|
1359
|
+
metrics._name = 'HanyangSystemsShinMyeongJoMedium';
|
|
1360
|
+
break;
|
|
1361
|
+
case PdfCjkFontFamily.heiseiKakuGothicW5:
|
|
1362
|
+
metrics = this._getHeiseiKakuGothicW5(fontStyle, size);
|
|
1363
|
+
metrics._name = 'HeiseiKakuGothicW5';
|
|
1364
|
+
break;
|
|
1365
|
+
case PdfCjkFontFamily.heiseiMinchoW3:
|
|
1366
|
+
metrics = this._getHeiseiMinchoW3(fontStyle, size);
|
|
1367
|
+
metrics._name = 'HeiseiMinchoW3';
|
|
1368
|
+
break;
|
|
1369
|
+
case PdfCjkFontFamily.monotypeHeiMedium:
|
|
1370
|
+
metrics = this._getMonotypeHeiMedium(fontStyle, size);
|
|
1371
|
+
metrics._name = 'MonotypeHeiMedium';
|
|
1372
|
+
break;
|
|
1373
|
+
case PdfCjkFontFamily.monotypeSungLight:
|
|
1374
|
+
metrics = this._getMonotypeSungLight(fontStyle, size);
|
|
1375
|
+
metrics._name = 'MonotypeSungLight';
|
|
1376
|
+
break;
|
|
1377
|
+
case PdfCjkFontFamily.sinoTypeSongLight:
|
|
1378
|
+
metrics = this._getSinoTypeSongLight(fontStyle, size);
|
|
1379
|
+
metrics._name = 'SinoTypeSongLight';
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
metrics._subScriptSizeFactor = this._subSuperScriptFactor;
|
|
1383
|
+
metrics._superscriptSizeFactor = this._subSuperScriptFactor;
|
|
1384
|
+
return metrics;
|
|
1385
|
+
};
|
|
1386
|
+
_PdfCjkStandardFontMetricsFactory._subSuperScriptFactor = 1.52;
|
|
1387
|
+
return _PdfCjkStandardFontMetricsFactory;
|
|
1388
|
+
}());
|
|
1389
|
+
export { _PdfCjkStandardFontMetricsFactory };
|
|
1390
|
+
var _PdfCjkFontDescriptorFactory = /** @class */ (function () {
|
|
1391
|
+
function _PdfCjkFontDescriptorFactory() {
|
|
1392
|
+
}
|
|
1393
|
+
_PdfCjkFontDescriptorFactory._fillMonotypeSungLight = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1394
|
+
var fontBox = { x: -160, y: -249, width: 1175, height: 1137 };
|
|
1395
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1396
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1397
|
+
fontDescriptor.set('StemV', 93);
|
|
1398
|
+
fontDescriptor.set('StemH', 93);
|
|
1399
|
+
fontDescriptor.set('AvgWidth', 1000);
|
|
1400
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1401
|
+
fontDescriptor.set('CapHeight', 880);
|
|
1402
|
+
fontDescriptor.set('XHeight', 616);
|
|
1403
|
+
fontDescriptor.set('Leading', 250);
|
|
1404
|
+
};
|
|
1405
|
+
_PdfCjkFontDescriptorFactory._fillHeiseiKakuGothicW5 = function (fontDescriptor, fontStyle, fontFamily, fontMetrics) {
|
|
1406
|
+
var fontBox = { x: -92, y: -250, width: 1102, height: 1172 };
|
|
1407
|
+
var fontBoxItalic = { x: -92, y: -250, width: 1102, height: 1932 };
|
|
1408
|
+
if ((fontStyle & (PdfFontStyle.italic | PdfFontStyle.bold)) !== PdfFontStyle.italic) {
|
|
1409
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1410
|
+
}
|
|
1411
|
+
else {
|
|
1412
|
+
this._fillFontBox(fontDescriptor, fontBoxItalic);
|
|
1413
|
+
}
|
|
1414
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1415
|
+
fontDescriptor.set('StemV', 93);
|
|
1416
|
+
fontDescriptor.set('StemH', 93);
|
|
1417
|
+
fontDescriptor.set('AvgWidth', 689);
|
|
1418
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1419
|
+
fontDescriptor.set('CapHeight', 718);
|
|
1420
|
+
fontDescriptor.set('XHeight', 500);
|
|
1421
|
+
fontDescriptor.set('Leading', 250);
|
|
1422
|
+
};
|
|
1423
|
+
_PdfCjkFontDescriptorFactory._fillHanyangSystemsShinMyeongJoMedium = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1424
|
+
var fontBox = { x: 0, y: -148, width: 1001, height: 1028 };
|
|
1425
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1426
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1427
|
+
fontDescriptor.set('StemV', 93);
|
|
1428
|
+
fontDescriptor.set('StemH', 93);
|
|
1429
|
+
fontDescriptor.set('AvgWidth', 1000);
|
|
1430
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1431
|
+
fontDescriptor.set('CapHeight', 880);
|
|
1432
|
+
fontDescriptor.set('XHeight', 616);
|
|
1433
|
+
fontDescriptor.set('Leading', 250);
|
|
1434
|
+
};
|
|
1435
|
+
_PdfCjkFontDescriptorFactory._fillHeiseiMinchoW3 = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1436
|
+
var fontBox = { x: -123, y: -257, width: 1124, height: 1167 };
|
|
1437
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1438
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1439
|
+
fontDescriptor.set('StemV', 93);
|
|
1440
|
+
fontDescriptor.set('StemH', 93);
|
|
1441
|
+
fontDescriptor.set('AvgWidth', 702);
|
|
1442
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1443
|
+
fontDescriptor.set('CapHeight', 718);
|
|
1444
|
+
fontDescriptor.set('XHeight', 500);
|
|
1445
|
+
fontDescriptor.set('Leading', 250);
|
|
1446
|
+
};
|
|
1447
|
+
_PdfCjkFontDescriptorFactory._fillSinoTypeSongLight = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1448
|
+
var fontBox = { x: -25, y: -254, width: 1025, height: 1134 };
|
|
1449
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1450
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1451
|
+
fontDescriptor.set('StemV', 93);
|
|
1452
|
+
fontDescriptor.set('StemH', 93);
|
|
1453
|
+
fontDescriptor.set('AvgWidth', 1000);
|
|
1454
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1455
|
+
fontDescriptor.set('CapHeight', 880);
|
|
1456
|
+
fontDescriptor.set('XHeight', 616);
|
|
1457
|
+
fontDescriptor.set('Leading', 250);
|
|
1458
|
+
};
|
|
1459
|
+
_PdfCjkFontDescriptorFactory._fillMonotypeHeiMedium = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1460
|
+
var fontBox = { x: -45, y: -250, width: 1060, height: 1137 };
|
|
1461
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1462
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1463
|
+
fontDescriptor.set('StemV', 93);
|
|
1464
|
+
fontDescriptor.set('StemH', 93);
|
|
1465
|
+
fontDescriptor.set('AvgWidth', 1000);
|
|
1466
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1467
|
+
fontDescriptor.set('CapHeight', 880);
|
|
1468
|
+
fontDescriptor.set('XHeight', 616);
|
|
1469
|
+
fontDescriptor.set('Leading', 250);
|
|
1470
|
+
};
|
|
1471
|
+
_PdfCjkFontDescriptorFactory._fillHanyangSystemsGothicMedium = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1472
|
+
var fontBox = { x: -6, y: -145, width: 1009, height: 1025 };
|
|
1473
|
+
this._fillFontBox(fontDescriptor, fontBox);
|
|
1474
|
+
this._fillKnownInformation(fontDescriptor, fontFamily, fontMetrics);
|
|
1475
|
+
fontDescriptor.set('Flags', 4);
|
|
1476
|
+
fontDescriptor.set('StemV', 93);
|
|
1477
|
+
fontDescriptor.set('StemH', 93);
|
|
1478
|
+
fontDescriptor.set('AvgWidth', 1000);
|
|
1479
|
+
fontDescriptor.set('MaxWidth', 1000);
|
|
1480
|
+
fontDescriptor.set('CapHeight', 880);
|
|
1481
|
+
fontDescriptor.set('XHeight', 616);
|
|
1482
|
+
fontDescriptor.set('Leading', 250);
|
|
1483
|
+
};
|
|
1484
|
+
_PdfCjkFontDescriptorFactory._fillFontBox = function (fontDescriptor, fontBox) {
|
|
1485
|
+
fontDescriptor.set('FontBBox', _fromRectangle(fontBox));
|
|
1486
|
+
};
|
|
1487
|
+
_PdfCjkFontDescriptorFactory._fillKnownInformation = function (fontDescriptor, fontFamily, fontMetrics) {
|
|
1488
|
+
fontDescriptor.set('FontName', _PdfName.get(fontMetrics._postScriptName));
|
|
1489
|
+
fontDescriptor.set('Type', _PdfName.get('FontDescriptor'));
|
|
1490
|
+
fontDescriptor.set('ItalicAngle', 0);
|
|
1491
|
+
fontDescriptor.set('MissingWidth', fontMetrics._widthTable._defaultWidth);
|
|
1492
|
+
fontDescriptor.set('Ascent', fontMetrics._ascent);
|
|
1493
|
+
fontDescriptor.set('Descent', fontMetrics._descent);
|
|
1494
|
+
switch (fontFamily) {
|
|
1495
|
+
case PdfCjkFontFamily.monotypeHeiMedium:
|
|
1496
|
+
case PdfCjkFontFamily.hanyangSystemsGothicMedium:
|
|
1497
|
+
case PdfCjkFontFamily.heiseiKakuGothicW5:
|
|
1498
|
+
fontDescriptor.set('Flags', 4);
|
|
1499
|
+
break;
|
|
1500
|
+
case PdfCjkFontFamily.sinoTypeSongLight:
|
|
1501
|
+
case PdfCjkFontFamily.monotypeSungLight:
|
|
1502
|
+
case PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:
|
|
1503
|
+
case PdfCjkFontFamily.heiseiMinchoW3:
|
|
1504
|
+
fontDescriptor.set('Flags', 6);
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
_PdfCjkFontDescriptorFactory._getFontDescriptor = function (fontFamily, fontStyle, fontMetrics) {
|
|
1509
|
+
var fontDescriptor = new _PdfDictionary();
|
|
1510
|
+
fontDescriptor._updated = true;
|
|
1511
|
+
switch (fontFamily) {
|
|
1512
|
+
case PdfCjkFontFamily.hanyangSystemsGothicMedium:
|
|
1513
|
+
this._fillHanyangSystemsGothicMedium(fontDescriptor, fontFamily, fontMetrics);
|
|
1514
|
+
break;
|
|
1515
|
+
case PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:
|
|
1516
|
+
this._fillHanyangSystemsShinMyeongJoMedium(fontDescriptor, fontFamily, fontMetrics);
|
|
1517
|
+
break;
|
|
1518
|
+
case PdfCjkFontFamily.heiseiKakuGothicW5:
|
|
1519
|
+
this._fillHeiseiKakuGothicW5(fontDescriptor, fontStyle, fontFamily, fontMetrics);
|
|
1520
|
+
break;
|
|
1521
|
+
case PdfCjkFontFamily.heiseiMinchoW3:
|
|
1522
|
+
this._fillHeiseiMinchoW3(fontDescriptor, fontFamily, fontMetrics);
|
|
1523
|
+
break;
|
|
1524
|
+
case PdfCjkFontFamily.monotypeHeiMedium:
|
|
1525
|
+
this._fillMonotypeHeiMedium(fontDescriptor, fontFamily, fontMetrics);
|
|
1526
|
+
break;
|
|
1527
|
+
case PdfCjkFontFamily.monotypeSungLight:
|
|
1528
|
+
this._fillMonotypeSungLight(fontDescriptor, fontFamily, fontMetrics);
|
|
1529
|
+
break;
|
|
1530
|
+
case PdfCjkFontFamily.sinoTypeSongLight:
|
|
1531
|
+
this._fillSinoTypeSongLight(fontDescriptor, fontFamily, fontMetrics);
|
|
1532
|
+
break;
|
|
1533
|
+
default:
|
|
1534
|
+
break;
|
|
1535
|
+
}
|
|
1536
|
+
return fontDescriptor;
|
|
1537
|
+
};
|
|
1538
|
+
return _PdfCjkFontDescriptorFactory;
|
|
1539
|
+
}());
|
|
1540
|
+
export { _PdfCjkFontDescriptorFactory };
|
|
1541
|
+
/**
|
|
1542
|
+
* Public enum to define font style.
|
|
1543
|
+
* ```typescript
|
|
1544
|
+
* // Load an existing PDF document
|
|
1545
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1546
|
+
* // Gets the first page
|
|
1547
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
1548
|
+
* // Create a new PDF standard font
|
|
1549
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.regular);
|
|
1550
|
+
* // Create a new PDF string format
|
|
1551
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
1552
|
+
* // Draw the text
|
|
1553
|
+
* page.graphics.drawString('Helvetica', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
1554
|
+
* // Save the document
|
|
1555
|
+
* document.save('output.pdf');
|
|
1556
|
+
* // Destroy the document
|
|
1557
|
+
* document.destroy();
|
|
1558
|
+
* ```
|
|
1559
|
+
*/
|
|
1560
|
+
export var PdfFontStyle;
|
|
1561
|
+
(function (PdfFontStyle) {
|
|
1562
|
+
/**
|
|
1563
|
+
* Specifies the font style `regular`.
|
|
1564
|
+
*/
|
|
1565
|
+
PdfFontStyle[PdfFontStyle["regular"] = 0] = "regular";
|
|
1566
|
+
/**
|
|
1567
|
+
* Specifies the font style `bold`.
|
|
1568
|
+
*/
|
|
1569
|
+
PdfFontStyle[PdfFontStyle["bold"] = 1] = "bold";
|
|
1570
|
+
/**
|
|
1571
|
+
* Specifies the font style `italic`.
|
|
1572
|
+
*/
|
|
1573
|
+
PdfFontStyle[PdfFontStyle["italic"] = 2] = "italic";
|
|
1574
|
+
/**
|
|
1575
|
+
* Specifies the font style `underline`.
|
|
1576
|
+
*/
|
|
1577
|
+
PdfFontStyle[PdfFontStyle["underline"] = 4] = "underline";
|
|
1578
|
+
/**
|
|
1579
|
+
* Specifies the font style `strikeout`.
|
|
1580
|
+
*/
|
|
1581
|
+
PdfFontStyle[PdfFontStyle["strikeout"] = 8] = "strikeout";
|
|
1582
|
+
})(PdfFontStyle || (PdfFontStyle = {}));
|
|
1583
|
+
/**
|
|
1584
|
+
* Public enum to define font family.
|
|
1585
|
+
* ```typescript
|
|
1586
|
+
* // Load an existing PDF document
|
|
1587
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1588
|
+
* // Gets the first page
|
|
1589
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
1590
|
+
* // Create a new PDF standard font
|
|
1591
|
+
* let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.regular);
|
|
1592
|
+
* // Create a new PDF string format
|
|
1593
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
1594
|
+
* // Draw the text
|
|
1595
|
+
* page.graphics.drawString('Helvetica', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
1596
|
+
* // Save the document
|
|
1597
|
+
* document.save('output.pdf');
|
|
1598
|
+
* // Destroy the document
|
|
1599
|
+
* document.destroy();
|
|
1600
|
+
* ```
|
|
1601
|
+
*/
|
|
1602
|
+
export var PdfFontFamily;
|
|
1603
|
+
(function (PdfFontFamily) {
|
|
1604
|
+
/**
|
|
1605
|
+
* Specifies the `helvetica` font family.
|
|
1606
|
+
*/
|
|
1607
|
+
PdfFontFamily[PdfFontFamily["helvetica"] = 0] = "helvetica";
|
|
1608
|
+
/**
|
|
1609
|
+
* Specifies the `courier` font family.
|
|
1610
|
+
*/
|
|
1611
|
+
PdfFontFamily[PdfFontFamily["courier"] = 1] = "courier";
|
|
1612
|
+
/**
|
|
1613
|
+
* Specifies the `timesRoman` font family.
|
|
1614
|
+
*/
|
|
1615
|
+
PdfFontFamily[PdfFontFamily["timesRoman"] = 2] = "timesRoman";
|
|
1616
|
+
/**
|
|
1617
|
+
* Specifies the `symbol` font family.
|
|
1618
|
+
*/
|
|
1619
|
+
PdfFontFamily[PdfFontFamily["symbol"] = 3] = "symbol";
|
|
1620
|
+
/**
|
|
1621
|
+
* Specifies the `zapfDingbats` font family.
|
|
1622
|
+
*/
|
|
1623
|
+
PdfFontFamily[PdfFontFamily["zapfDingbats"] = 4] = "zapfDingbats";
|
|
1624
|
+
})(PdfFontFamily || (PdfFontFamily = {}));
|
|
1625
|
+
/**
|
|
1626
|
+
* Public enum to define CJK font family.
|
|
1627
|
+
* ```typescript
|
|
1628
|
+
* // Load an existing PDF document
|
|
1629
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1630
|
+
* // Gets the first page
|
|
1631
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
1632
|
+
* // Create a new PDF CJK standard font
|
|
1633
|
+
* let font: PdfCjkStandardFont = new PdfCjkStandardFont(PdfCjkFontFamily.heiseiMinchoW3, 20);
|
|
1634
|
+
* // Create a new PDF string format
|
|
1635
|
+
* let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
|
|
1636
|
+
* // Draw the text
|
|
1637
|
+
* page.graphics.drawString('こんにちは世界', font, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
|
|
1638
|
+
* // Save the document
|
|
1639
|
+
* document.save('output.pdf');
|
|
1640
|
+
* // Destroy the document
|
|
1641
|
+
* document.destroy();
|
|
1642
|
+
* ```
|
|
1643
|
+
*/
|
|
1644
|
+
export var PdfCjkFontFamily;
|
|
1645
|
+
(function (PdfCjkFontFamily) {
|
|
1646
|
+
/**
|
|
1647
|
+
* Specifies the `heiseiKakuGothicW5` CJK font family.
|
|
1648
|
+
*/
|
|
1649
|
+
PdfCjkFontFamily[PdfCjkFontFamily["heiseiKakuGothicW5"] = 0] = "heiseiKakuGothicW5";
|
|
1650
|
+
/**
|
|
1651
|
+
* Specifies the `heiseiMinchoW3` CJK font family.
|
|
1652
|
+
*/
|
|
1653
|
+
PdfCjkFontFamily[PdfCjkFontFamily["heiseiMinchoW3"] = 1] = "heiseiMinchoW3";
|
|
1654
|
+
/**
|
|
1655
|
+
* Specifies the `hanyangSystemsGothicMedium` CJK font family.
|
|
1656
|
+
*/
|
|
1657
|
+
PdfCjkFontFamily[PdfCjkFontFamily["hanyangSystemsGothicMedium"] = 2] = "hanyangSystemsGothicMedium";
|
|
1658
|
+
/**
|
|
1659
|
+
* Specifies the `hanyangSystemsShinMyeongJoMedium` CJK font family.
|
|
1660
|
+
*/
|
|
1661
|
+
PdfCjkFontFamily[PdfCjkFontFamily["hanyangSystemsShinMyeongJoMedium"] = 3] = "hanyangSystemsShinMyeongJoMedium";
|
|
1662
|
+
/**
|
|
1663
|
+
* Specifies the `monotypeHeiMedium` CJK font family.
|
|
1664
|
+
*/
|
|
1665
|
+
PdfCjkFontFamily[PdfCjkFontFamily["monotypeHeiMedium"] = 4] = "monotypeHeiMedium";
|
|
1666
|
+
/**
|
|
1667
|
+
* Specifies the `monotypeSungLight` CJK font family.
|
|
1668
|
+
*/
|
|
1669
|
+
PdfCjkFontFamily[PdfCjkFontFamily["monotypeSungLight"] = 5] = "monotypeSungLight";
|
|
1670
|
+
/**
|
|
1671
|
+
* Specifies the `sinoTypeSongLight` CJK font family.
|
|
1672
|
+
*/
|
|
1673
|
+
PdfCjkFontFamily[PdfCjkFontFamily["sinoTypeSongLight"] = 6] = "sinoTypeSongLight";
|
|
1674
|
+
})(PdfCjkFontFamily || (PdfCjkFontFamily = {}));
|
|
1675
|
+
var _UnicodeLine = /** @class */ (function () {
|
|
1676
|
+
function _UnicodeLine() {
|
|
1677
|
+
this._result = false;
|
|
1678
|
+
this._glyphIndex = [];
|
|
1679
|
+
}
|
|
1680
|
+
return _UnicodeLine;
|
|
1681
|
+
}());
|
|
1682
|
+
export { _UnicodeLine };
|