@adnsistemas/pdf-lib 1.18.0 → 2.4.2
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/README.md +71 -36
- package/cjs/api/PDFDocument.d.ts +44 -11
- package/cjs/api/PDFDocument.d.ts.map +1 -1
- package/cjs/api/PDFDocument.js +599 -609
- package/cjs/api/PDFDocument.js.map +1 -1
- package/cjs/api/PDFDocumentOptions.d.ts +4 -2
- package/cjs/api/PDFDocumentOptions.d.ts.map +1 -1
- package/cjs/api/PDFEmbeddedFile.d.ts +9 -4
- package/cjs/api/PDFEmbeddedFile.d.ts.map +1 -1
- package/cjs/api/PDFEmbeddedFile.js +54 -59
- package/cjs/api/PDFEmbeddedFile.js.map +1 -1
- package/cjs/api/PDFEmbeddedPage.d.ts +3 -3
- package/cjs/api/PDFEmbeddedPage.d.ts.map +1 -1
- package/cjs/api/PDFEmbeddedPage.js +35 -46
- package/cjs/api/PDFEmbeddedPage.js.map +1 -1
- package/cjs/api/PDFFont.d.ts +4 -4
- package/cjs/api/PDFFont.d.ts.map +1 -1
- package/cjs/api/PDFFont.js +47 -57
- package/cjs/api/PDFFont.js.map +1 -1
- package/cjs/api/PDFImage.d.ts +4 -4
- package/cjs/api/PDFImage.d.ts.map +1 -1
- package/cjs/api/PDFImage.js +50 -62
- package/cjs/api/PDFImage.js.map +1 -1
- package/cjs/api/PDFJavaScript.d.ts +4 -4
- package/cjs/api/PDFJavaScript.d.ts.map +1 -1
- package/cjs/api/PDFJavaScript.js +38 -50
- package/cjs/api/PDFJavaScript.js.map +1 -1
- package/cjs/api/PDFPage.d.ts +33 -9
- package/cjs/api/PDFPage.d.ts.map +1 -1
- package/cjs/api/PDFPage.js +478 -431
- package/cjs/api/PDFPage.js.map +1 -1
- package/cjs/api/PDFPageOptions.d.ts +35 -12
- package/cjs/api/PDFPageOptions.d.ts.map +1 -1
- package/cjs/api/PDFPageOptions.js.map +1 -1
- package/cjs/api/PDFSvg.d.ts +7 -0
- package/cjs/api/PDFSvg.d.ts.map +1 -0
- package/cjs/api/PDFSvg.js +10 -0
- package/cjs/api/PDFSvg.js.map +1 -0
- package/cjs/api/colors.d.ts +6 -2
- package/cjs/api/colors.d.ts.map +1 -1
- package/cjs/api/colors.js +51 -43
- package/cjs/api/colors.js.map +1 -1
- package/cjs/api/errors.js +73 -130
- package/cjs/api/errors.js.map +1 -1
- package/cjs/api/form/PDFButton.d.ts +8 -8
- package/cjs/api/form/PDFButton.d.ts.map +1 -1
- package/cjs/api/form/PDFButton.js +68 -72
- package/cjs/api/form/PDFButton.js.map +1 -1
- package/cjs/api/form/PDFCheckBox.d.ts +5 -5
- package/cjs/api/form/PDFCheckBox.d.ts.map +1 -1
- package/cjs/api/form/PDFCheckBox.js +64 -69
- package/cjs/api/form/PDFCheckBox.js.map +1 -1
- package/cjs/api/form/PDFDropdown.d.ts +6 -6
- package/cjs/api/form/PDFDropdown.d.ts.map +1 -1
- package/cjs/api/form/PDFDropdown.js +126 -132
- package/cjs/api/form/PDFDropdown.js.map +1 -1
- package/cjs/api/form/PDFField.d.ts +7 -7
- package/cjs/api/form/PDFField.d.ts.map +1 -1
- package/cjs/api/form/PDFField.js +118 -123
- package/cjs/api/form/PDFField.js.map +1 -1
- package/cjs/api/form/PDFForm.d.ts +11 -11
- package/cjs/api/form/PDFForm.d.ts.map +1 -1
- package/cjs/api/form/PDFForm.js +226 -221
- package/cjs/api/form/PDFForm.js.map +1 -1
- package/cjs/api/form/PDFOptionList.d.ts +6 -6
- package/cjs/api/form/PDFOptionList.d.ts.map +1 -1
- package/cjs/api/form/PDFOptionList.js +115 -121
- package/cjs/api/form/PDFOptionList.js.map +1 -1
- package/cjs/api/form/PDFRadioGroup.d.ts +5 -5
- package/cjs/api/form/PDFRadioGroup.d.ts.map +1 -1
- package/cjs/api/form/PDFRadioGroup.js +98 -101
- package/cjs/api/form/PDFRadioGroup.js.map +1 -1
- package/cjs/api/form/PDFSignature.d.ts +3 -3
- package/cjs/api/form/PDFSignature.d.ts.map +1 -1
- package/cjs/api/form/PDFSignature.js +25 -28
- package/cjs/api/form/PDFSignature.js.map +1 -1
- package/cjs/api/form/PDFTextField.d.ts +8 -8
- package/cjs/api/form/PDFTextField.d.ts.map +1 -1
- package/cjs/api/form/PDFTextField.js +136 -141
- package/cjs/api/form/PDFTextField.js.map +1 -1
- package/cjs/api/form/appearances.d.ts +21 -21
- package/cjs/api/form/appearances.d.ts.map +1 -1
- package/cjs/api/form/appearances.js +257 -219
- package/cjs/api/form/appearances.js.map +1 -1
- package/cjs/api/form/index.d.ts +10 -10
- package/cjs/api/form/index.d.ts.map +1 -1
- package/cjs/api/form/index.js +11 -10
- package/cjs/api/form/index.js.map +1 -1
- package/cjs/api/image/index.d.ts +1 -1
- package/cjs/api/image/index.d.ts.map +1 -1
- package/cjs/api/image/index.js +1 -1
- package/cjs/api/image/index.js.map +1 -1
- package/cjs/api/index.d.ts +22 -21
- package/cjs/api/index.d.ts.map +1 -1
- package/cjs/api/index.js +30 -27
- package/cjs/api/index.js.map +1 -1
- package/cjs/api/objects.d.ts +1 -1
- package/cjs/api/objects.d.ts.map +1 -1
- package/cjs/api/objects.js +7 -10
- package/cjs/api/objects.js.map +1 -1
- package/cjs/api/operations.d.ts +27 -13
- package/cjs/api/operations.d.ts.map +1 -1
- package/cjs/api/operations.js +373 -363
- package/cjs/api/operations.js.map +1 -1
- package/cjs/api/operators.d.ts +6 -1
- package/cjs/api/operators.d.ts.map +1 -1
- package/cjs/api/operators.js +169 -183
- package/cjs/api/operators.js.map +1 -1
- package/cjs/api/rotations.d.ts +2 -2
- package/cjs/api/rotations.d.ts.map +1 -1
- package/cjs/api/rotations.js +30 -30
- package/cjs/api/rotations.js.map +1 -1
- package/cjs/api/snapshot/DefaultDocumentSnapshot.d.ts +1 -1
- package/cjs/api/snapshot/DefaultDocumentSnapshot.d.ts.map +1 -1
- package/cjs/api/snapshot/DefaultDocumentSnapshot.js +13 -14
- package/cjs/api/snapshot/DefaultDocumentSnapshot.js.map +1 -1
- package/cjs/api/snapshot/DocumentSnapshot.d.ts +1 -1
- package/cjs/api/snapshot/DocumentSnapshot.d.ts.map +1 -1
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.d.ts +1 -1
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.d.ts.map +1 -1
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.js +17 -22
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.js.map +1 -1
- package/cjs/api/snapshot/index.js +1 -1
- package/cjs/api/svg.d.ts +76 -0
- package/cjs/api/svg.d.ts.map +1 -0
- package/cjs/api/svg.js +749 -0
- package/cjs/api/svg.js.map +1 -0
- package/cjs/api/svgPath.d.ts +1 -1
- package/cjs/api/svgPath.d.ts.map +1 -1
- package/cjs/api/svgPath.js +115 -118
- package/cjs/api/svgPath.js.map +1 -1
- package/cjs/api/text/index.d.ts +2 -2
- package/cjs/api/text/index.d.ts.map +1 -1
- package/cjs/api/text/index.js +1 -1
- package/cjs/api/text/index.js.map +1 -1
- package/cjs/api/text/layout.d.ts +3 -3
- package/cjs/api/text/layout.d.ts.map +1 -1
- package/cjs/api/text/layout.js +87 -88
- package/cjs/api/text/layout.js.map +1 -1
- package/cjs/core/PDFContext.d.ts +39 -19
- package/cjs/core/PDFContext.d.ts.map +1 -1
- package/cjs/core/PDFContext.js +131 -103
- package/cjs/core/PDFContext.js.map +1 -1
- package/cjs/core/PDFObjectCopier.d.ts +2 -2
- package/cjs/core/PDFObjectCopier.d.ts.map +1 -1
- package/cjs/core/PDFObjectCopier.js +58 -62
- package/cjs/core/PDFObjectCopier.js.map +1 -1
- package/cjs/core/acroform/PDFAcroButton.d.ts +7 -7
- package/cjs/core/acroform/PDFAcroButton.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroButton.js +42 -47
- package/cjs/core/acroform/PDFAcroButton.js.map +1 -1
- package/cjs/core/acroform/PDFAcroCheckBox.d.ts +5 -5
- package/cjs/core/acroform/PDFAcroCheckBox.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroCheckBox.js +28 -35
- package/cjs/core/acroform/PDFAcroCheckBox.js.map +1 -1
- package/cjs/core/acroform/PDFAcroChoice.d.ts +4 -4
- package/cjs/core/acroform/PDFAcroChoice.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroChoice.js +47 -60
- package/cjs/core/acroform/PDFAcroChoice.js.map +1 -1
- package/cjs/core/acroform/PDFAcroComboBox.d.ts +4 -4
- package/cjs/core/acroform/PDFAcroComboBox.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroComboBox.js +15 -22
- package/cjs/core/acroform/PDFAcroComboBox.js.map +1 -1
- package/cjs/core/acroform/PDFAcroField.d.ts +8 -8
- package/cjs/core/acroform/PDFAcroField.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroField.js +80 -81
- package/cjs/core/acroform/PDFAcroField.js.map +1 -1
- package/cjs/core/acroform/PDFAcroForm.d.ts +5 -5
- package/cjs/core/acroform/PDFAcroForm.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroForm.js +46 -47
- package/cjs/core/acroform/PDFAcroForm.js.map +1 -1
- package/cjs/core/acroform/PDFAcroListBox.d.ts +4 -4
- package/cjs/core/acroform/PDFAcroListBox.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroListBox.js +13 -20
- package/cjs/core/acroform/PDFAcroListBox.js.map +1 -1
- package/cjs/core/acroform/PDFAcroNonTerminal.d.ts +4 -4
- package/cjs/core/acroform/PDFAcroNonTerminal.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroNonTerminal.js +18 -25
- package/cjs/core/acroform/PDFAcroNonTerminal.js.map +1 -1
- package/cjs/core/acroform/PDFAcroPushButton.d.ts +4 -4
- package/cjs/core/acroform/PDFAcroPushButton.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroPushButton.js +15 -22
- package/cjs/core/acroform/PDFAcroPushButton.js.map +1 -1
- package/cjs/core/acroform/PDFAcroRadioButton.d.ts +5 -5
- package/cjs/core/acroform/PDFAcroRadioButton.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroRadioButton.js +33 -40
- package/cjs/core/acroform/PDFAcroRadioButton.js.map +1 -1
- package/cjs/core/acroform/PDFAcroSignature.d.ts +3 -3
- package/cjs/core/acroform/PDFAcroSignature.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroSignature.js +5 -12
- package/cjs/core/acroform/PDFAcroSignature.js.map +1 -1
- package/cjs/core/acroform/PDFAcroTerminal.d.ts +5 -5
- package/cjs/core/acroform/PDFAcroTerminal.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroTerminal.js +28 -35
- package/cjs/core/acroform/PDFAcroTerminal.js.map +1 -1
- package/cjs/core/acroform/PDFAcroText.d.ts +7 -7
- package/cjs/core/acroform/PDFAcroText.d.ts.map +1 -1
- package/cjs/core/acroform/PDFAcroText.js +40 -45
- package/cjs/core/acroform/PDFAcroText.js.map +1 -1
- package/cjs/core/acroform/flags.js +1 -1
- package/cjs/core/acroform/flags.js.map +1 -1
- package/cjs/core/acroform/index.d.ts +15 -15
- package/cjs/core/acroform/index.d.ts.map +1 -1
- package/cjs/core/acroform/index.js +15 -14
- package/cjs/core/acroform/index.js.map +1 -1
- package/cjs/core/acroform/utils.d.ts +5 -5
- package/cjs/core/acroform/utils.d.ts.map +1 -1
- package/cjs/core/acroform/utils.js +48 -48
- package/cjs/core/acroform/utils.js.map +1 -1
- package/cjs/core/annotation/AppearanceCharacteristics.d.ts +5 -5
- package/cjs/core/annotation/AppearanceCharacteristics.d.ts.map +1 -1
- package/cjs/core/annotation/AppearanceCharacteristics.js +61 -64
- package/cjs/core/annotation/AppearanceCharacteristics.js.map +1 -1
- package/cjs/core/annotation/BorderStyle.d.ts +2 -2
- package/cjs/core/annotation/BorderStyle.d.ts.map +1 -1
- package/cjs/core/annotation/BorderStyle.js +15 -16
- package/cjs/core/annotation/BorderStyle.js.map +1 -1
- package/cjs/core/annotation/PDFAnnotation.d.ts +6 -6
- package/cjs/core/annotation/PDFAnnotation.d.ts.map +1 -1
- package/cjs/core/annotation/PDFAnnotation.js +76 -77
- package/cjs/core/annotation/PDFAnnotation.js.map +1 -1
- package/cjs/core/annotation/PDFWidgetAnnotation.d.ts +9 -9
- package/cjs/core/annotation/PDFWidgetAnnotation.d.ts.map +1 -1
- package/cjs/core/annotation/PDFWidgetAnnotation.js +60 -67
- package/cjs/core/annotation/PDFWidgetAnnotation.js.map +1 -1
- package/cjs/core/annotation/flags.js +1 -1
- package/cjs/core/annotation/flags.js.map +1 -1
- package/cjs/core/annotation/index.d.ts +4 -4
- package/cjs/core/annotation/index.d.ts.map +1 -1
- package/cjs/core/annotation/index.js +5 -4
- package/cjs/core/annotation/index.js.map +1 -1
- package/cjs/core/crypto.d.ts +96 -0
- package/cjs/core/crypto.d.ts.map +1 -0
- package/cjs/core/crypto.js +1623 -0
- package/cjs/core/crypto.js.map +1 -0
- package/cjs/core/document/PDFCrossRefSection.d.ts +1 -1
- package/cjs/core/document/PDFCrossRefSection.d.ts.map +1 -1
- package/cjs/core/document/PDFCrossRefSection.js +62 -65
- package/cjs/core/document/PDFCrossRefSection.js.map +1 -1
- package/cjs/core/document/PDFHeader.d.ts +1 -0
- package/cjs/core/document/PDFHeader.d.ts.map +1 -1
- package/cjs/core/document/PDFHeader.js +21 -21
- package/cjs/core/document/PDFHeader.js.map +1 -1
- package/cjs/core/document/PDFTrailer.js +16 -19
- package/cjs/core/document/PDFTrailer.js.map +1 -1
- package/cjs/core/document/PDFTrailerDict.d.ts +1 -1
- package/cjs/core/document/PDFTrailerDict.d.ts.map +1 -1
- package/cjs/core/document/PDFTrailerDict.js +14 -15
- package/cjs/core/document/PDFTrailerDict.js.map +1 -1
- package/cjs/core/embedders/CMap.d.ts +2 -2
- package/cjs/core/embedders/CMap.d.ts.map +1 -1
- package/cjs/core/embedders/CMap.js +41 -28
- package/cjs/core/embedders/CMap.js.map +1 -1
- package/cjs/core/embedders/CustomFontEmbedder.d.ts +5 -5
- package/cjs/core/embedders/CustomFontEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/CustomFontEmbedder.js +133 -178
- package/cjs/core/embedders/CustomFontEmbedder.js.map +1 -1
- package/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts +3 -3
- package/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/CustomFontSubsetEmbedder.js +38 -49
- package/cjs/core/embedders/CustomFontSubsetEmbedder.js.map +1 -1
- package/cjs/core/embedders/FileEmbedder.d.ts +3 -2
- package/cjs/core/embedders/FileEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/FileEmbedder.js +44 -48
- package/cjs/core/embedders/FileEmbedder.js.map +1 -1
- package/cjs/core/embedders/FontFlags.d.ts +1 -1
- package/cjs/core/embedders/FontFlags.d.ts.map +1 -1
- package/cjs/core/embedders/FontFlags.js +7 -6
- package/cjs/core/embedders/FontFlags.js.map +1 -1
- package/cjs/core/embedders/JavaScriptEmbedder.d.ts +2 -2
- package/cjs/core/embedders/JavaScriptEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/JavaScriptEmbedder.js +22 -27
- package/cjs/core/embedders/JavaScriptEmbedder.js.map +1 -1
- package/cjs/core/embedders/JpegEmbedder.d.ts +2 -2
- package/cjs/core/embedders/JpegEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/JpegEmbedder.js +66 -73
- package/cjs/core/embedders/JpegEmbedder.js.map +1 -1
- package/cjs/core/embedders/PDFPageEmbedder.d.ts +4 -4
- package/cjs/core/embedders/PDFPageEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/PDFPageEmbedder.js +64 -65
- package/cjs/core/embedders/PDFPageEmbedder.js.map +1 -1
- package/cjs/core/embedders/PngEmbedder.d.ts +2 -2
- package/cjs/core/embedders/PngEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/PngEmbedder.js +33 -41
- package/cjs/core/embedders/PngEmbedder.js.map +1 -1
- package/cjs/core/embedders/StandardFontEmbedder.d.ts +4 -4
- package/cjs/core/embedders/StandardFontEmbedder.d.ts.map +1 -1
- package/cjs/core/embedders/StandardFontEmbedder.js +53 -51
- package/cjs/core/embedders/StandardFontEmbedder.js.map +1 -1
- package/cjs/core/errors.d.ts +1 -1
- package/cjs/core/errors.d.ts.map +1 -1
- package/cjs/core/errors.js +147 -260
- package/cjs/core/errors.js.map +1 -1
- package/cjs/core/index.d.ts +48 -47
- package/cjs/core/index.d.ts.map +1 -1
- package/cjs/core/index.js +47 -44
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/interactive/ViewerPreferences.d.ts +8 -8
- package/cjs/core/interactive/ViewerPreferences.d.ts.map +1 -1
- package/cjs/core/interactive/ViewerPreferences.js +135 -138
- package/cjs/core/interactive/ViewerPreferences.js.map +1 -1
- package/cjs/core/objects/PDFArray.d.ts +12 -12
- package/cjs/core/objects/PDFArray.d.ts.map +1 -1
- package/cjs/core/objects/PDFArray.js +72 -81
- package/cjs/core/objects/PDFArray.js.map +1 -1
- package/cjs/core/objects/PDFBool.d.ts +1 -1
- package/cjs/core/objects/PDFBool.d.ts.map +1 -1
- package/cjs/core/objects/PDFBool.js +22 -26
- package/cjs/core/objects/PDFBool.js.map +1 -1
- package/cjs/core/objects/PDFDict.d.ts +13 -12
- package/cjs/core/objects/PDFDict.d.ts.map +1 -1
- package/cjs/core/objects/PDFDict.js +76 -88
- package/cjs/core/objects/PDFDict.js.map +1 -1
- package/cjs/core/objects/PDFHexString.d.ts +2 -1
- package/cjs/core/objects/PDFHexString.d.ts.map +1 -1
- package/cjs/core/objects/PDFHexString.js +50 -52
- package/cjs/core/objects/PDFHexString.js.map +1 -1
- package/cjs/core/objects/PDFInvalidObject.d.ts +1 -1
- package/cjs/core/objects/PDFInvalidObject.d.ts.map +1 -1
- package/cjs/core/objects/PDFInvalidObject.js +19 -22
- package/cjs/core/objects/PDFInvalidObject.js.map +1 -1
- package/cjs/core/objects/PDFName.d.ts +1 -1
- package/cjs/core/objects/PDFName.d.ts.map +1 -1
- package/cjs/core/objects/PDFName.js +84 -92
- package/cjs/core/objects/PDFName.js.map +1 -1
- package/cjs/core/objects/PDFNull.d.ts +1 -1
- package/cjs/core/objects/PDFNull.d.ts.map +1 -1
- package/cjs/core/objects/PDFNull.js +15 -20
- package/cjs/core/objects/PDFNull.js.map +1 -1
- package/cjs/core/objects/PDFNumber.d.ts +1 -1
- package/cjs/core/objects/PDFNumber.d.ts.map +1 -1
- package/cjs/core/objects/PDFNumber.js +23 -26
- package/cjs/core/objects/PDFNumber.js.map +1 -1
- package/cjs/core/objects/PDFObject.d.ts +1 -1
- package/cjs/core/objects/PDFObject.d.ts.map +1 -1
- package/cjs/core/objects/PDFObject.js +13 -16
- package/cjs/core/objects/PDFObject.js.map +1 -1
- package/cjs/core/objects/PDFRawStream.d.ts +8 -5
- package/cjs/core/objects/PDFRawStream.d.ts.map +1 -1
- package/cjs/core/objects/PDFRawStream.js +24 -25
- package/cjs/core/objects/PDFRawStream.js.map +1 -1
- package/cjs/core/objects/PDFRef.d.ts +1 -1
- package/cjs/core/objects/PDFRef.d.ts.map +1 -1
- package/cjs/core/objects/PDFRef.js +31 -36
- package/cjs/core/objects/PDFRef.js.map +1 -1
- package/cjs/core/objects/PDFStream.d.ts +4 -3
- package/cjs/core/objects/PDFStream.d.ts.map +1 -1
- package/cjs/core/objects/PDFStream.js +35 -35
- package/cjs/core/objects/PDFStream.js.map +1 -1
- package/cjs/core/objects/PDFString.d.ts +1 -1
- package/cjs/core/objects/PDFString.d.ts.map +1 -1
- package/cjs/core/objects/PDFString.js +55 -58
- package/cjs/core/objects/PDFString.js.map +1 -1
- package/cjs/core/operators/PDFOperator.d.ts +9 -9
- package/cjs/core/operators/PDFOperator.d.ts.map +1 -1
- package/cjs/core/operators/PDFOperator.js +29 -32
- package/cjs/core/operators/PDFOperator.js.map +1 -1
- package/cjs/core/parser/BaseParser.d.ts +1 -1
- package/cjs/core/parser/BaseParser.d.ts.map +1 -1
- package/cjs/core/parser/BaseParser.js +40 -42
- package/cjs/core/parser/BaseParser.js.map +1 -1
- package/cjs/core/parser/ByteStream.d.ts +1 -1
- package/cjs/core/parser/ByteStream.d.ts.map +1 -1
- package/cjs/core/parser/ByteStream.js +30 -33
- package/cjs/core/parser/ByteStream.js.map +1 -1
- package/cjs/core/parser/PDFObjectParser.d.ts +23 -21
- package/cjs/core/parser/PDFObjectParser.d.ts.map +1 -1
- package/cjs/core/parser/PDFObjectParser.js +96 -88
- package/cjs/core/parser/PDFObjectParser.js.map +1 -1
- package/cjs/core/parser/PDFObjectStreamParser.d.ts +3 -3
- package/cjs/core/parser/PDFObjectStreamParser.d.ts.map +1 -1
- package/cjs/core/parser/PDFObjectStreamParser.js +42 -60
- package/cjs/core/parser/PDFObjectStreamParser.js.map +1 -1
- package/cjs/core/parser/PDFParser.d.ts +6 -4
- package/cjs/core/parser/PDFParser.d.ts.map +1 -1
- package/cjs/core/parser/PDFParser.js +169 -217
- package/cjs/core/parser/PDFParser.js.map +1 -1
- package/cjs/core/parser/PDFXRefStreamParser.d.ts +2 -2
- package/cjs/core/parser/PDFXRefStreamParser.d.ts.map +1 -1
- package/cjs/core/parser/PDFXRefStreamParser.js +38 -41
- package/cjs/core/parser/PDFXRefStreamParser.js.map +1 -1
- package/cjs/core/security/PDFSecurity.d.ts +75 -0
- package/cjs/core/security/PDFSecurity.d.ts.map +1 -0
- package/cjs/core/security/PDFSecurity.js +406 -0
- package/cjs/core/security/PDFSecurity.js.map +1 -0
- package/cjs/core/streams/Ascii85Stream.d.ts +2 -2
- package/cjs/core/streams/Ascii85Stream.d.ts.map +1 -1
- package/cjs/core/streams/Ascii85Stream.js +21 -26
- package/cjs/core/streams/Ascii85Stream.js.map +1 -1
- package/cjs/core/streams/AsciiHexStream.d.ts +2 -2
- package/cjs/core/streams/AsciiHexStream.d.ts.map +1 -1
- package/cjs/core/streams/AsciiHexStream.js +19 -22
- package/cjs/core/streams/AsciiHexStream.js.map +1 -1
- package/cjs/core/streams/DecodeStream.d.ts +1 -1
- package/cjs/core/streams/DecodeStream.d.ts.map +1 -1
- package/cjs/core/streams/DecodeStream.js +54 -61
- package/cjs/core/streams/DecodeStream.js.map +1 -1
- package/cjs/core/streams/DecryptStream.d.ts +13 -0
- package/cjs/core/streams/DecryptStream.d.ts.map +1 -0
- package/cjs/core/streams/DecryptStream.js +39 -0
- package/cjs/core/streams/DecryptStream.js.map +1 -0
- package/cjs/core/streams/FlateStream.d.ts +2 -2
- package/cjs/core/streams/FlateStream.d.ts.map +1 -1
- package/cjs/core/streams/FlateStream.js +82 -84
- package/cjs/core/streams/FlateStream.js.map +1 -1
- package/cjs/core/streams/LZWStream.d.ts +3 -3
- package/cjs/core/streams/LZWStream.d.ts.map +1 -1
- package/cjs/core/streams/LZWStream.js +42 -45
- package/cjs/core/streams/LZWStream.js.map +1 -1
- package/cjs/core/streams/RunLengthStream.d.ts +2 -2
- package/cjs/core/streams/RunLengthStream.d.ts.map +1 -1
- package/cjs/core/streams/RunLengthStream.js +16 -19
- package/cjs/core/streams/RunLengthStream.js.map +1 -1
- package/cjs/core/streams/Stream.js +45 -56
- package/cjs/core/streams/Stream.js.map +1 -1
- package/cjs/core/streams/decode.d.ts +3 -3
- package/cjs/core/streams/decode.d.ts.map +1 -1
- package/cjs/core/streams/decode.js +25 -22
- package/cjs/core/streams/decode.js.map +1 -1
- package/cjs/core/structures/PDFCatalog.d.ts +5 -5
- package/cjs/core/structures/PDFCatalog.d.ts.map +1 -1
- package/cjs/core/structures/PDFCatalog.js +40 -47
- package/cjs/core/structures/PDFCatalog.js.map +1 -1
- package/cjs/core/structures/PDFContentStream.d.ts +4 -4
- package/cjs/core/structures/PDFContentStream.d.ts.map +1 -1
- package/cjs/core/structures/PDFContentStream.js +31 -43
- package/cjs/core/structures/PDFContentStream.js.map +1 -1
- package/cjs/core/structures/PDFCrossRefStream.d.ts +6 -6
- package/cjs/core/structures/PDFCrossRefStream.d.ts.map +1 -1
- package/cjs/core/structures/PDFCrossRefStream.js +92 -100
- package/cjs/core/structures/PDFCrossRefStream.js.map +1 -1
- package/cjs/core/structures/PDFFlateStream.d.ts +5 -4
- package/cjs/core/structures/PDFFlateStream.d.ts.map +1 -1
- package/cjs/core/structures/PDFFlateStream.js +24 -24
- package/cjs/core/structures/PDFFlateStream.js.map +1 -1
- package/cjs/core/structures/PDFObjectStream.d.ts +5 -5
- package/cjs/core/structures/PDFObjectStream.d.ts.map +1 -1
- package/cjs/core/structures/PDFObjectStream.js +49 -56
- package/cjs/core/structures/PDFObjectStream.js.map +1 -1
- package/cjs/core/structures/PDFPageLeaf.d.ts +9 -9
- package/cjs/core/structures/PDFPageLeaf.d.ts.map +1 -1
- package/cjs/core/structures/PDFPageLeaf.js +126 -133
- package/cjs/core/structures/PDFPageLeaf.js.map +1 -1
- package/cjs/core/structures/PDFPageTree.d.ts +8 -8
- package/cjs/core/structures/PDFPageTree.d.ts.map +1 -1
- package/cjs/core/structures/PDFPageTree.js +67 -75
- package/cjs/core/structures/PDFPageTree.js.map +1 -1
- package/cjs/core/syntax/Delimiters.js +2 -2
- package/cjs/core/syntax/Delimiters.js.map +1 -1
- package/cjs/core/syntax/Irregular.js +5 -5
- package/cjs/core/syntax/Irregular.js.map +1 -1
- package/cjs/core/syntax/Keywords.d.ts +1 -1
- package/cjs/core/syntax/Keywords.d.ts.map +1 -1
- package/cjs/core/syntax/Keywords.js +14 -14
- package/cjs/core/syntax/Keywords.js.map +1 -1
- package/cjs/core/syntax/Numeric.js +3 -3
- package/cjs/core/syntax/Numeric.js.map +1 -1
- package/cjs/core/syntax/Whitespace.js +2 -2
- package/cjs/core/syntax/Whitespace.js.map +1 -1
- package/cjs/core/writers/PDFStreamWriter.d.ts +7 -7
- package/cjs/core/writers/PDFStreamWriter.d.ts.map +1 -1
- package/cjs/core/writers/PDFStreamWriter.js +102 -126
- package/cjs/core/writers/PDFStreamWriter.js.map +1 -1
- package/cjs/core/writers/PDFWriter.d.ts +15 -10
- package/cjs/core/writers/PDFWriter.d.ts.map +1 -1
- package/cjs/core/writers/PDFWriter.js +116 -142
- package/cjs/core/writers/PDFWriter.js.map +1 -1
- package/cjs/index.d.ts +4 -4
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +5 -5
- package/cjs/index.js.map +1 -1
- package/cjs/types/index.d.ts +25 -1
- package/cjs/types/index.d.ts.map +1 -1
- package/cjs/types/matrix.d.ts +8 -1
- package/cjs/types/matrix.d.ts.map +1 -1
- package/cjs/utils/Cache.js +10 -11
- package/cjs/utils/Cache.js.map +1 -1
- package/cjs/utils/arrays.d.ts +3 -1
- package/cjs/utils/arrays.d.ts.map +1 -1
- package/cjs/utils/arrays.js +97 -64
- package/cjs/utils/arrays.js.map +1 -1
- package/cjs/utils/async.d.ts.map +1 -1
- package/cjs/utils/async.js +4 -5
- package/cjs/utils/async.js.map +1 -1
- package/cjs/utils/base64.d.ts.map +1 -1
- package/cjs/utils/base64.js +29 -26
- package/cjs/utils/base64.js.map +1 -1
- package/cjs/utils/elements/Arc.d.ts +23 -0
- package/cjs/utils/elements/Arc.d.ts.map +1 -0
- package/cjs/utils/elements/Arc.js +78 -0
- package/cjs/utils/elements/Arc.js.map +1 -0
- package/cjs/utils/elements/Circle.d.ts +15 -0
- package/cjs/utils/elements/Circle.d.ts.map +1 -0
- package/cjs/utils/elements/Circle.js +41 -0
- package/cjs/utils/elements/Circle.js.map +1 -0
- package/cjs/utils/elements/Ellipse.d.ts +21 -0
- package/cjs/utils/elements/Ellipse.d.ts.map +1 -0
- package/cjs/utils/elements/Ellipse.js +91 -0
- package/cjs/utils/elements/Ellipse.js.map +1 -0
- package/cjs/utils/elements/GraphElement.d.ts +7 -0
- package/cjs/utils/elements/GraphElement.d.ts.map +1 -0
- package/cjs/utils/elements/GraphElement.js +11 -0
- package/cjs/utils/elements/GraphElement.js.map +1 -0
- package/cjs/utils/elements/Line.d.ts +24 -0
- package/cjs/utils/elements/Line.d.ts.map +1 -0
- package/cjs/utils/elements/Line.js +72 -0
- package/cjs/utils/elements/Line.js.map +1 -0
- package/cjs/utils/elements/Plot.d.ts +12 -0
- package/cjs/utils/elements/Plot.d.ts.map +1 -0
- package/cjs/utils/elements/Plot.js +46 -0
- package/cjs/utils/elements/Plot.js.map +1 -0
- package/cjs/utils/elements/Point.d.ts +19 -0
- package/cjs/utils/elements/Point.d.ts.map +1 -0
- package/cjs/utils/elements/Point.js +32 -0
- package/cjs/utils/elements/Point.js.map +1 -0
- package/cjs/utils/elements/Rectangle.d.ts +22 -0
- package/cjs/utils/elements/Rectangle.d.ts.map +1 -0
- package/cjs/utils/elements/Rectangle.js +58 -0
- package/cjs/utils/elements/Rectangle.js.map +1 -0
- package/cjs/utils/elements/Segment.d.ts +20 -0
- package/cjs/utils/elements/Segment.d.ts.map +1 -0
- package/cjs/utils/elements/Segment.js +80 -0
- package/cjs/utils/elements/Segment.js.map +1 -0
- package/cjs/utils/elements/index.d.ts +10 -0
- package/cjs/utils/elements/index.d.ts.map +1 -0
- package/cjs/utils/elements/index.js +25 -0
- package/cjs/utils/elements/index.js.map +1 -0
- package/cjs/utils/errors.js +2 -1
- package/cjs/utils/errors.js.map +1 -1
- package/cjs/utils/index.d.ts +11 -11
- package/cjs/utils/index.d.ts.map +1 -1
- package/cjs/utils/index.js +3 -2
- package/cjs/utils/index.js.map +1 -1
- package/cjs/utils/intersections.d.ts +10 -0
- package/cjs/utils/intersections.d.ts.map +1 -0
- package/cjs/utils/intersections.js +253 -0
- package/cjs/utils/intersections.js.map +1 -0
- package/cjs/utils/maths.d.ts +46 -0
- package/cjs/utils/maths.d.ts.map +1 -0
- package/cjs/utils/maths.js +89 -0
- package/cjs/utils/maths.js.map +1 -0
- package/cjs/utils/numbers.js +12 -9
- package/cjs/utils/numbers.js.map +1 -1
- package/cjs/utils/objects.js +8 -7
- package/cjs/utils/objects.js.map +1 -1
- package/cjs/utils/pdfDocEncoding.js +52 -51
- package/cjs/utils/pdfDocEncoding.js.map +1 -1
- package/cjs/utils/png.js +22 -23
- package/cjs/utils/png.js.map +1 -1
- package/cjs/utils/rng.js +7 -8
- package/cjs/utils/rng.js.map +1 -1
- package/cjs/utils/strings.d.ts +1 -0
- package/cjs/utils/strings.d.ts.map +1 -1
- package/cjs/utils/strings.js +88 -70
- package/cjs/utils/strings.js.map +1 -1
- package/cjs/utils/unicode.js +51 -64
- package/cjs/utils/unicode.js.map +1 -1
- package/cjs/utils/validators.d.ts +2 -2
- package/cjs/utils/validators.d.ts.map +1 -1
- package/cjs/utils/validators.js +84 -67
- package/cjs/utils/validators.js.map +1 -1
- package/dist/pdf-lib.esm.js +16231 -31855
- package/dist/pdf-lib.esm.js.map +1 -1
- package/dist/pdf-lib.esm.min.js +16 -13
- package/dist/pdf-lib.esm.min.js.map +1 -1
- package/dist/pdf-lib.js +16370 -32042
- package/dist/pdf-lib.js.map +1 -1
- package/dist/pdf-lib.min.js +16 -13
- package/dist/pdf-lib.min.js.map +1 -1
- package/es/api/Embeddable.js +1 -0
- package/es/api/PDFDocument.d.ts +44 -11
- package/es/api/PDFDocument.d.ts.map +1 -1
- package/es/api/PDFDocument.js +580 -591
- package/es/api/PDFDocument.js.map +1 -1
- package/es/api/PDFDocumentOptions.d.ts +4 -2
- package/es/api/PDFDocumentOptions.d.ts.map +1 -1
- package/es/api/PDFEmbeddedFile.d.ts +9 -4
- package/es/api/PDFEmbeddedFile.d.ts.map +1 -1
- package/es/api/PDFEmbeddedFile.js +54 -60
- package/es/api/PDFEmbeddedFile.js.map +1 -1
- package/es/api/PDFEmbeddedPage.d.ts +3 -3
- package/es/api/PDFEmbeddedPage.d.ts.map +1 -1
- package/es/api/PDFEmbeddedPage.js +31 -43
- package/es/api/PDFEmbeddedPage.js.map +1 -1
- package/es/api/PDFFont.d.ts +4 -4
- package/es/api/PDFFont.d.ts.map +1 -1
- package/es/api/PDFFont.js +38 -49
- package/es/api/PDFFont.js.map +1 -1
- package/es/api/PDFImage.d.ts +4 -4
- package/es/api/PDFImage.d.ts.map +1 -1
- package/es/api/PDFImage.js +44 -57
- package/es/api/PDFImage.js.map +1 -1
- package/es/api/PDFJavaScript.d.ts +4 -4
- package/es/api/PDFJavaScript.d.ts.map +1 -1
- package/es/api/PDFJavaScript.js +38 -51
- package/es/api/PDFJavaScript.js.map +1 -1
- package/es/api/PDFPage.d.ts +33 -9
- package/es/api/PDFPage.d.ts.map +1 -1
- package/es/api/PDFPage.js +311 -266
- package/es/api/PDFPage.js.map +1 -1
- package/es/api/PDFPageOptions.d.ts +35 -12
- package/es/api/PDFPageOptions.d.ts.map +1 -1
- package/es/api/PDFPageOptions.js.map +1 -1
- package/es/api/PDFSvg.d.ts +7 -0
- package/es/api/PDFSvg.d.ts.map +1 -0
- package/es/api/PDFSvg.js +7 -0
- package/es/api/PDFSvg.js.map +1 -0
- package/es/api/colors.d.ts +6 -2
- package/es/api/colors.d.ts.map +1 -1
- package/es/api/colors.js +33 -34
- package/es/api/colors.js.map +1 -1
- package/es/api/errors.js +73 -144
- package/es/api/errors.js.map +1 -1
- package/es/api/form/PDFButton.d.ts +8 -8
- package/es/api/form/PDFButton.d.ts.map +1 -1
- package/es/api/form/PDFButton.js +56 -62
- package/es/api/form/PDFButton.js.map +1 -1
- package/es/api/form/PDFCheckBox.d.ts +5 -5
- package/es/api/form/PDFCheckBox.d.ts.map +1 -1
- package/es/api/form/PDFCheckBox.js +55 -62
- package/es/api/form/PDFCheckBox.js.map +1 -1
- package/es/api/form/PDFDropdown.d.ts +6 -6
- package/es/api/form/PDFDropdown.d.ts.map +1 -1
- package/es/api/form/PDFDropdown.js +110 -118
- package/es/api/form/PDFDropdown.js.map +1 -1
- package/es/api/form/PDFField.d.ts +7 -7
- package/es/api/form/PDFField.d.ts.map +1 -1
- package/es/api/form/PDFField.js +98 -106
- package/es/api/form/PDFField.js.map +1 -1
- package/es/api/form/PDFForm.d.ts +11 -11
- package/es/api/form/PDFForm.d.ts.map +1 -1
- package/es/api/form/PDFForm.js +203 -200
- package/es/api/form/PDFForm.js.map +1 -1
- package/es/api/form/PDFOptionList.d.ts +6 -6
- package/es/api/form/PDFOptionList.d.ts.map +1 -1
- package/es/api/form/PDFOptionList.js +98 -106
- package/es/api/form/PDFOptionList.js.map +1 -1
- package/es/api/form/PDFRadioGroup.d.ts +5 -5
- package/es/api/form/PDFRadioGroup.d.ts.map +1 -1
- package/es/api/form/PDFRadioGroup.js +86 -91
- package/es/api/form/PDFRadioGroup.js.map +1 -1
- package/es/api/form/PDFSignature.d.ts +3 -3
- package/es/api/form/PDFSignature.d.ts.map +1 -1
- package/es/api/form/PDFSignature.js +23 -28
- package/es/api/form/PDFSignature.js.map +1 -1
- package/es/api/form/PDFTextField.d.ts +8 -8
- package/es/api/form/PDFTextField.d.ts.map +1 -1
- package/es/api/form/PDFTextField.js +121 -128
- package/es/api/form/PDFTextField.js.map +1 -1
- package/es/api/form/appearances.d.ts +21 -21
- package/es/api/form/appearances.d.ts.map +1 -1
- package/es/api/form/appearances.js +245 -214
- package/es/api/form/appearances.js.map +1 -1
- package/es/api/form/index.d.ts +10 -10
- package/es/api/form/index.d.ts.map +1 -1
- package/es/api/form/index.js +10 -10
- package/es/api/form/index.js.map +1 -1
- package/es/api/image/index.d.ts +1 -1
- package/es/api/image/index.d.ts.map +1 -1
- package/es/api/image/index.js +1 -1
- package/es/api/image/index.js.map +1 -1
- package/es/api/index.d.ts +22 -21
- package/es/api/index.d.ts.map +1 -1
- package/es/api/index.js +21 -20
- package/es/api/index.js.map +1 -1
- package/es/api/objects.d.ts +1 -1
- package/es/api/objects.d.ts.map +1 -1
- package/es/api/objects.js +4 -10
- package/es/api/objects.js.map +1 -1
- package/es/api/operations.d.ts +27 -13
- package/es/api/operations.d.ts.map +1 -1
- package/es/api/operations.js +266 -272
- package/es/api/operations.js.map +1 -1
- package/es/api/operators.d.ts +6 -1
- package/es/api/operators.d.ts.map +1 -1
- package/es/api/operators.js +114 -182
- package/es/api/operators.js.map +1 -1
- package/es/api/rotations.d.ts +2 -2
- package/es/api/rotations.d.ts.map +1 -1
- package/es/api/rotations.js +19 -28
- package/es/api/rotations.js.map +1 -1
- package/es/api/sizes.js +1 -1
- package/es/api/sizes.js.map +1 -1
- package/es/api/snapshot/DefaultDocumentSnapshot.d.ts +1 -1
- package/es/api/snapshot/DefaultDocumentSnapshot.d.ts.map +1 -1
- package/es/api/snapshot/DefaultDocumentSnapshot.js +14 -16
- package/es/api/snapshot/DefaultDocumentSnapshot.js.map +1 -1
- package/es/api/snapshot/DocumentSnapshot.d.ts +1 -1
- package/es/api/snapshot/DocumentSnapshot.d.ts.map +1 -1
- package/es/api/snapshot/DocumentSnapshot.js +1 -0
- package/es/api/snapshot/IncrementalDocumentSnapshot.d.ts +1 -1
- package/es/api/snapshot/IncrementalDocumentSnapshot.d.ts.map +1 -1
- package/es/api/snapshot/IncrementalDocumentSnapshot.js +17 -23
- package/es/api/snapshot/IncrementalDocumentSnapshot.js.map +1 -1
- package/es/api/snapshot/index.js +3 -3
- package/es/api/svg.d.ts +76 -0
- package/es/api/svg.d.ts.map +1 -0
- package/es/api/svg.js +742 -0
- package/es/api/svg.js.map +1 -0
- package/es/api/svgPath.d.ts +1 -1
- package/es/api/svgPath.d.ts.map +1 -1
- package/es/api/svgPath.js +104 -108
- package/es/api/svgPath.js.map +1 -1
- package/es/api/text/index.d.ts +2 -2
- package/es/api/text/index.d.ts.map +1 -1
- package/es/api/text/index.js +2 -2
- package/es/api/text/index.js.map +1 -1
- package/es/api/text/layout.d.ts +3 -3
- package/es/api/text/layout.d.ts.map +1 -1
- package/es/api/text/layout.js +84 -88
- package/es/api/text/layout.js.map +1 -1
- package/es/core/PDFContext.d.ts +39 -19
- package/es/core/PDFContext.d.ts.map +1 -1
- package/es/core/PDFContext.js +128 -101
- package/es/core/PDFContext.js.map +1 -1
- package/es/core/PDFObjectCopier.d.ts +2 -2
- package/es/core/PDFObjectCopier.d.ts.map +1 -1
- package/es/core/PDFObjectCopier.js +57 -61
- package/es/core/PDFObjectCopier.js.map +1 -1
- package/es/core/acroform/PDFAcroButton.d.ts +7 -7
- package/es/core/acroform/PDFAcroButton.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroButton.js +41 -47
- package/es/core/acroform/PDFAcroButton.js.map +1 -1
- package/es/core/acroform/PDFAcroCheckBox.d.ts +5 -5
- package/es/core/acroform/PDFAcroCheckBox.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroCheckBox.js +27 -35
- package/es/core/acroform/PDFAcroCheckBox.js.map +1 -1
- package/es/core/acroform/PDFAcroChoice.d.ts +4 -4
- package/es/core/acroform/PDFAcroChoice.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroChoice.js +46 -60
- package/es/core/acroform/PDFAcroChoice.js.map +1 -1
- package/es/core/acroform/PDFAcroComboBox.d.ts +4 -4
- package/es/core/acroform/PDFAcroComboBox.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroComboBox.js +14 -22
- package/es/core/acroform/PDFAcroComboBox.js.map +1 -1
- package/es/core/acroform/PDFAcroField.d.ts +8 -8
- package/es/core/acroform/PDFAcroField.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroField.js +79 -80
- package/es/core/acroform/PDFAcroField.js.map +1 -1
- package/es/core/acroform/PDFAcroForm.d.ts +5 -5
- package/es/core/acroform/PDFAcroForm.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroForm.js +43 -44
- package/es/core/acroform/PDFAcroForm.js.map +1 -1
- package/es/core/acroform/PDFAcroListBox.d.ts +4 -4
- package/es/core/acroform/PDFAcroListBox.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroListBox.js +12 -20
- package/es/core/acroform/PDFAcroListBox.js.map +1 -1
- package/es/core/acroform/PDFAcroNonTerminal.d.ts +4 -4
- package/es/core/acroform/PDFAcroNonTerminal.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroNonTerminal.js +17 -25
- package/es/core/acroform/PDFAcroNonTerminal.js.map +1 -1
- package/es/core/acroform/PDFAcroPushButton.d.ts +4 -4
- package/es/core/acroform/PDFAcroPushButton.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroPushButton.js +14 -22
- package/es/core/acroform/PDFAcroPushButton.js.map +1 -1
- package/es/core/acroform/PDFAcroRadioButton.d.ts +5 -5
- package/es/core/acroform/PDFAcroRadioButton.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroRadioButton.js +32 -40
- package/es/core/acroform/PDFAcroRadioButton.js.map +1 -1
- package/es/core/acroform/PDFAcroSignature.d.ts +3 -3
- package/es/core/acroform/PDFAcroSignature.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroSignature.js +4 -12
- package/es/core/acroform/PDFAcroSignature.js.map +1 -1
- package/es/core/acroform/PDFAcroTerminal.d.ts +5 -5
- package/es/core/acroform/PDFAcroTerminal.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroTerminal.js +27 -35
- package/es/core/acroform/PDFAcroTerminal.js.map +1 -1
- package/es/core/acroform/PDFAcroText.d.ts +7 -7
- package/es/core/acroform/PDFAcroText.d.ts.map +1 -1
- package/es/core/acroform/PDFAcroText.js +39 -45
- package/es/core/acroform/PDFAcroText.js.map +1 -1
- package/es/core/acroform/flags.js +1 -1
- package/es/core/acroform/flags.js.map +1 -1
- package/es/core/acroform/index.d.ts +15 -15
- package/es/core/acroform/index.d.ts.map +1 -1
- package/es/core/acroform/index.js +15 -15
- package/es/core/acroform/index.js.map +1 -1
- package/es/core/acroform/utils.d.ts +5 -5
- package/es/core/acroform/utils.d.ts.map +1 -1
- package/es/core/acroform/utils.js +44 -46
- package/es/core/acroform/utils.js.map +1 -1
- package/es/core/annotation/AppearanceCharacteristics.d.ts +5 -5
- package/es/core/annotation/AppearanceCharacteristics.d.ts.map +1 -1
- package/es/core/annotation/AppearanceCharacteristics.js +60 -63
- package/es/core/annotation/AppearanceCharacteristics.js.map +1 -1
- package/es/core/annotation/BorderStyle.d.ts +2 -2
- package/es/core/annotation/BorderStyle.d.ts.map +1 -1
- package/es/core/annotation/BorderStyle.js +14 -15
- package/es/core/annotation/BorderStyle.js.map +1 -1
- package/es/core/annotation/PDFAnnotation.d.ts +6 -6
- package/es/core/annotation/PDFAnnotation.d.ts.map +1 -1
- package/es/core/annotation/PDFAnnotation.js +75 -76
- package/es/core/annotation/PDFAnnotation.js.map +1 -1
- package/es/core/annotation/PDFWidgetAnnotation.d.ts +9 -9
- package/es/core/annotation/PDFWidgetAnnotation.d.ts.map +1 -1
- package/es/core/annotation/PDFWidgetAnnotation.js +59 -67
- package/es/core/annotation/PDFWidgetAnnotation.js.map +1 -1
- package/es/core/annotation/flags.js +1 -1
- package/es/core/annotation/flags.js.map +1 -1
- package/es/core/annotation/index.d.ts +4 -4
- package/es/core/annotation/index.d.ts.map +1 -1
- package/es/core/annotation/index.js +4 -4
- package/es/core/annotation/index.js.map +1 -1
- package/es/core/crypto.d.ts +96 -0
- package/es/core/crypto.d.ts.map +1 -0
- package/es/core/crypto.js +1609 -0
- package/es/core/crypto.js.map +1 -0
- package/es/core/document/PDFCrossRefSection.d.ts +1 -1
- package/es/core/document/PDFCrossRefSection.d.ts.map +1 -1
- package/es/core/document/PDFCrossRefSection.js +55 -58
- package/es/core/document/PDFCrossRefSection.js.map +1 -1
- package/es/core/document/PDFHeader.d.ts +1 -0
- package/es/core/document/PDFHeader.d.ts.map +1 -1
- package/es/core/document/PDFHeader.js +18 -18
- package/es/core/document/PDFHeader.js.map +1 -1
- package/es/core/document/PDFTrailer.js +14 -17
- package/es/core/document/PDFTrailer.js.map +1 -1
- package/es/core/document/PDFTrailerDict.d.ts +1 -1
- package/es/core/document/PDFTrailerDict.d.ts.map +1 -1
- package/es/core/document/PDFTrailerDict.js +13 -14
- package/es/core/document/PDFTrailerDict.js.map +1 -1
- package/es/core/embedders/CMap.d.ts +2 -2
- package/es/core/embedders/CMap.d.ts.map +1 -1
- package/es/core/embedders/CMap.js +38 -26
- package/es/core/embedders/CMap.js.map +1 -1
- package/es/core/embedders/CustomFontEmbedder.d.ts +5 -5
- package/es/core/embedders/CustomFontEmbedder.d.ts.map +1 -1
- package/es/core/embedders/CustomFontEmbedder.js +132 -177
- package/es/core/embedders/CustomFontEmbedder.js.map +1 -1
- package/es/core/embedders/CustomFontSubsetEmbedder.d.ts +3 -3
- package/es/core/embedders/CustomFontSubsetEmbedder.d.ts.map +1 -1
- package/es/core/embedders/CustomFontSubsetEmbedder.js +37 -48
- package/es/core/embedders/CustomFontSubsetEmbedder.js.map +1 -1
- package/es/core/embedders/FileEmbedder.d.ts +3 -2
- package/es/core/embedders/FileEmbedder.d.ts.map +1 -1
- package/es/core/embedders/FileEmbedder.js +44 -48
- package/es/core/embedders/FileEmbedder.js.map +1 -1
- package/es/core/embedders/FontFlags.d.ts +1 -1
- package/es/core/embedders/FontFlags.d.ts.map +1 -1
- package/es/core/embedders/FontFlags.js +6 -6
- package/es/core/embedders/FontFlags.js.map +1 -1
- package/es/core/embedders/JavaScriptEmbedder.d.ts +2 -2
- package/es/core/embedders/JavaScriptEmbedder.d.ts.map +1 -1
- package/es/core/embedders/JavaScriptEmbedder.js +22 -27
- package/es/core/embedders/JavaScriptEmbedder.js.map +1 -1
- package/es/core/embedders/JpegEmbedder.d.ts +2 -2
- package/es/core/embedders/JpegEmbedder.d.ts.map +1 -1
- package/es/core/embedders/JpegEmbedder.js +66 -73
- package/es/core/embedders/JpegEmbedder.js.map +1 -1
- package/es/core/embedders/PDFPageEmbedder.d.ts +4 -4
- package/es/core/embedders/PDFPageEmbedder.d.ts.map +1 -1
- package/es/core/embedders/PDFPageEmbedder.js +63 -64
- package/es/core/embedders/PDFPageEmbedder.js.map +1 -1
- package/es/core/embedders/PngEmbedder.d.ts +2 -2
- package/es/core/embedders/PngEmbedder.d.ts.map +1 -1
- package/es/core/embedders/PngEmbedder.js +33 -41
- package/es/core/embedders/PngEmbedder.js.map +1 -1
- package/es/core/embedders/StandardFontEmbedder.d.ts +4 -4
- package/es/core/embedders/StandardFontEmbedder.d.ts.map +1 -1
- package/es/core/embedders/StandardFontEmbedder.js +50 -48
- package/es/core/embedders/StandardFontEmbedder.js.map +1 -1
- package/es/core/errors.d.ts +1 -1
- package/es/core/errors.d.ts.map +1 -1
- package/es/core/errors.js +175 -316
- package/es/core/errors.js.map +1 -1
- package/es/core/index.d.ts +48 -47
- package/es/core/index.d.ts.map +1 -1
- package/es/core/index.js +48 -47
- package/es/core/index.js.map +1 -1
- package/es/core/interactive/ViewerPreferences.d.ts +8 -8
- package/es/core/interactive/ViewerPreferences.d.ts.map +1 -1
- package/es/core/interactive/ViewerPreferences.js +127 -130
- package/es/core/interactive/ViewerPreferences.js.map +1 -1
- package/es/core/objects/PDFArray.d.ts +12 -12
- package/es/core/objects/PDFArray.d.ts.map +1 -1
- package/es/core/objects/PDFArray.js +71 -81
- package/es/core/objects/PDFArray.js.map +1 -1
- package/es/core/objects/PDFBool.d.ts +1 -1
- package/es/core/objects/PDFBool.d.ts.map +1 -1
- package/es/core/objects/PDFBool.js +21 -26
- package/es/core/objects/PDFBool.js.map +1 -1
- package/es/core/objects/PDFDict.d.ts +13 -12
- package/es/core/objects/PDFDict.d.ts.map +1 -1
- package/es/core/objects/PDFDict.js +75 -88
- package/es/core/objects/PDFDict.js.map +1 -1
- package/es/core/objects/PDFHexString.d.ts +2 -1
- package/es/core/objects/PDFHexString.d.ts.map +1 -1
- package/es/core/objects/PDFHexString.js +45 -48
- package/es/core/objects/PDFHexString.js.map +1 -1
- package/es/core/objects/PDFInvalidObject.d.ts +1 -1
- package/es/core/objects/PDFInvalidObject.d.ts.map +1 -1
- package/es/core/objects/PDFInvalidObject.js +18 -22
- package/es/core/objects/PDFInvalidObject.js.map +1 -1
- package/es/core/objects/PDFName.d.ts +1 -1
- package/es/core/objects/PDFName.d.ts.map +1 -1
- package/es/core/objects/PDFName.js +83 -92
- package/es/core/objects/PDFName.js.map +1 -1
- package/es/core/objects/PDFNull.d.ts +1 -1
- package/es/core/objects/PDFNull.d.ts.map +1 -1
- package/es/core/objects/PDFNull.js +14 -20
- package/es/core/objects/PDFNull.js.map +1 -1
- package/es/core/objects/PDFNumber.d.ts +1 -1
- package/es/core/objects/PDFNumber.d.ts.map +1 -1
- package/es/core/objects/PDFNumber.js +22 -26
- package/es/core/objects/PDFNumber.js.map +1 -1
- package/es/core/objects/PDFObject.d.ts +1 -1
- package/es/core/objects/PDFObject.d.ts.map +1 -1
- package/es/core/objects/PDFObject.js +13 -16
- package/es/core/objects/PDFObject.js.map +1 -1
- package/es/core/objects/PDFRawStream.d.ts +8 -5
- package/es/core/objects/PDFRawStream.d.ts.map +1 -1
- package/es/core/objects/PDFRawStream.js +22 -24
- package/es/core/objects/PDFRawStream.js.map +1 -1
- package/es/core/objects/PDFRef.d.ts +1 -1
- package/es/core/objects/PDFRef.d.ts.map +1 -1
- package/es/core/objects/PDFRef.js +30 -36
- package/es/core/objects/PDFRef.js.map +1 -1
- package/es/core/objects/PDFStream.d.ts +4 -3
- package/es/core/objects/PDFStream.d.ts.map +1 -1
- package/es/core/objects/PDFStream.js +34 -35
- package/es/core/objects/PDFStream.js.map +1 -1
- package/es/core/objects/PDFString.d.ts +1 -1
- package/es/core/objects/PDFString.d.ts.map +1 -1
- package/es/core/objects/PDFString.js +50 -54
- package/es/core/objects/PDFString.js.map +1 -1
- package/es/core/operators/PDFOperator.d.ts +9 -9
- package/es/core/operators/PDFOperator.d.ts.map +1 -1
- package/es/core/operators/PDFOperator.js +26 -29
- package/es/core/operators/PDFOperator.js.map +1 -1
- package/es/core/parser/BaseParser.d.ts +1 -1
- package/es/core/parser/BaseParser.d.ts.map +1 -1
- package/es/core/parser/BaseParser.js +36 -38
- package/es/core/parser/BaseParser.js.map +1 -1
- package/es/core/parser/ByteStream.d.ts +1 -1
- package/es/core/parser/ByteStream.d.ts.map +1 -1
- package/es/core/parser/ByteStream.js +29 -32
- package/es/core/parser/ByteStream.js.map +1 -1
- package/es/core/parser/PDFObjectParser.d.ts +23 -21
- package/es/core/parser/PDFObjectParser.d.ts.map +1 -1
- package/es/core/parser/PDFObjectParser.js +92 -85
- package/es/core/parser/PDFObjectParser.js.map +1 -1
- package/es/core/parser/PDFObjectStreamParser.d.ts +3 -3
- package/es/core/parser/PDFObjectStreamParser.d.ts.map +1 -1
- package/es/core/parser/PDFObjectStreamParser.js +42 -60
- package/es/core/parser/PDFObjectStreamParser.js.map +1 -1
- package/es/core/parser/PDFParser.d.ts +6 -4
- package/es/core/parser/PDFParser.d.ts.map +1 -1
- package/es/core/parser/PDFParser.js +169 -217
- package/es/core/parser/PDFParser.js.map +1 -1
- package/es/core/parser/PDFXRefStreamParser.d.ts +2 -2
- package/es/core/parser/PDFXRefStreamParser.d.ts.map +1 -1
- package/es/core/parser/PDFXRefStreamParser.js +37 -40
- package/es/core/parser/PDFXRefStreamParser.js.map +1 -1
- package/es/core/security/PDFSecurity.d.ts +75 -0
- package/es/core/security/PDFSecurity.d.ts.map +1 -0
- package/es/core/security/PDFSecurity.js +403 -0
- package/es/core/security/PDFSecurity.js.map +1 -0
- package/es/core/streams/Ascii85Stream.d.ts +2 -2
- package/es/core/streams/Ascii85Stream.d.ts.map +1 -1
- package/es/core/streams/Ascii85Stream.js +20 -26
- package/es/core/streams/Ascii85Stream.js.map +1 -1
- package/es/core/streams/AsciiHexStream.d.ts +2 -2
- package/es/core/streams/AsciiHexStream.d.ts.map +1 -1
- package/es/core/streams/AsciiHexStream.js +18 -22
- package/es/core/streams/AsciiHexStream.js.map +1 -1
- package/es/core/streams/DecodeStream.d.ts +1 -1
- package/es/core/streams/DecodeStream.d.ts.map +1 -1
- package/es/core/streams/DecodeStream.js +53 -60
- package/es/core/streams/DecodeStream.js.map +1 -1
- package/es/core/streams/DecryptStream.d.ts +13 -0
- package/es/core/streams/DecryptStream.d.ts.map +1 -0
- package/es/core/streams/DecryptStream.js +36 -0
- package/es/core/streams/DecryptStream.js.map +1 -0
- package/es/core/streams/FlateStream.d.ts +2 -2
- package/es/core/streams/FlateStream.d.ts.map +1 -1
- package/es/core/streams/FlateStream.js +81 -84
- package/es/core/streams/FlateStream.js.map +1 -1
- package/es/core/streams/LZWStream.d.ts +3 -3
- package/es/core/streams/LZWStream.d.ts.map +1 -1
- package/es/core/streams/LZWStream.js +41 -45
- package/es/core/streams/LZWStream.js.map +1 -1
- package/es/core/streams/RunLengthStream.d.ts +2 -2
- package/es/core/streams/RunLengthStream.d.ts.map +1 -1
- package/es/core/streams/RunLengthStream.js +15 -19
- package/es/core/streams/RunLengthStream.js.map +1 -1
- package/es/core/streams/Stream.js +45 -56
- package/es/core/streams/Stream.js.map +1 -1
- package/es/core/streams/decode.d.ts +3 -3
- package/es/core/streams/decode.d.ts.map +1 -1
- package/es/core/streams/decode.js +23 -21
- package/es/core/streams/decode.js.map +1 -1
- package/es/core/structures/PDFCatalog.d.ts +5 -5
- package/es/core/structures/PDFCatalog.d.ts.map +1 -1
- package/es/core/structures/PDFCatalog.js +39 -47
- package/es/core/structures/PDFCatalog.js.map +1 -1
- package/es/core/structures/PDFContentStream.d.ts +4 -4
- package/es/core/structures/PDFContentStream.d.ts.map +1 -1
- package/es/core/structures/PDFContentStream.js +30 -43
- package/es/core/structures/PDFContentStream.js.map +1 -1
- package/es/core/structures/PDFCrossRefStream.d.ts +6 -6
- package/es/core/structures/PDFCrossRefStream.d.ts.map +1 -1
- package/es/core/structures/PDFCrossRefStream.js +91 -100
- package/es/core/structures/PDFCrossRefStream.js.map +1 -1
- package/es/core/structures/PDFFlateStream.d.ts +5 -4
- package/es/core/structures/PDFFlateStream.d.ts.map +1 -1
- package/es/core/structures/PDFFlateStream.js +22 -23
- package/es/core/structures/PDFFlateStream.js.map +1 -1
- package/es/core/structures/PDFObjectStream.d.ts +5 -5
- package/es/core/structures/PDFObjectStream.d.ts.map +1 -1
- package/es/core/structures/PDFObjectStream.js +46 -54
- package/es/core/structures/PDFObjectStream.js.map +1 -1
- package/es/core/structures/PDFPageLeaf.d.ts +9 -9
- package/es/core/structures/PDFPageLeaf.d.ts.map +1 -1
- package/es/core/structures/PDFPageLeaf.js +125 -133
- package/es/core/structures/PDFPageLeaf.js.map +1 -1
- package/es/core/structures/PDFPageTree.d.ts +8 -8
- package/es/core/structures/PDFPageTree.d.ts.map +1 -1
- package/es/core/structures/PDFPageTree.js +66 -75
- package/es/core/structures/PDFPageTree.js.map +1 -1
- package/es/core/syntax/Delimiters.js +2 -2
- package/es/core/syntax/Delimiters.js.map +1 -1
- package/es/core/syntax/Irregular.js +5 -5
- package/es/core/syntax/Irregular.js.map +1 -1
- package/es/core/syntax/Keywords.d.ts +1 -1
- package/es/core/syntax/Keywords.d.ts.map +1 -1
- package/es/core/syntax/Keywords.js +14 -15
- package/es/core/syntax/Keywords.js.map +1 -1
- package/es/core/syntax/Numeric.js +5 -5
- package/es/core/syntax/Numeric.js.map +1 -1
- package/es/core/syntax/Whitespace.js +2 -2
- package/es/core/syntax/Whitespace.js.map +1 -1
- package/es/core/writers/PDFStreamWriter.d.ts +7 -7
- package/es/core/writers/PDFStreamWriter.d.ts.map +1 -1
- package/es/core/writers/PDFStreamWriter.js +102 -126
- package/es/core/writers/PDFStreamWriter.js.map +1 -1
- package/es/core/writers/PDFWriter.d.ts +15 -10
- package/es/core/writers/PDFWriter.d.ts.map +1 -1
- package/es/core/writers/PDFWriter.js +116 -142
- package/es/core/writers/PDFWriter.js.map +1 -1
- package/es/index.d.ts +4 -4
- package/es/index.d.ts.map +1 -1
- package/es/index.js +4 -4
- package/es/index.js.map +1 -1
- package/es/package.json +3 -0
- package/es/types/fontkit.js +1 -0
- package/es/types/index.d.ts +25 -1
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +1 -0
- package/es/types/matrix.d.ts +8 -1
- package/es/types/matrix.d.ts.map +1 -1
- package/es/types/matrix.js +1 -1
- package/es/types/matrix.js.map +1 -1
- package/es/utils/Cache.js +10 -11
- package/es/utils/Cache.js.map +1 -1
- package/es/utils/arrays.d.ts +3 -1
- package/es/utils/arrays.d.ts.map +1 -1
- package/es/utils/arrays.js +78 -60
- package/es/utils/arrays.js.map +1 -1
- package/es/utils/async.d.ts.map +1 -1
- package/es/utils/async.js +3 -5
- package/es/utils/async.js.map +1 -1
- package/es/utils/base64.d.ts.map +1 -1
- package/es/utils/base64.js +24 -24
- package/es/utils/base64.js.map +1 -1
- package/es/utils/elements/Arc.d.ts +23 -0
- package/es/utils/elements/Arc.d.ts.map +1 -0
- package/es/utils/elements/Arc.js +74 -0
- package/es/utils/elements/Arc.js.map +1 -0
- package/es/utils/elements/Circle.d.ts +15 -0
- package/es/utils/elements/Circle.d.ts.map +1 -0
- package/es/utils/elements/Circle.js +37 -0
- package/es/utils/elements/Circle.js.map +1 -0
- package/es/utils/elements/Ellipse.d.ts +21 -0
- package/es/utils/elements/Ellipse.d.ts.map +1 -0
- package/es/utils/elements/Ellipse.js +87 -0
- package/es/utils/elements/Ellipse.js.map +1 -0
- package/es/utils/elements/GraphElement.d.ts +7 -0
- package/es/utils/elements/GraphElement.d.ts.map +1 -0
- package/es/utils/elements/GraphElement.js +8 -0
- package/es/utils/elements/GraphElement.js.map +1 -0
- package/es/utils/elements/Line.d.ts +24 -0
- package/es/utils/elements/Line.d.ts.map +1 -0
- package/es/utils/elements/Line.js +68 -0
- package/es/utils/elements/Line.js.map +1 -0
- package/es/utils/elements/Plot.d.ts +12 -0
- package/es/utils/elements/Plot.d.ts.map +1 -0
- package/es/utils/elements/Plot.js +42 -0
- package/es/utils/elements/Plot.js.map +1 -0
- package/es/utils/elements/Point.d.ts +19 -0
- package/es/utils/elements/Point.d.ts.map +1 -0
- package/es/utils/elements/Point.js +28 -0
- package/es/utils/elements/Point.js.map +1 -0
- package/es/utils/elements/Rectangle.d.ts +22 -0
- package/es/utils/elements/Rectangle.d.ts.map +1 -0
- package/es/utils/elements/Rectangle.js +54 -0
- package/es/utils/elements/Rectangle.js.map +1 -0
- package/es/utils/elements/Segment.d.ts +20 -0
- package/es/utils/elements/Segment.d.ts.map +1 -0
- package/es/utils/elements/Segment.js +76 -0
- package/es/utils/elements/Segment.js.map +1 -0
- package/es/utils/elements/index.d.ts +10 -0
- package/es/utils/elements/index.d.ts.map +1 -0
- package/es/utils/elements/index.js +10 -0
- package/es/utils/elements/index.js.map +1 -0
- package/es/utils/errors.js +1 -1
- package/es/utils/errors.js.map +1 -1
- package/es/utils/index.d.ts +11 -11
- package/es/utils/index.d.ts.map +1 -1
- package/es/utils/index.js +11 -11
- package/es/utils/index.js.map +1 -1
- package/es/utils/intersections.d.ts +10 -0
- package/es/utils/intersections.d.ts.map +1 -0
- package/es/utils/intersections.js +243 -0
- package/es/utils/intersections.js.map +1 -0
- package/es/utils/maths.d.ts +46 -0
- package/es/utils/maths.d.ts.map +1 -0
- package/es/utils/maths.js +69 -0
- package/es/utils/maths.js.map +1 -0
- package/es/utils/numbers.js +9 -9
- package/es/utils/numbers.js.map +1 -1
- package/es/utils/objects.js +4 -6
- package/es/utils/objects.js.map +1 -1
- package/es/utils/pdfDocEncoding.js +7 -7
- package/es/utils/pdfDocEncoding.js.map +1 -1
- package/es/utils/png.js +20 -22
- package/es/utils/png.js.map +1 -1
- package/es/utils/rng.js +7 -9
- package/es/utils/rng.js.map +1 -1
- package/es/utils/strings.d.ts +1 -0
- package/es/utils/strings.d.ts.map +1 -1
- package/es/utils/strings.js +66 -68
- package/es/utils/strings.js.map +1 -1
- package/es/utils/unicode.js +42 -63
- package/es/utils/unicode.js.map +1 -1
- package/es/utils/validators.d.ts +2 -2
- package/es/utils/validators.d.ts.map +1 -1
- package/es/utils/validators.js +38 -38
- package/es/utils/validators.js.map +1 -1
- package/package.json +70 -39
- package/src/api/PDFDocument.ts +248 -22
- package/src/api/PDFDocumentOptions.ts +4 -2
- package/src/api/PDFEmbeddedFile.ts +12 -4
- package/src/api/PDFEmbeddedPage.ts +4 -4
- package/src/api/PDFFont.ts +4 -4
- package/src/api/PDFImage.ts +4 -4
- package/src/api/PDFJavaScript.ts +4 -4
- package/src/api/PDFPage.ts +93 -20
- package/src/api/PDFPageOptions.ts +34 -12
- package/src/api/PDFSvg.ts +10 -0
- package/src/api/colors.ts +27 -19
- package/src/api/form/PDFButton.ts +11 -11
- package/src/api/form/PDFCheckBox.ts +8 -8
- package/src/api/form/PDFDropdown.ts +9 -9
- package/src/api/form/PDFField.ts +7 -7
- package/src/api/form/PDFForm.ts +56 -46
- package/src/api/form/PDFOptionList.ts +9 -9
- package/src/api/form/PDFRadioGroup.ts +8 -8
- package/src/api/form/PDFSignature.ts +4 -4
- package/src/api/form/PDFTextField.ts +15 -15
- package/src/api/form/appearances.ts +41 -49
- package/src/api/form/index.ts +10 -10
- package/src/api/image/index.ts +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/objects.ts +1 -1
- package/src/api/operations.ts +198 -142
- package/src/api/operators.ts +10 -3
- package/src/api/rotations.ts +7 -9
- package/src/api/svg.ts +1074 -0
- package/src/api/svgPath.ts +2 -4
- package/src/api/text/index.ts +2 -2
- package/src/api/text/layout.ts +5 -5
- package/src/core/PDFContext.ts +94 -19
- package/src/core/PDFObjectCopier.ts +8 -8
- package/src/core/acroform/PDFAcroButton.ts +8 -8
- package/src/core/acroform/PDFAcroCheckBox.ts +6 -6
- package/src/core/acroform/PDFAcroChoice.ts +7 -10
- package/src/core/acroform/PDFAcroComboBox.ts +5 -5
- package/src/core/acroform/PDFAcroField.ts +12 -12
- package/src/core/acroform/PDFAcroForm.ts +8 -11
- package/src/core/acroform/PDFAcroListBox.ts +4 -4
- package/src/core/acroform/PDFAcroNonTerminal.ts +5 -5
- package/src/core/acroform/PDFAcroPushButton.ts +5 -5
- package/src/core/acroform/PDFAcroRadioButton.ts +7 -7
- package/src/core/acroform/PDFAcroSignature.ts +3 -3
- package/src/core/acroform/PDFAcroTerminal.ts +6 -6
- package/src/core/acroform/PDFAcroText.ts +8 -8
- package/src/core/acroform/index.ts +15 -15
- package/src/core/acroform/utils.ts +20 -20
- package/src/core/annotation/AppearanceCharacteristics.ts +6 -6
- package/src/core/annotation/BorderStyle.ts +3 -3
- package/src/core/annotation/PDFAnnotation.ts +6 -6
- package/src/core/annotation/PDFWidgetAnnotation.ts +9 -9
- package/src/core/annotation/index.ts +4 -4
- package/src/core/crypto.ts +1997 -0
- package/src/core/document/PDFCrossRefSection.ts +4 -4
- package/src/core/document/PDFHeader.ts +6 -2
- package/src/core/document/PDFTrailer.ts +2 -2
- package/src/core/document/PDFTrailerDict.ts +2 -2
- package/src/core/embedders/CMap.ts +3 -3
- package/src/core/embedders/CustomFontEmbedder.ts +9 -9
- package/src/core/embedders/CustomFontSubsetEmbedder.ts +10 -4
- package/src/core/embedders/FileEmbedder.ts +8 -4
- package/src/core/embedders/FontFlags.ts +1 -1
- package/src/core/embedders/JavaScriptEmbedder.ts +3 -3
- package/src/core/embedders/JpegEmbedder.ts +2 -2
- package/src/core/embedders/PDFPageEmbedder.ts +24 -22
- package/src/core/embedders/PngEmbedder.ts +3 -3
- package/src/core/embedders/StandardFontEmbedder.ts +10 -5
- package/src/core/errors.ts +15 -13
- package/src/core/index.ts +52 -47
- package/src/core/interactive/ViewerPreferences.ts +7 -7
- package/src/core/objects/PDFArray.ts +22 -22
- package/src/core/objects/PDFBool.ts +3 -3
- package/src/core/objects/PDFDict.ts +14 -12
- package/src/core/objects/PDFHexString.ts +8 -4
- package/src/core/objects/PDFInvalidObject.ts +1 -1
- package/src/core/objects/PDFName.ts +6 -6
- package/src/core/objects/PDFNull.ts +2 -2
- package/src/core/objects/PDFNumber.ts +3 -3
- package/src/core/objects/PDFObject.ts +2 -2
- package/src/core/objects/PDFRawStream.ts +24 -10
- package/src/core/objects/PDFRef.ts +4 -4
- package/src/core/objects/PDFStream.ts +14 -7
- package/src/core/objects/PDFString.ts +4 -4
- package/src/core/operators/PDFOperator.ts +10 -10
- package/src/core/parser/BaseParser.ts +6 -6
- package/src/core/parser/ByteStream.ts +4 -4
- package/src/core/parser/PDFObjectParser.ts +78 -41
- package/src/core/parser/PDFObjectStreamParser.ts +9 -9
- package/src/core/parser/PDFParser.ts +43 -23
- package/src/core/parser/PDFXRefStreamParser.ts +9 -9
- package/src/core/security/PDFSecurity.ts +685 -0
- package/src/core/streams/Ascii85Stream.ts +2 -2
- package/src/core/streams/AsciiHexStream.ts +2 -2
- package/src/core/streams/DecodeStream.ts +2 -2
- package/src/core/streams/DecryptStream.ts +56 -0
- package/src/core/streams/FlateStream.ts +3 -2
- package/src/core/streams/LZWStream.ts +3 -3
- package/src/core/streams/RunLengthStream.ts +2 -2
- package/src/core/streams/decode.ts +23 -18
- package/src/core/structures/PDFCatalog.ts +6 -6
- package/src/core/structures/PDFContentStream.ts +5 -5
- package/src/core/structures/PDFCrossRefStream.ts +6 -6
- package/src/core/structures/PDFFlateStream.ts +10 -6
- package/src/core/structures/PDFObjectStream.ts +8 -8
- package/src/core/structures/PDFPageLeaf.ts +9 -9
- package/src/core/structures/PDFPageTree.ts +8 -8
- package/src/core/syntax/Delimiters.ts +1 -1
- package/src/core/syntax/Irregular.ts +3 -3
- package/src/core/syntax/Keywords.ts +1 -1
- package/src/core/syntax/Numeric.ts +1 -1
- package/src/core/syntax/Whitespace.ts +1 -1
- package/src/core/writers/PDFStreamWriter.ts +12 -1
- package/src/core/writers/PDFWriter.ts +22 -13
- package/src/index.ts +4 -4
- package/src/types/index.ts +38 -1
- package/src/utils/arrays.ts +33 -2
- package/src/utils/base64.ts +2 -1
- package/src/utils/elements/Arc.ts +107 -0
- package/src/utils/elements/Circle.ts +55 -0
- package/src/utils/elements/Ellipse.ts +135 -0
- package/src/utils/elements/GraphElement.ts +14 -0
- package/src/utils/elements/Line.ts +85 -0
- package/src/utils/elements/Plot.ts +50 -0
- package/src/utils/elements/Point.ts +37 -0
- package/src/utils/elements/Rectangle.ts +65 -0
- package/src/utils/elements/Segment.ts +92 -0
- package/src/utils/elements/index.ts +9 -0
- package/src/utils/index.ts +11 -11
- package/src/utils/intersections.ts +280 -0
- package/src/utils/maths.ts +108 -0
- package/src/utils/pdfDocEncoding.ts +1 -1
- package/src/utils/png.ts +1 -1
- package/src/utils/strings.ts +11 -1
- package/src/utils/unicode.ts +1 -1
- package/src/utils/validators.ts +1 -1
- package/ts3.4/cjs/api/PDFDocument.d.ts +52 -13
- package/ts3.4/cjs/api/PDFDocumentOptions.d.ts +4 -2
- package/ts3.4/cjs/api/PDFEmbeddedFile.d.ts +9 -4
- package/ts3.4/cjs/api/PDFEmbeddedPage.d.ts +3 -3
- package/ts3.4/cjs/api/PDFFont.d.ts +4 -4
- package/ts3.4/cjs/api/PDFImage.d.ts +4 -4
- package/ts3.4/cjs/api/PDFJavaScript.d.ts +4 -4
- package/ts3.4/cjs/api/PDFPage.d.ts +36 -9
- package/ts3.4/cjs/api/PDFPageOptions.d.ts +35 -12
- package/ts3.4/cjs/api/PDFSvg.d.ts +7 -0
- package/ts3.4/cjs/api/colors.d.ts +6 -2
- package/ts3.4/cjs/api/form/PDFButton.d.ts +8 -8
- package/ts3.4/cjs/api/form/PDFCheckBox.d.ts +5 -5
- package/ts3.4/cjs/api/form/PDFDropdown.d.ts +6 -6
- package/ts3.4/cjs/api/form/PDFField.d.ts +7 -7
- package/ts3.4/cjs/api/form/PDFForm.d.ts +11 -11
- package/ts3.4/cjs/api/form/PDFOptionList.d.ts +6 -6
- package/ts3.4/cjs/api/form/PDFRadioGroup.d.ts +5 -5
- package/ts3.4/cjs/api/form/PDFSignature.d.ts +3 -3
- package/ts3.4/cjs/api/form/PDFTextField.d.ts +8 -8
- package/ts3.4/cjs/api/form/appearances.d.ts +21 -21
- package/ts3.4/cjs/api/form/index.d.ts +10 -10
- package/ts3.4/cjs/api/image/index.d.ts +1 -1
- package/ts3.4/cjs/api/index.d.ts +22 -21
- package/ts3.4/cjs/api/objects.d.ts +1 -1
- package/ts3.4/cjs/api/operations.d.ts +27 -13
- package/ts3.4/cjs/api/operators.d.ts +6 -1
- package/ts3.4/cjs/api/rotations.d.ts +2 -2
- package/ts3.4/cjs/api/sizes.d.ts +200 -50
- package/ts3.4/cjs/api/snapshot/DefaultDocumentSnapshot.d.ts +1 -1
- package/ts3.4/cjs/api/snapshot/DocumentSnapshot.d.ts +1 -1
- package/ts3.4/cjs/api/snapshot/IncrementalDocumentSnapshot.d.ts +1 -1
- package/ts3.4/cjs/api/svg.d.ts +76 -0
- package/ts3.4/cjs/api/svgPath.d.ts +1 -1
- package/ts3.4/cjs/api/text/index.d.ts +2 -2
- package/ts3.4/cjs/api/text/layout.d.ts +3 -3
- package/ts3.4/cjs/core/PDFContext.d.ts +43 -20
- package/ts3.4/cjs/core/PDFObjectCopier.d.ts +2 -2
- package/ts3.4/cjs/core/acroform/PDFAcroButton.d.ts +7 -7
- package/ts3.4/cjs/core/acroform/PDFAcroCheckBox.d.ts +5 -5
- package/ts3.4/cjs/core/acroform/PDFAcroChoice.d.ts +4 -4
- package/ts3.4/cjs/core/acroform/PDFAcroComboBox.d.ts +4 -4
- package/ts3.4/cjs/core/acroform/PDFAcroField.d.ts +8 -8
- package/ts3.4/cjs/core/acroform/PDFAcroForm.d.ts +13 -7
- package/ts3.4/cjs/core/acroform/PDFAcroListBox.d.ts +4 -4
- package/ts3.4/cjs/core/acroform/PDFAcroNonTerminal.d.ts +4 -4
- package/ts3.4/cjs/core/acroform/PDFAcroPushButton.d.ts +4 -4
- package/ts3.4/cjs/core/acroform/PDFAcroRadioButton.d.ts +5 -5
- package/ts3.4/cjs/core/acroform/PDFAcroSignature.d.ts +3 -3
- package/ts3.4/cjs/core/acroform/PDFAcroTerminal.d.ts +5 -5
- package/ts3.4/cjs/core/acroform/PDFAcroText.d.ts +7 -7
- package/ts3.4/cjs/core/acroform/index.d.ts +15 -15
- package/ts3.4/cjs/core/acroform/utils.d.ts +8 -5
- package/ts3.4/cjs/core/annotation/AppearanceCharacteristics.d.ts +5 -5
- package/ts3.4/cjs/core/annotation/BorderStyle.d.ts +2 -2
- package/ts3.4/cjs/core/annotation/PDFAnnotation.d.ts +6 -6
- package/ts3.4/cjs/core/annotation/PDFWidgetAnnotation.d.ts +9 -9
- package/ts3.4/cjs/core/annotation/index.d.ts +4 -4
- package/ts3.4/cjs/core/crypto.d.ts +96 -0
- package/ts3.4/cjs/core/document/PDFCrossRefSection.d.ts +1 -1
- package/ts3.4/cjs/core/document/PDFHeader.d.ts +1 -0
- package/ts3.4/cjs/core/document/PDFTrailerDict.d.ts +1 -1
- package/ts3.4/cjs/core/embedders/CMap.d.ts +2 -2
- package/ts3.4/cjs/core/embedders/CustomFontEmbedder.d.ts +5 -5
- package/ts3.4/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts +3 -3
- package/ts3.4/cjs/core/embedders/FileEmbedder.d.ts +3 -2
- package/ts3.4/cjs/core/embedders/FontFlags.d.ts +1 -1
- package/ts3.4/cjs/core/embedders/JavaScriptEmbedder.d.ts +2 -2
- package/ts3.4/cjs/core/embedders/JpegEmbedder.d.ts +2 -2
- package/ts3.4/cjs/core/embedders/PDFPageEmbedder.d.ts +4 -4
- package/ts3.4/cjs/core/embedders/PngEmbedder.d.ts +2 -2
- package/ts3.4/cjs/core/embedders/StandardFontEmbedder.d.ts +4 -4
- package/ts3.4/cjs/core/errors.d.ts +1 -1
- package/ts3.4/cjs/core/index.d.ts +48 -47
- package/ts3.4/cjs/core/interactive/ViewerPreferences.d.ts +8 -8
- package/ts3.4/cjs/core/objects/PDFArray.d.ts +12 -12
- package/ts3.4/cjs/core/objects/PDFBool.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFDict.d.ts +17 -13
- package/ts3.4/cjs/core/objects/PDFHexString.d.ts +2 -1
- package/ts3.4/cjs/core/objects/PDFInvalidObject.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFName.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFNull.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFNumber.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFObject.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFRawStream.d.ts +8 -5
- package/ts3.4/cjs/core/objects/PDFRef.d.ts +1 -1
- package/ts3.4/cjs/core/objects/PDFStream.d.ts +4 -3
- package/ts3.4/cjs/core/objects/PDFString.d.ts +1 -1
- package/ts3.4/cjs/core/operators/PDFOperator.d.ts +9 -9
- package/ts3.4/cjs/core/parser/BaseParser.d.ts +1 -1
- package/ts3.4/cjs/core/parser/ByteStream.d.ts +1 -1
- package/ts3.4/cjs/core/parser/PDFObjectParser.d.ts +23 -21
- package/ts3.4/cjs/core/parser/PDFObjectStreamParser.d.ts +3 -3
- package/ts3.4/cjs/core/parser/PDFParser.d.ts +6 -4
- package/ts3.4/cjs/core/parser/PDFXRefStreamParser.d.ts +2 -2
- package/ts3.4/cjs/core/security/PDFSecurity.d.ts +75 -0
- package/ts3.4/cjs/core/streams/Ascii85Stream.d.ts +2 -2
- package/ts3.4/cjs/core/streams/AsciiHexStream.d.ts +2 -2
- package/ts3.4/cjs/core/streams/DecodeStream.d.ts +1 -1
- package/ts3.4/cjs/core/streams/DecryptStream.d.ts +13 -0
- package/ts3.4/cjs/core/streams/FlateStream.d.ts +2 -2
- package/ts3.4/cjs/core/streams/LZWStream.d.ts +3 -3
- package/ts3.4/cjs/core/streams/RunLengthStream.d.ts +2 -2
- package/ts3.4/cjs/core/streams/decode.d.ts +3 -3
- package/ts3.4/cjs/core/structures/PDFCatalog.d.ts +5 -5
- package/ts3.4/cjs/core/structures/PDFContentStream.d.ts +4 -4
- package/ts3.4/cjs/core/structures/PDFCrossRefStream.d.ts +10 -6
- package/ts3.4/cjs/core/structures/PDFFlateStream.d.ts +5 -4
- package/ts3.4/cjs/core/structures/PDFObjectStream.d.ts +8 -5
- package/ts3.4/cjs/core/structures/PDFPageLeaf.d.ts +9 -9
- package/ts3.4/cjs/core/structures/PDFPageTree.d.ts +8 -8
- package/ts3.4/cjs/core/syntax/Keywords.d.ts +1 -1
- package/ts3.4/cjs/core/writers/PDFStreamWriter.d.ts +11 -8
- package/ts3.4/cjs/core/writers/PDFWriter.d.ts +19 -11
- package/ts3.4/cjs/index.d.ts +4 -4
- package/ts3.4/cjs/types/index.d.ts +25 -1
- package/ts3.4/cjs/types/matrix.d.ts +8 -1
- package/ts3.4/cjs/utils/arrays.d.ts +3 -1
- package/ts3.4/cjs/utils/elements/Arc.d.ts +23 -0
- package/ts3.4/cjs/utils/elements/Circle.d.ts +15 -0
- package/ts3.4/cjs/utils/elements/Ellipse.d.ts +21 -0
- package/ts3.4/cjs/utils/elements/GraphElement.d.ts +7 -0
- package/ts3.4/cjs/utils/elements/Line.d.ts +24 -0
- package/ts3.4/cjs/utils/elements/Plot.d.ts +12 -0
- package/ts3.4/cjs/utils/elements/Point.d.ts +19 -0
- package/ts3.4/cjs/utils/elements/Rectangle.d.ts +22 -0
- package/ts3.4/cjs/utils/elements/Segment.d.ts +20 -0
- package/ts3.4/cjs/utils/elements/index.d.ts +10 -0
- package/ts3.4/cjs/utils/index.d.ts +11 -11
- package/ts3.4/cjs/utils/intersections.d.ts +10 -0
- package/ts3.4/cjs/utils/maths.d.ts +46 -0
- package/ts3.4/cjs/utils/strings.d.ts +5 -1
- package/ts3.4/cjs/utils/validators.d.ts +5 -2
- package/ts3.4/es/api/PDFDocument.d.ts +52 -13
- package/ts3.4/es/api/PDFDocumentOptions.d.ts +4 -2
- package/ts3.4/es/api/PDFEmbeddedFile.d.ts +9 -4
- package/ts3.4/es/api/PDFEmbeddedPage.d.ts +3 -3
- package/ts3.4/es/api/PDFFont.d.ts +4 -4
- package/ts3.4/es/api/PDFImage.d.ts +4 -4
- package/ts3.4/es/api/PDFJavaScript.d.ts +4 -4
- package/ts3.4/es/api/PDFPage.d.ts +36 -9
- package/ts3.4/es/api/PDFPageOptions.d.ts +35 -12
- package/ts3.4/es/api/PDFSvg.d.ts +7 -0
- package/ts3.4/es/api/colors.d.ts +6 -2
- package/ts3.4/es/api/form/PDFButton.d.ts +8 -8
- package/ts3.4/es/api/form/PDFCheckBox.d.ts +5 -5
- package/ts3.4/es/api/form/PDFDropdown.d.ts +6 -6
- package/ts3.4/es/api/form/PDFField.d.ts +7 -7
- package/ts3.4/es/api/form/PDFForm.d.ts +11 -11
- package/ts3.4/es/api/form/PDFOptionList.d.ts +6 -6
- package/ts3.4/es/api/form/PDFRadioGroup.d.ts +5 -5
- package/ts3.4/es/api/form/PDFSignature.d.ts +3 -3
- package/ts3.4/es/api/form/PDFTextField.d.ts +8 -8
- package/ts3.4/es/api/form/appearances.d.ts +21 -21
- package/ts3.4/es/api/form/index.d.ts +10 -10
- package/ts3.4/es/api/image/index.d.ts +1 -1
- package/ts3.4/es/api/index.d.ts +22 -21
- package/ts3.4/es/api/objects.d.ts +1 -1
- package/ts3.4/es/api/operations.d.ts +27 -13
- package/ts3.4/es/api/operators.d.ts +6 -1
- package/ts3.4/es/api/rotations.d.ts +2 -2
- package/ts3.4/es/api/sizes.d.ts +200 -50
- package/ts3.4/es/api/snapshot/DefaultDocumentSnapshot.d.ts +1 -1
- package/ts3.4/es/api/snapshot/DocumentSnapshot.d.ts +1 -1
- package/ts3.4/es/api/snapshot/IncrementalDocumentSnapshot.d.ts +1 -1
- package/ts3.4/es/api/svg.d.ts +76 -0
- package/ts3.4/es/api/svgPath.d.ts +1 -1
- package/ts3.4/es/api/text/index.d.ts +2 -2
- package/ts3.4/es/api/text/layout.d.ts +3 -3
- package/ts3.4/es/core/PDFContext.d.ts +43 -20
- package/ts3.4/es/core/PDFObjectCopier.d.ts +2 -2
- package/ts3.4/es/core/acroform/PDFAcroButton.d.ts +7 -7
- package/ts3.4/es/core/acroform/PDFAcroCheckBox.d.ts +5 -5
- package/ts3.4/es/core/acroform/PDFAcroChoice.d.ts +4 -4
- package/ts3.4/es/core/acroform/PDFAcroComboBox.d.ts +4 -4
- package/ts3.4/es/core/acroform/PDFAcroField.d.ts +8 -8
- package/ts3.4/es/core/acroform/PDFAcroForm.d.ts +13 -7
- package/ts3.4/es/core/acroform/PDFAcroListBox.d.ts +4 -4
- package/ts3.4/es/core/acroform/PDFAcroNonTerminal.d.ts +4 -4
- package/ts3.4/es/core/acroform/PDFAcroPushButton.d.ts +4 -4
- package/ts3.4/es/core/acroform/PDFAcroRadioButton.d.ts +5 -5
- package/ts3.4/es/core/acroform/PDFAcroSignature.d.ts +3 -3
- package/ts3.4/es/core/acroform/PDFAcroTerminal.d.ts +5 -5
- package/ts3.4/es/core/acroform/PDFAcroText.d.ts +7 -7
- package/ts3.4/es/core/acroform/index.d.ts +15 -15
- package/ts3.4/es/core/acroform/utils.d.ts +8 -5
- package/ts3.4/es/core/annotation/AppearanceCharacteristics.d.ts +5 -5
- package/ts3.4/es/core/annotation/BorderStyle.d.ts +2 -2
- package/ts3.4/es/core/annotation/PDFAnnotation.d.ts +6 -6
- package/ts3.4/es/core/annotation/PDFWidgetAnnotation.d.ts +9 -9
- package/ts3.4/es/core/annotation/index.d.ts +4 -4
- package/ts3.4/es/core/crypto.d.ts +96 -0
- package/ts3.4/es/core/document/PDFCrossRefSection.d.ts +1 -1
- package/ts3.4/es/core/document/PDFHeader.d.ts +1 -0
- package/ts3.4/es/core/document/PDFTrailerDict.d.ts +1 -1
- package/ts3.4/es/core/embedders/CMap.d.ts +2 -2
- package/ts3.4/es/core/embedders/CustomFontEmbedder.d.ts +5 -5
- package/ts3.4/es/core/embedders/CustomFontSubsetEmbedder.d.ts +3 -3
- package/ts3.4/es/core/embedders/FileEmbedder.d.ts +3 -2
- package/ts3.4/es/core/embedders/FontFlags.d.ts +1 -1
- package/ts3.4/es/core/embedders/JavaScriptEmbedder.d.ts +2 -2
- package/ts3.4/es/core/embedders/JpegEmbedder.d.ts +2 -2
- package/ts3.4/es/core/embedders/PDFPageEmbedder.d.ts +4 -4
- package/ts3.4/es/core/embedders/PngEmbedder.d.ts +2 -2
- package/ts3.4/es/core/embedders/StandardFontEmbedder.d.ts +4 -4
- package/ts3.4/es/core/errors.d.ts +1 -1
- package/ts3.4/es/core/index.d.ts +48 -47
- package/ts3.4/es/core/interactive/ViewerPreferences.d.ts +8 -8
- package/ts3.4/es/core/objects/PDFArray.d.ts +12 -12
- package/ts3.4/es/core/objects/PDFBool.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFDict.d.ts +17 -13
- package/ts3.4/es/core/objects/PDFHexString.d.ts +2 -1
- package/ts3.4/es/core/objects/PDFInvalidObject.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFName.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFNull.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFNumber.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFObject.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFRawStream.d.ts +8 -5
- package/ts3.4/es/core/objects/PDFRef.d.ts +1 -1
- package/ts3.4/es/core/objects/PDFStream.d.ts +4 -3
- package/ts3.4/es/core/objects/PDFString.d.ts +1 -1
- package/ts3.4/es/core/operators/PDFOperator.d.ts +9 -9
- package/ts3.4/es/core/parser/BaseParser.d.ts +1 -1
- package/ts3.4/es/core/parser/ByteStream.d.ts +1 -1
- package/ts3.4/es/core/parser/PDFObjectParser.d.ts +23 -21
- package/ts3.4/es/core/parser/PDFObjectStreamParser.d.ts +3 -3
- package/ts3.4/es/core/parser/PDFParser.d.ts +6 -4
- package/ts3.4/es/core/parser/PDFXRefStreamParser.d.ts +2 -2
- package/ts3.4/es/core/security/PDFSecurity.d.ts +75 -0
- package/ts3.4/es/core/streams/Ascii85Stream.d.ts +2 -2
- package/ts3.4/es/core/streams/AsciiHexStream.d.ts +2 -2
- package/ts3.4/es/core/streams/DecodeStream.d.ts +1 -1
- package/ts3.4/es/core/streams/DecryptStream.d.ts +13 -0
- package/ts3.4/es/core/streams/FlateStream.d.ts +2 -2
- package/ts3.4/es/core/streams/LZWStream.d.ts +3 -3
- package/ts3.4/es/core/streams/RunLengthStream.d.ts +2 -2
- package/ts3.4/es/core/streams/decode.d.ts +3 -3
- package/ts3.4/es/core/structures/PDFCatalog.d.ts +5 -5
- package/ts3.4/es/core/structures/PDFContentStream.d.ts +4 -4
- package/ts3.4/es/core/structures/PDFCrossRefStream.d.ts +10 -6
- package/ts3.4/es/core/structures/PDFFlateStream.d.ts +5 -4
- package/ts3.4/es/core/structures/PDFObjectStream.d.ts +8 -5
- package/ts3.4/es/core/structures/PDFPageLeaf.d.ts +9 -9
- package/ts3.4/es/core/structures/PDFPageTree.d.ts +8 -8
- package/ts3.4/es/core/syntax/Keywords.d.ts +1 -1
- package/ts3.4/es/core/writers/PDFStreamWriter.d.ts +11 -8
- package/ts3.4/es/core/writers/PDFWriter.d.ts +19 -11
- package/ts3.4/es/index.d.ts +4 -4
- package/ts3.4/es/types/index.d.ts +25 -1
- package/ts3.4/es/types/matrix.d.ts +8 -1
- package/ts3.4/es/utils/arrays.d.ts +3 -1
- package/ts3.4/es/utils/elements/Arc.d.ts +23 -0
- package/ts3.4/es/utils/elements/Circle.d.ts +15 -0
- package/ts3.4/es/utils/elements/Ellipse.d.ts +21 -0
- package/ts3.4/es/utils/elements/GraphElement.d.ts +7 -0
- package/ts3.4/es/utils/elements/Line.d.ts +24 -0
- package/ts3.4/es/utils/elements/Plot.d.ts +12 -0
- package/ts3.4/es/utils/elements/Point.d.ts +19 -0
- package/ts3.4/es/utils/elements/Rectangle.d.ts +22 -0
- package/ts3.4/es/utils/elements/Segment.d.ts +20 -0
- package/ts3.4/es/utils/elements/index.d.ts +10 -0
- package/ts3.4/es/utils/index.d.ts +11 -11
- package/ts3.4/es/utils/intersections.d.ts +10 -0
- package/ts3.4/es/utils/maths.d.ts +46 -0
- package/ts3.4/es/utils/strings.d.ts +5 -1
- package/ts3.4/es/utils/validators.d.ts +5 -2
- package/yarn.lock +0 -4446
package/cjs/api/PDFPage.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const colors_1 = require("./colors");
|
|
5
|
+
const operations_1 = require("./operations");
|
|
6
|
+
const operators_1 = require("./operators");
|
|
7
|
+
const PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument"));
|
|
8
|
+
const PDFEmbeddedPage_1 = tslib_1.__importDefault(require("./PDFEmbeddedPage"));
|
|
9
|
+
const PDFFont_1 = tslib_1.__importDefault(require("./PDFFont"));
|
|
10
|
+
const PDFImage_1 = tslib_1.__importDefault(require("./PDFImage"));
|
|
11
|
+
const PDFSvg_1 = tslib_1.__importDefault(require("./PDFSvg"));
|
|
12
|
+
const PDFPageOptions_1 = require("./PDFPageOptions");
|
|
13
|
+
const rotations_1 = require("./rotations");
|
|
14
|
+
const StandardFonts_1 = require("./StandardFonts");
|
|
15
|
+
const core_1 = require("../core");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
const svg_1 = require("./svg");
|
|
16
18
|
/**
|
|
17
19
|
* Represents a single page of a [[PDFDocument]].
|
|
18
20
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
class PDFPage {
|
|
22
|
+
constructor(leafNode, ref, doc) {
|
|
21
23
|
this.fontSize = 24;
|
|
22
|
-
this.fontColor = colors_1.rgb(0, 0, 0);
|
|
24
|
+
this.fontColor = (0, colors_1.rgb)(0, 0, 0);
|
|
23
25
|
this.lineHeight = 24;
|
|
24
26
|
this.x = 0;
|
|
25
27
|
this.y = 0;
|
|
26
|
-
utils_1.assertIs(leafNode, 'leafNode', [[core_1.PDFPageLeaf, 'PDFPageLeaf']]);
|
|
27
|
-
utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]);
|
|
28
|
-
utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]);
|
|
28
|
+
(0, utils_1.assertIs)(leafNode, 'leafNode', [[core_1.PDFPageLeaf, 'PDFPageLeaf']]);
|
|
29
|
+
(0, utils_1.assertIs)(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]);
|
|
30
|
+
(0, utils_1.assertIs)(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]);
|
|
29
31
|
this.node = leafNode;
|
|
30
32
|
this.ref = ref;
|
|
31
33
|
this.doc = doc;
|
|
@@ -43,11 +45,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
43
45
|
* ```
|
|
44
46
|
* @param angle The angle to rotate this page.
|
|
45
47
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
utils_1.assertMultiple(degreesAngle, 'degreesAngle', 90);
|
|
48
|
+
setRotation(angle) {
|
|
49
|
+
const degreesAngle = (0, rotations_1.toDegrees)(angle);
|
|
50
|
+
(0, utils_1.assertMultiple)(degreesAngle, 'degreesAngle', 90);
|
|
49
51
|
this.node.set(core_1.PDFName.of('Rotate'), this.doc.context.obj(degreesAngle));
|
|
50
|
-
}
|
|
52
|
+
}
|
|
51
53
|
/**
|
|
52
54
|
* Get this page's rotation angle in degrees. For example:
|
|
53
55
|
* ```js
|
|
@@ -56,10 +58,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
56
58
|
* @returns The rotation angle of the page in degrees (always a multiple of
|
|
57
59
|
* 90 degrees).
|
|
58
60
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return rotations_1.degrees(Rotate ? Rotate.asNumber() : 0);
|
|
62
|
-
}
|
|
61
|
+
getRotation() {
|
|
62
|
+
const Rotate = this.node.Rotate();
|
|
63
|
+
return (0, rotations_1.degrees)(Rotate ? Rotate.asNumber() : 0);
|
|
64
|
+
}
|
|
63
65
|
/**
|
|
64
66
|
* Resize this page by increasing or decreasing its width and height. For
|
|
65
67
|
* example:
|
|
@@ -96,32 +98,32 @@ var PDFPage = /** @class */ (function () {
|
|
|
96
98
|
* @param width The new width of the page.
|
|
97
99
|
* @param height The new height of the page.
|
|
98
100
|
*/
|
|
99
|
-
|
|
100
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
101
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
102
|
-
|
|
101
|
+
setSize(width, height) {
|
|
102
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
103
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
104
|
+
const mediaBox = this.getMediaBox();
|
|
103
105
|
this.setMediaBox(mediaBox.x, mediaBox.y, width, height);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (hasCropBox && utils_1.rectanglesAreEqual(cropBox, mediaBox)) {
|
|
106
|
+
const cropBox = this.getCropBox();
|
|
107
|
+
const bleedBox = this.getBleedBox();
|
|
108
|
+
const trimBox = this.getTrimBox();
|
|
109
|
+
const artBox = this.getArtBox();
|
|
110
|
+
const hasCropBox = this.node.CropBox();
|
|
111
|
+
const hasBleedBox = this.node.BleedBox();
|
|
112
|
+
const hasTrimBox = this.node.TrimBox();
|
|
113
|
+
const hasArtBox = this.node.ArtBox();
|
|
114
|
+
if (hasCropBox && (0, utils_1.rectanglesAreEqual)(cropBox, mediaBox)) {
|
|
113
115
|
this.setCropBox(mediaBox.x, mediaBox.y, width, height);
|
|
114
116
|
}
|
|
115
|
-
if (hasBleedBox && utils_1.rectanglesAreEqual(bleedBox, mediaBox)) {
|
|
117
|
+
if (hasBleedBox && (0, utils_1.rectanglesAreEqual)(bleedBox, mediaBox)) {
|
|
116
118
|
this.setBleedBox(mediaBox.x, mediaBox.y, width, height);
|
|
117
119
|
}
|
|
118
|
-
if (hasTrimBox && utils_1.rectanglesAreEqual(trimBox, mediaBox)) {
|
|
120
|
+
if (hasTrimBox && (0, utils_1.rectanglesAreEqual)(trimBox, mediaBox)) {
|
|
119
121
|
this.setTrimBox(mediaBox.x, mediaBox.y, width, height);
|
|
120
122
|
}
|
|
121
|
-
if (hasArtBox && utils_1.rectanglesAreEqual(artBox, mediaBox)) {
|
|
123
|
+
if (hasArtBox && (0, utils_1.rectanglesAreEqual)(artBox, mediaBox)) {
|
|
122
124
|
this.setArtBox(mediaBox.x, mediaBox.y, width, height);
|
|
123
125
|
}
|
|
124
|
-
}
|
|
126
|
+
}
|
|
125
127
|
/**
|
|
126
128
|
* Resize this page by increasing or decreasing its width. For example:
|
|
127
129
|
* ```js
|
|
@@ -134,10 +136,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
134
136
|
*
|
|
135
137
|
* @param width The new width of the page.
|
|
136
138
|
*/
|
|
137
|
-
|
|
138
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
139
|
+
setWidth(width) {
|
|
140
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
139
141
|
this.setSize(width, this.getSize().height);
|
|
140
|
-
}
|
|
142
|
+
}
|
|
141
143
|
/**
|
|
142
144
|
* Resize this page by increasing or decreasing its height. For example:
|
|
143
145
|
* ```js
|
|
@@ -150,10 +152,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
150
152
|
*
|
|
151
153
|
* @param height The new height of the page.
|
|
152
154
|
*/
|
|
153
|
-
|
|
154
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
155
|
+
setHeight(height) {
|
|
156
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
155
157
|
this.setSize(this.getSize().width, height);
|
|
156
|
-
}
|
|
158
|
+
}
|
|
157
159
|
/**
|
|
158
160
|
* Set the MediaBox of this page. For example:
|
|
159
161
|
* ```js
|
|
@@ -171,14 +173,14 @@ var PDFPage = /** @class */ (function () {
|
|
|
171
173
|
* @param width The width of the new MediaBox.
|
|
172
174
|
* @param height The height of the new MediaBox.
|
|
173
175
|
*/
|
|
174
|
-
|
|
175
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
176
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
177
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
178
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
179
|
-
|
|
176
|
+
setMediaBox(x, y, width, height) {
|
|
177
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
178
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
179
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
180
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
181
|
+
const mediaBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
180
182
|
this.node.set(core_1.PDFName.MediaBox, mediaBox);
|
|
181
|
-
}
|
|
183
|
+
}
|
|
182
184
|
/**
|
|
183
185
|
* Set the CropBox of this page. For example:
|
|
184
186
|
* ```js
|
|
@@ -196,14 +198,14 @@ var PDFPage = /** @class */ (function () {
|
|
|
196
198
|
* @param width The width of the new CropBox.
|
|
197
199
|
* @param height The height of the new CropBox.
|
|
198
200
|
*/
|
|
199
|
-
|
|
200
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
201
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
202
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
203
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
204
|
-
|
|
201
|
+
setCropBox(x, y, width, height) {
|
|
202
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
203
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
204
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
205
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
206
|
+
const cropBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
205
207
|
this.node.set(core_1.PDFName.CropBox, cropBox);
|
|
206
|
-
}
|
|
208
|
+
}
|
|
207
209
|
/**
|
|
208
210
|
* Set the BleedBox of this page. For example:
|
|
209
211
|
* ```js
|
|
@@ -221,14 +223,14 @@ var PDFPage = /** @class */ (function () {
|
|
|
221
223
|
* @param width The width of the new BleedBox.
|
|
222
224
|
* @param height The height of the new BleedBox.
|
|
223
225
|
*/
|
|
224
|
-
|
|
225
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
226
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
227
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
228
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
229
|
-
|
|
226
|
+
setBleedBox(x, y, width, height) {
|
|
227
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
228
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
229
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
230
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
231
|
+
const bleedBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
230
232
|
this.node.set(core_1.PDFName.BleedBox, bleedBox);
|
|
231
|
-
}
|
|
233
|
+
}
|
|
232
234
|
/**
|
|
233
235
|
* Set the TrimBox of this page. For example:
|
|
234
236
|
* ```js
|
|
@@ -246,14 +248,14 @@ var PDFPage = /** @class */ (function () {
|
|
|
246
248
|
* @param width The width of the new TrimBox.
|
|
247
249
|
* @param height The height of the new TrimBox.
|
|
248
250
|
*/
|
|
249
|
-
|
|
250
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
251
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
252
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
253
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
254
|
-
|
|
251
|
+
setTrimBox(x, y, width, height) {
|
|
252
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
253
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
254
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
255
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
256
|
+
const trimBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
255
257
|
this.node.set(core_1.PDFName.TrimBox, trimBox);
|
|
256
|
-
}
|
|
258
|
+
}
|
|
257
259
|
/**
|
|
258
260
|
* Set the ArtBox of this page. For example:
|
|
259
261
|
* ```js
|
|
@@ -271,14 +273,14 @@ var PDFPage = /** @class */ (function () {
|
|
|
271
273
|
* @param width The width of the new ArtBox.
|
|
272
274
|
* @param height The height of the new ArtBox.
|
|
273
275
|
*/
|
|
274
|
-
|
|
275
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
276
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
277
|
-
utils_1.assertIs(width, 'width', ['number']);
|
|
278
|
-
utils_1.assertIs(height, 'height', ['number']);
|
|
279
|
-
|
|
276
|
+
setArtBox(x, y, width, height) {
|
|
277
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
278
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
279
|
+
(0, utils_1.assertIs)(width, 'width', ['number']);
|
|
280
|
+
(0, utils_1.assertIs)(height, 'height', ['number']);
|
|
281
|
+
const artBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
280
282
|
this.node.set(core_1.PDFName.ArtBox, artBox);
|
|
281
|
-
}
|
|
283
|
+
}
|
|
282
284
|
/**
|
|
283
285
|
* Get this page's width and height. For example:
|
|
284
286
|
* ```js
|
|
@@ -290,10 +292,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
290
292
|
*
|
|
291
293
|
* @returns The width and height of the page.
|
|
292
294
|
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return { width
|
|
296
|
-
}
|
|
295
|
+
getSize() {
|
|
296
|
+
const { width, height } = this.getMediaBox();
|
|
297
|
+
return { width, height };
|
|
298
|
+
}
|
|
297
299
|
/**
|
|
298
300
|
* Get this page's width. For example:
|
|
299
301
|
* ```js
|
|
@@ -304,9 +306,9 @@ var PDFPage = /** @class */ (function () {
|
|
|
304
306
|
*
|
|
305
307
|
* @returns The width of the page.
|
|
306
308
|
*/
|
|
307
|
-
|
|
309
|
+
getWidth() {
|
|
308
310
|
return this.getSize().width;
|
|
309
|
-
}
|
|
311
|
+
}
|
|
310
312
|
/**
|
|
311
313
|
* Get this page's height. For example:
|
|
312
314
|
* ```js
|
|
@@ -317,9 +319,9 @@ var PDFPage = /** @class */ (function () {
|
|
|
317
319
|
*
|
|
318
320
|
* @returns The height of the page.
|
|
319
321
|
*/
|
|
320
|
-
|
|
322
|
+
getHeight() {
|
|
321
323
|
return this.getSize().height;
|
|
322
|
-
}
|
|
324
|
+
}
|
|
323
325
|
/**
|
|
324
326
|
* Get the rectangle defining this page's MediaBox. For example:
|
|
325
327
|
* ```js
|
|
@@ -337,10 +339,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
337
339
|
* @returns An object defining the lower left corner of the MediaBox and its
|
|
338
340
|
* width & height.
|
|
339
341
|
*/
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
getMediaBox() {
|
|
343
|
+
const mediaBox = this.node.MediaBox();
|
|
342
344
|
return mediaBox.asRectangle();
|
|
343
|
-
}
|
|
345
|
+
}
|
|
344
346
|
/**
|
|
345
347
|
* Get the rectangle defining this page's CropBox. For example:
|
|
346
348
|
* ```js
|
|
@@ -357,11 +359,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
357
359
|
* @returns An object defining the lower left corner of the CropBox and its
|
|
358
360
|
* width & height.
|
|
359
361
|
*/
|
|
360
|
-
|
|
362
|
+
getCropBox() {
|
|
361
363
|
var _a;
|
|
362
|
-
|
|
364
|
+
const cropBox = this.node.CropBox();
|
|
363
365
|
return (_a = cropBox === null || cropBox === void 0 ? void 0 : cropBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getMediaBox();
|
|
364
|
-
}
|
|
366
|
+
}
|
|
365
367
|
/**
|
|
366
368
|
* Get the rectangle defining this page's BleedBox. For example:
|
|
367
369
|
* ```js
|
|
@@ -379,11 +381,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
379
381
|
* @returns An object defining the lower left corner of the BleedBox and its
|
|
380
382
|
* width & height.
|
|
381
383
|
*/
|
|
382
|
-
|
|
384
|
+
getBleedBox() {
|
|
383
385
|
var _a;
|
|
384
|
-
|
|
386
|
+
const bleedBox = this.node.BleedBox();
|
|
385
387
|
return (_a = bleedBox === null || bleedBox === void 0 ? void 0 : bleedBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
|
|
386
|
-
}
|
|
388
|
+
}
|
|
387
389
|
/**
|
|
388
390
|
* Get the rectangle defining this page's TrimBox. For example:
|
|
389
391
|
* ```js
|
|
@@ -400,11 +402,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
400
402
|
* @returns An object defining the lower left corner of the TrimBox and its
|
|
401
403
|
* width & height.
|
|
402
404
|
*/
|
|
403
|
-
|
|
405
|
+
getTrimBox() {
|
|
404
406
|
var _a;
|
|
405
|
-
|
|
407
|
+
const trimBox = this.node.TrimBox();
|
|
406
408
|
return (_a = trimBox === null || trimBox === void 0 ? void 0 : trimBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
|
|
407
|
-
}
|
|
409
|
+
}
|
|
408
410
|
/**
|
|
409
411
|
* Get the rectangle defining this page's ArtBox. For example:
|
|
410
412
|
* ```js
|
|
@@ -419,11 +421,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
419
421
|
* @returns An object defining the lower left corner of the ArtBox and its
|
|
420
422
|
* width & height.
|
|
421
423
|
*/
|
|
422
|
-
|
|
424
|
+
getArtBox() {
|
|
423
425
|
var _a;
|
|
424
|
-
|
|
426
|
+
const artBox = this.node.ArtBox();
|
|
425
427
|
return (_a = artBox === null || artBox === void 0 ? void 0 : artBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
|
|
426
|
-
}
|
|
428
|
+
}
|
|
427
429
|
/**
|
|
428
430
|
* Translate this page's content to a new location on the page. This operation
|
|
429
431
|
* is often useful after resizing the page with [[setSize]]. For example:
|
|
@@ -441,17 +443,17 @@ var PDFPage = /** @class */ (function () {
|
|
|
441
443
|
* @param x The new position on the x-axis for this page's content.
|
|
442
444
|
* @param y The new position on the y-axis for this page's content.
|
|
443
445
|
*/
|
|
444
|
-
|
|
445
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
446
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
446
|
+
translateContent(x, y) {
|
|
447
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
448
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
447
449
|
this.node.normalize();
|
|
448
450
|
this.getContentStream();
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
const start = this.createContentStream((0, operators_1.pushGraphicsState)(), (0, operators_1.translate)(x, y));
|
|
452
|
+
const startRef = this.doc.context.register(start);
|
|
453
|
+
const end = this.createContentStream((0, operators_1.popGraphicsState)());
|
|
454
|
+
const endRef = this.doc.context.register(end);
|
|
453
455
|
this.node.wrapContentStreams(startRef, endRef);
|
|
454
|
-
}
|
|
456
|
+
}
|
|
455
457
|
/**
|
|
456
458
|
* Scale the size, content, and annotations of a page.
|
|
457
459
|
*
|
|
@@ -465,13 +467,13 @@ var PDFPage = /** @class */ (function () {
|
|
|
465
467
|
* @param y The factor by which the height for the page should be scaled
|
|
466
468
|
* (e.g. `2.0` is 200%).
|
|
467
469
|
*/
|
|
468
|
-
|
|
469
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
470
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
470
|
+
scale(x, y) {
|
|
471
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
472
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
471
473
|
this.setSize(this.getWidth() * x, this.getHeight() * y);
|
|
472
474
|
this.scaleContent(x, y);
|
|
473
475
|
this.scaleAnnotations(x, y);
|
|
474
|
-
}
|
|
476
|
+
}
|
|
475
477
|
/**
|
|
476
478
|
* Scale the content of a page. This is useful after resizing an existing
|
|
477
479
|
* page. This scales only the content, not the annotations.
|
|
@@ -490,17 +492,17 @@ var PDFPage = /** @class */ (function () {
|
|
|
490
492
|
* @param y The factor by which the y-axis for the content should be scaled
|
|
491
493
|
* (e.g. `2.0` is 200%).
|
|
492
494
|
*/
|
|
493
|
-
|
|
494
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
495
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
495
|
+
scaleContent(x, y) {
|
|
496
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
497
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
496
498
|
this.node.normalize();
|
|
497
499
|
this.getContentStream();
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
500
|
+
const start = this.createContentStream((0, operators_1.pushGraphicsState)(), (0, operators_1.scale)(x, y));
|
|
501
|
+
const startRef = this.doc.context.register(start);
|
|
502
|
+
const end = this.createContentStream((0, operators_1.popGraphicsState)());
|
|
503
|
+
const endRef = this.doc.context.register(end);
|
|
502
504
|
this.node.wrapContentStreams(startRef, endRef);
|
|
503
|
-
}
|
|
505
|
+
}
|
|
504
506
|
/**
|
|
505
507
|
* Scale the annotations of a page. This is useful if you want to scale a
|
|
506
508
|
* page with comments or other annotations.
|
|
@@ -517,18 +519,18 @@ var PDFPage = /** @class */ (function () {
|
|
|
517
519
|
* @param y The factor by which the y-axis for the annotations should be
|
|
518
520
|
* scaled (e.g. `2.0` is 200%).
|
|
519
521
|
*/
|
|
520
|
-
|
|
521
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
522
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
523
|
-
|
|
522
|
+
scaleAnnotations(x, y) {
|
|
523
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
524
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
525
|
+
const annots = this.node.Annots();
|
|
524
526
|
if (!annots)
|
|
525
527
|
return;
|
|
526
|
-
for (
|
|
527
|
-
|
|
528
|
+
for (let idx = 0; idx < annots.size(); idx++) {
|
|
529
|
+
const annot = annots.lookup(idx);
|
|
528
530
|
if (annot instanceof core_1.PDFDict)
|
|
529
531
|
this.scaleAnnot(annot, x, y);
|
|
530
532
|
}
|
|
531
|
-
}
|
|
533
|
+
}
|
|
532
534
|
/**
|
|
533
535
|
* Reset the x and y coordinates of this page to `(0, 0)`. This operation is
|
|
534
536
|
* often useful after calling [[translateContent]]. For example:
|
|
@@ -546,11 +548,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
546
548
|
* page.drawText('I am not shifted')
|
|
547
549
|
* ```
|
|
548
550
|
*/
|
|
549
|
-
|
|
551
|
+
resetPosition() {
|
|
550
552
|
this.getContentStream(false);
|
|
551
553
|
this.x = 0;
|
|
552
554
|
this.y = 0;
|
|
553
|
-
}
|
|
555
|
+
}
|
|
554
556
|
/**
|
|
555
557
|
* Choose a default font for this page. The default font will be used whenever
|
|
556
558
|
* text is drawn on this page and no font is specified. For example:
|
|
@@ -571,12 +573,12 @@ var PDFPage = /** @class */ (function () {
|
|
|
571
573
|
* ```
|
|
572
574
|
* @param font The default font to be used when drawing text on this page.
|
|
573
575
|
*/
|
|
574
|
-
|
|
576
|
+
setFont(font) {
|
|
575
577
|
// TODO: Reuse image Font name if we've already added this image to Resources.Fonts
|
|
576
|
-
utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]);
|
|
578
|
+
(0, utils_1.assertIs)(font, 'font', [[PDFFont_1.default, 'PDFFont']]);
|
|
577
579
|
this.font = font;
|
|
578
580
|
this.fontKey = this.node.newFontDictionary(this.font.name, this.font.ref);
|
|
579
|
-
}
|
|
581
|
+
}
|
|
580
582
|
/**
|
|
581
583
|
* Choose a default font size for this page. The default font size will be
|
|
582
584
|
* used whenever text is drawn on this page and no font size is specified.
|
|
@@ -591,10 +593,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
591
593
|
* @param fontSize The default font size to be used when drawing text on this
|
|
592
594
|
* page.
|
|
593
595
|
*/
|
|
594
|
-
|
|
595
|
-
utils_1.assertIs(fontSize, 'fontSize', ['number']);
|
|
596
|
+
setFontSize(fontSize) {
|
|
597
|
+
(0, utils_1.assertIs)(fontSize, 'fontSize', ['number']);
|
|
596
598
|
this.fontSize = fontSize;
|
|
597
|
-
}
|
|
599
|
+
}
|
|
598
600
|
/**
|
|
599
601
|
* Choose a default font color for this page. The default font color will be
|
|
600
602
|
* used whenever text is drawn on this page and no font color is specified.
|
|
@@ -611,10 +613,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
611
613
|
* @param fontColor The default font color to be used when drawing text on
|
|
612
614
|
* this page.
|
|
613
615
|
*/
|
|
614
|
-
|
|
615
|
-
utils_1.assertIs(fontColor, 'fontColor', [[Object, 'Color']]);
|
|
616
|
+
setFontColor(fontColor) {
|
|
617
|
+
(0, utils_1.assertIs)(fontColor, 'fontColor', [[Object, 'Color']]);
|
|
616
618
|
this.fontColor = fontColor;
|
|
617
|
-
}
|
|
619
|
+
}
|
|
618
620
|
/**
|
|
619
621
|
* Choose a default line height for this page. The default line height will be
|
|
620
622
|
* used whenever text is drawn on this page and no line height is specified.
|
|
@@ -631,10 +633,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
631
633
|
* @param lineHeight The default line height to be used when drawing text on
|
|
632
634
|
* this page.
|
|
633
635
|
*/
|
|
634
|
-
|
|
635
|
-
utils_1.assertIs(lineHeight, 'lineHeight', ['number']);
|
|
636
|
+
setLineHeight(lineHeight) {
|
|
637
|
+
(0, utils_1.assertIs)(lineHeight, 'lineHeight', ['number']);
|
|
636
638
|
this.lineHeight = lineHeight;
|
|
637
|
-
}
|
|
639
|
+
}
|
|
638
640
|
/**
|
|
639
641
|
* Get the default position of this page. For example:
|
|
640
642
|
* ```js
|
|
@@ -642,9 +644,9 @@ var PDFPage = /** @class */ (function () {
|
|
|
642
644
|
* ```
|
|
643
645
|
* @returns The default position of the page.
|
|
644
646
|
*/
|
|
645
|
-
|
|
647
|
+
getPosition() {
|
|
646
648
|
return { x: this.x, y: this.y };
|
|
647
|
-
}
|
|
649
|
+
}
|
|
648
650
|
/**
|
|
649
651
|
* Get the default x coordinate of this page. For example:
|
|
650
652
|
* ```js
|
|
@@ -652,9 +654,9 @@ var PDFPage = /** @class */ (function () {
|
|
|
652
654
|
* ```
|
|
653
655
|
* @returns The default x coordinate of the page.
|
|
654
656
|
*/
|
|
655
|
-
|
|
657
|
+
getX() {
|
|
656
658
|
return this.x;
|
|
657
|
-
}
|
|
659
|
+
}
|
|
658
660
|
/**
|
|
659
661
|
* Get the default y coordinate of this page. For example:
|
|
660
662
|
* ```js
|
|
@@ -662,9 +664,9 @@ var PDFPage = /** @class */ (function () {
|
|
|
662
664
|
* ```
|
|
663
665
|
* @returns The default y coordinate of the page.
|
|
664
666
|
*/
|
|
665
|
-
|
|
667
|
+
getY() {
|
|
666
668
|
return this.y;
|
|
667
|
-
}
|
|
669
|
+
}
|
|
668
670
|
/**
|
|
669
671
|
* Change the default position of this page. For example:
|
|
670
672
|
* ```js
|
|
@@ -680,12 +682,12 @@ var PDFPage = /** @class */ (function () {
|
|
|
680
682
|
* @param x The new default position on the x-axis for this page.
|
|
681
683
|
* @param y The new default position on the y-axis for this page.
|
|
682
684
|
*/
|
|
683
|
-
|
|
684
|
-
utils_1.assertIs(x, 'x', ['number']);
|
|
685
|
-
utils_1.assertIs(y, 'y', ['number']);
|
|
685
|
+
moveTo(x, y) {
|
|
686
|
+
(0, utils_1.assertIs)(x, 'x', ['number']);
|
|
687
|
+
(0, utils_1.assertIs)(y, 'y', ['number']);
|
|
686
688
|
this.x = x;
|
|
687
689
|
this.y = y;
|
|
688
|
-
}
|
|
690
|
+
}
|
|
689
691
|
/**
|
|
690
692
|
* Change the default position of this page to be further down the y-axis.
|
|
691
693
|
* For example:
|
|
@@ -699,10 +701,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
699
701
|
* @param yDecrease The amount by which the page's default position along the
|
|
700
702
|
* y-axis should be decreased.
|
|
701
703
|
*/
|
|
702
|
-
|
|
703
|
-
utils_1.assertIs(yDecrease, 'yDecrease', ['number']);
|
|
704
|
+
moveDown(yDecrease) {
|
|
705
|
+
(0, utils_1.assertIs)(yDecrease, 'yDecrease', ['number']);
|
|
704
706
|
this.y -= yDecrease;
|
|
705
|
-
}
|
|
707
|
+
}
|
|
706
708
|
/**
|
|
707
709
|
* Change the default position of this page to be further up the y-axis.
|
|
708
710
|
* For example:
|
|
@@ -716,10 +718,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
716
718
|
* @param yIncrease The amount by which the page's default position along the
|
|
717
719
|
* y-axis should be increased.
|
|
718
720
|
*/
|
|
719
|
-
|
|
720
|
-
utils_1.assertIs(yIncrease, 'yIncrease', ['number']);
|
|
721
|
+
moveUp(yIncrease) {
|
|
722
|
+
(0, utils_1.assertIs)(yIncrease, 'yIncrease', ['number']);
|
|
721
723
|
this.y += yIncrease;
|
|
722
|
-
}
|
|
724
|
+
}
|
|
723
725
|
/**
|
|
724
726
|
* Change the default position of this page to be further left on the x-axis.
|
|
725
727
|
* For example:
|
|
@@ -733,10 +735,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
733
735
|
* @param xDecrease The amount by which the page's default position along the
|
|
734
736
|
* x-axis should be decreased.
|
|
735
737
|
*/
|
|
736
|
-
|
|
737
|
-
utils_1.assertIs(xDecrease, 'xDecrease', ['number']);
|
|
738
|
+
moveLeft(xDecrease) {
|
|
739
|
+
(0, utils_1.assertIs)(xDecrease, 'xDecrease', ['number']);
|
|
738
740
|
this.x -= xDecrease;
|
|
739
|
-
}
|
|
741
|
+
}
|
|
740
742
|
/**
|
|
741
743
|
* Change the default position of this page to be further right on the y-axis.
|
|
742
744
|
* For example:
|
|
@@ -750,10 +752,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
750
752
|
* @param xIncrease The amount by which the page's default position along the
|
|
751
753
|
* x-axis should be increased.
|
|
752
754
|
*/
|
|
753
|
-
|
|
754
|
-
utils_1.assertIs(xIncrease, 'xIncrease', ['number']);
|
|
755
|
+
moveRight(xIncrease) {
|
|
756
|
+
(0, utils_1.assertIs)(xIncrease, 'xIncrease', ['number']);
|
|
755
757
|
this.x += xIncrease;
|
|
756
|
-
}
|
|
758
|
+
}
|
|
757
759
|
/**
|
|
758
760
|
* Push one or more operators to the end of this page's current content
|
|
759
761
|
* stream. For example:
|
|
@@ -783,15 +785,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
783
785
|
* ```
|
|
784
786
|
* @param operator The operators to be pushed.
|
|
785
787
|
*/
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
utils_1.assertEachIs(operator, 'operator', [[core_1.PDFOperator, 'PDFOperator']]);
|
|
792
|
-
var contentStream = this.getContentStream();
|
|
793
|
-
contentStream.push.apply(contentStream, operator);
|
|
794
|
-
};
|
|
788
|
+
pushOperators(...operator) {
|
|
789
|
+
(0, utils_1.assertEachIs)(operator, 'operator', [[core_1.PDFOperator, 'PDFOperator']]);
|
|
790
|
+
const contentStream = this.getContentStream();
|
|
791
|
+
contentStream.push(...operator);
|
|
792
|
+
}
|
|
795
793
|
/**
|
|
796
794
|
* Draw one or more lines of text on this page. For example:
|
|
797
795
|
* ```js
|
|
@@ -829,50 +827,59 @@ var PDFPage = /** @class */ (function () {
|
|
|
829
827
|
* @param text The text to be drawn.
|
|
830
828
|
* @param options The options to be used when drawing the text.
|
|
831
829
|
*/
|
|
832
|
-
|
|
830
|
+
drawText(text, options = {}) {
|
|
833
831
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
834
|
-
|
|
835
|
-
utils_1.
|
|
836
|
-
utils_1.
|
|
837
|
-
utils_1.
|
|
838
|
-
utils_1.assertOrUndefined(options.
|
|
839
|
-
utils_1.assertOrUndefined(options.
|
|
840
|
-
utils_1.assertOrUndefined(options.
|
|
841
|
-
utils_1.assertOrUndefined(options.
|
|
842
|
-
utils_1.assertOrUndefined(options.
|
|
843
|
-
utils_1.assertOrUndefined(options.
|
|
844
|
-
utils_1.assertOrUndefined(options.
|
|
845
|
-
utils_1.assertOrUndefined(options.
|
|
846
|
-
utils_1.assertOrUndefined(options.
|
|
847
|
-
utils_1.
|
|
848
|
-
utils_1.
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
832
|
+
(0, utils_1.assertIs)(text, 'text', ['string']);
|
|
833
|
+
(0, utils_1.assertOrUndefined)(options.color, 'options.color', [[Object, 'Color']]);
|
|
834
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'opacity.opacity', 0, 1);
|
|
835
|
+
(0, utils_1.assertOrUndefined)(options.font, 'options.font', [[PDFFont_1.default, 'PDFFont']]);
|
|
836
|
+
(0, utils_1.assertOrUndefined)(options.size, 'options.size', ['number']);
|
|
837
|
+
(0, utils_1.assertOrUndefined)(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
838
|
+
(0, utils_1.assertOrUndefined)(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
839
|
+
(0, utils_1.assertOrUndefined)(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
840
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
841
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
842
|
+
(0, utils_1.assertOrUndefined)(options.lineHeight, 'options.lineHeight', ['number']);
|
|
843
|
+
(0, utils_1.assertOrUndefined)(options.maxWidth, 'options.maxWidth', ['number']);
|
|
844
|
+
(0, utils_1.assertOrUndefined)(options.wordBreaks, 'options.wordBreaks', [Array]);
|
|
845
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
846
|
+
(0, utils_1.assertOrUndefined)(options.strokeColor, 'options.strokeColor', [
|
|
847
|
+
[Object, 'Color'],
|
|
848
|
+
]);
|
|
849
|
+
(0, utils_1.assertOrUndefined)(options.strokeWidth, 'options.strokeWidth', ['number']);
|
|
850
|
+
(0, utils_1.assertOrUndefined)(options.renderMode, 'options.renderMode', ['number']);
|
|
851
|
+
const { oldFont, newFont, newFontKey } = this.setOrEmbedFont(options.font);
|
|
852
|
+
const fontSize = options.size || this.fontSize;
|
|
853
|
+
const wordBreaks = options.wordBreaks || this.doc.defaultWordBreaks;
|
|
854
|
+
const textWidth = (t) => newFont.widthOfTextAtSize(t, fontSize);
|
|
855
|
+
const lines = options.maxWidth === undefined
|
|
856
|
+
? (0, utils_1.lineSplit)((0, utils_1.cleanText)(text))
|
|
857
|
+
: (0, utils_1.breakTextIntoLines)(text, wordBreaks, options.maxWidth, textWidth);
|
|
858
|
+
const encodedLines = new Array(lines.length);
|
|
859
|
+
for (let idx = 0, len = lines.length; idx < len; idx++) {
|
|
858
860
|
encodedLines[idx] = newFont.encodeText(lines[idx]);
|
|
859
861
|
}
|
|
860
|
-
|
|
862
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
861
863
|
opacity: options.opacity,
|
|
862
864
|
blendMode: options.blendMode,
|
|
863
865
|
});
|
|
864
|
-
|
|
865
|
-
contentStream.push
|
|
866
|
+
const contentStream = this.getContentStream();
|
|
867
|
+
contentStream.push(...(0, operations_1.drawLinesOfText)(encodedLines, {
|
|
866
868
|
color: (_a = options.color) !== null && _a !== void 0 ? _a : this.fontColor,
|
|
867
869
|
font: newFontKey,
|
|
868
870
|
size: fontSize,
|
|
869
|
-
rotate: (_b = options.rotate) !== null && _b !== void 0 ? _b : rotations_1.degrees(0),
|
|
870
|
-
xSkew: (_c = options.xSkew) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
|
|
871
|
-
ySkew: (_d = options.ySkew) !== null && _d !== void 0 ? _d : rotations_1.degrees(0),
|
|
871
|
+
rotate: (_b = options.rotate) !== null && _b !== void 0 ? _b : (0, rotations_1.degrees)(0),
|
|
872
|
+
xSkew: (_c = options.xSkew) !== null && _c !== void 0 ? _c : (0, rotations_1.degrees)(0),
|
|
873
|
+
ySkew: (_d = options.ySkew) !== null && _d !== void 0 ? _d : (0, rotations_1.degrees)(0),
|
|
872
874
|
x: (_e = options.x) !== null && _e !== void 0 ? _e : this.x,
|
|
873
875
|
y: (_f = options.y) !== null && _f !== void 0 ? _f : this.y,
|
|
874
876
|
lineHeight: (_g = options.lineHeight) !== null && _g !== void 0 ? _g : this.lineHeight,
|
|
875
877
|
graphicsState: graphicsStateKey,
|
|
878
|
+
matrix: options.matrix,
|
|
879
|
+
clipSpaces: options.clipSpaces,
|
|
880
|
+
strokeColor: options.strokeColor,
|
|
881
|
+
strokeWidth: options.strokeWidth,
|
|
882
|
+
renderMode: options.renderMode,
|
|
876
883
|
}));
|
|
877
884
|
if (options.font) {
|
|
878
885
|
if (oldFont)
|
|
@@ -880,7 +887,7 @@ var PDFPage = /** @class */ (function () {
|
|
|
880
887
|
else
|
|
881
888
|
this.resetFont();
|
|
882
889
|
}
|
|
883
|
-
}
|
|
890
|
+
}
|
|
884
891
|
/**
|
|
885
892
|
* Draw an image on this page. For example:
|
|
886
893
|
* ```js
|
|
@@ -906,37 +913,38 @@ var PDFPage = /** @class */ (function () {
|
|
|
906
913
|
* @param image The image to be drawn.
|
|
907
914
|
* @param options The options to be used when drawing the image.
|
|
908
915
|
*/
|
|
909
|
-
|
|
916
|
+
drawImage(image, options = {}) {
|
|
910
917
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
911
|
-
if (options === void 0) { options = {}; }
|
|
912
918
|
// TODO: Reuse image XObject name if we've already added this image to Resources.XObjects
|
|
913
|
-
utils_1.assertIs(image, 'image', [[PDFImage_1.default, 'PDFImage']]);
|
|
914
|
-
utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
|
|
915
|
-
utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
|
|
916
|
-
utils_1.assertOrUndefined(options.width, 'options.width', ['number']);
|
|
917
|
-
utils_1.assertOrUndefined(options.height, 'options.height', ['number']);
|
|
918
|
-
utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
919
|
-
utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
920
|
-
utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
921
|
-
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
922
|
-
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
923
|
-
|
|
924
|
-
|
|
919
|
+
(0, utils_1.assertIs)(image, 'image', [[PDFImage_1.default, 'PDFImage']]);
|
|
920
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
921
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
922
|
+
(0, utils_1.assertOrUndefined)(options.width, 'options.width', ['number']);
|
|
923
|
+
(0, utils_1.assertOrUndefined)(options.height, 'options.height', ['number']);
|
|
924
|
+
(0, utils_1.assertOrUndefined)(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
925
|
+
(0, utils_1.assertOrUndefined)(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
926
|
+
(0, utils_1.assertOrUndefined)(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
927
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'opacity.opacity', 0, 1);
|
|
928
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
929
|
+
const xObjectKey = this.node.newXObject('Image', image.ref);
|
|
930
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
925
931
|
opacity: options.opacity,
|
|
926
932
|
blendMode: options.blendMode,
|
|
927
933
|
});
|
|
928
|
-
|
|
929
|
-
contentStream.push
|
|
934
|
+
const contentStream = this.getContentStream();
|
|
935
|
+
contentStream.push(...(0, operations_1.drawImage)(xObjectKey, {
|
|
930
936
|
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
931
937
|
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
932
938
|
width: (_c = options.width) !== null && _c !== void 0 ? _c : image.size().width,
|
|
933
939
|
height: (_d = options.height) !== null && _d !== void 0 ? _d : image.size().height,
|
|
934
|
-
rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : rotations_1.degrees(0),
|
|
935
|
-
xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : rotations_1.degrees(0),
|
|
936
|
-
ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : rotations_1.degrees(0),
|
|
940
|
+
rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : (0, rotations_1.degrees)(0),
|
|
941
|
+
xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : (0, rotations_1.degrees)(0),
|
|
942
|
+
ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : (0, rotations_1.degrees)(0),
|
|
937
943
|
graphicsState: graphicsStateKey,
|
|
944
|
+
matrix: options.matrix,
|
|
945
|
+
clipSpaces: options.clipSpaces,
|
|
938
946
|
}));
|
|
939
|
-
}
|
|
947
|
+
}
|
|
940
948
|
/**
|
|
941
949
|
* Draw an embedded PDF page on this page. For example:
|
|
942
950
|
* ```js
|
|
@@ -969,49 +977,48 @@ var PDFPage = /** @class */ (function () {
|
|
|
969
977
|
* @param embeddedPage The embedded page to be drawn.
|
|
970
978
|
* @param options The options to be used when drawing the embedded page.
|
|
971
979
|
*/
|
|
972
|
-
|
|
980
|
+
drawPage(embeddedPage, options = {}) {
|
|
973
981
|
var _a, _b, _c, _d, _e;
|
|
974
|
-
if (options === void 0) { options = {}; }
|
|
975
982
|
// TODO: Reuse embeddedPage XObject name if we've already added this embeddedPage to Resources.XObjects
|
|
976
|
-
utils_1.assertIs(embeddedPage, 'embeddedPage', [
|
|
983
|
+
(0, utils_1.assertIs)(embeddedPage, 'embeddedPage', [
|
|
977
984
|
[PDFEmbeddedPage_1.default, 'PDFEmbeddedPage'],
|
|
978
985
|
]);
|
|
979
|
-
utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
|
|
980
|
-
utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
|
|
981
|
-
utils_1.assertOrUndefined(options.xScale, 'options.xScale', ['number']);
|
|
982
|
-
utils_1.assertOrUndefined(options.yScale, 'options.yScale', ['number']);
|
|
983
|
-
utils_1.assertOrUndefined(options.width, 'options.width', ['number']);
|
|
984
|
-
utils_1.assertOrUndefined(options.height, 'options.height', ['number']);
|
|
985
|
-
utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
986
|
-
utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
987
|
-
utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
988
|
-
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
989
|
-
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
990
|
-
|
|
991
|
-
|
|
986
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
987
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
988
|
+
(0, utils_1.assertOrUndefined)(options.xScale, 'options.xScale', ['number']);
|
|
989
|
+
(0, utils_1.assertOrUndefined)(options.yScale, 'options.yScale', ['number']);
|
|
990
|
+
(0, utils_1.assertOrUndefined)(options.width, 'options.width', ['number']);
|
|
991
|
+
(0, utils_1.assertOrUndefined)(options.height, 'options.height', ['number']);
|
|
992
|
+
(0, utils_1.assertOrUndefined)(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
993
|
+
(0, utils_1.assertOrUndefined)(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
994
|
+
(0, utils_1.assertOrUndefined)(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
995
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'opacity.opacity', 0, 1);
|
|
996
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
997
|
+
const xObjectKey = this.node.newXObject('EmbeddedPdfPage', embeddedPage.ref);
|
|
998
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
992
999
|
opacity: options.opacity,
|
|
993
1000
|
blendMode: options.blendMode,
|
|
994
1001
|
});
|
|
995
1002
|
// prettier-ignore
|
|
996
|
-
|
|
1003
|
+
const xScale = (options.width !== undefined ? options.width / embeddedPage.width
|
|
997
1004
|
: options.xScale !== undefined ? options.xScale
|
|
998
1005
|
: 1);
|
|
999
1006
|
// prettier-ignore
|
|
1000
|
-
|
|
1007
|
+
const yScale = (options.height !== undefined ? options.height / embeddedPage.height
|
|
1001
1008
|
: options.yScale !== undefined ? options.yScale
|
|
1002
1009
|
: 1);
|
|
1003
|
-
|
|
1004
|
-
contentStream.push
|
|
1010
|
+
const contentStream = this.getContentStream();
|
|
1011
|
+
contentStream.push(...(0, operations_1.drawPage)(xObjectKey, {
|
|
1005
1012
|
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1006
1013
|
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1007
|
-
xScale
|
|
1008
|
-
yScale
|
|
1009
|
-
rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
|
|
1010
|
-
xSkew: (_d = options.xSkew) !== null && _d !== void 0 ? _d : rotations_1.degrees(0),
|
|
1011
|
-
ySkew: (_e = options.ySkew) !== null && _e !== void 0 ? _e : rotations_1.degrees(0),
|
|
1014
|
+
xScale,
|
|
1015
|
+
yScale,
|
|
1016
|
+
rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : (0, rotations_1.degrees)(0),
|
|
1017
|
+
xSkew: (_d = options.xSkew) !== null && _d !== void 0 ? _d : (0, rotations_1.degrees)(0),
|
|
1018
|
+
ySkew: (_e = options.ySkew) !== null && _e !== void 0 ? _e : (0, rotations_1.degrees)(0),
|
|
1012
1019
|
graphicsState: graphicsStateKey,
|
|
1013
1020
|
}));
|
|
1014
|
-
}
|
|
1021
|
+
}
|
|
1015
1022
|
/**
|
|
1016
1023
|
* Draw an SVG path on this page. For example:
|
|
1017
1024
|
* ```js
|
|
@@ -1049,43 +1056,43 @@ var PDFPage = /** @class */ (function () {
|
|
|
1049
1056
|
* @param path The SVG path to be drawn.
|
|
1050
1057
|
* @param options The options to be used when drawing the SVG path.
|
|
1051
1058
|
*/
|
|
1052
|
-
|
|
1059
|
+
drawSvgPath(path, options = {}) {
|
|
1053
1060
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1054
|
-
|
|
1055
|
-
utils_1.
|
|
1056
|
-
utils_1.assertOrUndefined(options.
|
|
1057
|
-
utils_1.assertOrUndefined(options.
|
|
1058
|
-
utils_1.assertOrUndefined(options.
|
|
1059
|
-
utils_1.assertOrUndefined(options.
|
|
1060
|
-
utils_1.assertOrUndefined(options.
|
|
1061
|
-
utils_1.
|
|
1062
|
-
utils_1.
|
|
1063
|
-
utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
|
|
1061
|
+
(0, utils_1.assertIs)(path, 'path', ['string']);
|
|
1062
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
1063
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
1064
|
+
(0, utils_1.assertOrUndefined)(options.scale, 'options.scale', ['number']);
|
|
1065
|
+
(0, utils_1.assertOrUndefined)(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
1066
|
+
(0, utils_1.assertOrUndefined)(options.borderWidth, 'options.borderWidth', ['number']);
|
|
1067
|
+
(0, utils_1.assertOrUndefined)(options.color, 'options.color', [[Object, 'Color']]);
|
|
1068
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'opacity.opacity', 0, 1);
|
|
1069
|
+
(0, utils_1.assertOrUndefined)(options.borderColor, 'options.borderColor', [
|
|
1064
1070
|
[Object, 'Color'],
|
|
1065
1071
|
]);
|
|
1066
|
-
utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
|
|
1072
|
+
(0, utils_1.assertOrUndefined)(options.borderDashArray, 'options.borderDashArray', [
|
|
1067
1073
|
Array,
|
|
1068
1074
|
]);
|
|
1069
|
-
utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1075
|
+
(0, utils_1.assertOrUndefined)(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1070
1076
|
'number',
|
|
1071
1077
|
]);
|
|
1072
|
-
utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1073
|
-
utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);
|
|
1074
|
-
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1075
|
-
|
|
1078
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1079
|
+
(0, utils_1.assertRangeOrUndefined)(options.borderOpacity, 'options.borderOpacity', 0, 1);
|
|
1080
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1081
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.fillRule, 'options.fillRule', operators_1.FillRule);
|
|
1082
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1076
1083
|
opacity: options.opacity,
|
|
1077
1084
|
borderOpacity: options.borderOpacity,
|
|
1078
1085
|
blendMode: options.blendMode,
|
|
1079
1086
|
});
|
|
1080
1087
|
if (!('color' in options) && !('borderColor' in options)) {
|
|
1081
|
-
options.borderColor = colors_1.rgb(0, 0, 0);
|
|
1088
|
+
options.borderColor = (0, colors_1.rgb)(0, 0, 0);
|
|
1082
1089
|
}
|
|
1083
|
-
|
|
1084
|
-
contentStream.push
|
|
1090
|
+
const contentStream = this.getContentStream();
|
|
1091
|
+
contentStream.push(...(0, operations_1.drawSvgPath)(path, {
|
|
1085
1092
|
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1086
1093
|
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1087
1094
|
scale: options.scale,
|
|
1088
|
-
rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
|
|
1095
|
+
rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : (0, rotations_1.degrees)(0),
|
|
1089
1096
|
color: (_d = options.color) !== null && _d !== void 0 ? _d : undefined,
|
|
1090
1097
|
borderColor: (_e = options.borderColor) !== null && _e !== void 0 ? _e : undefined,
|
|
1091
1098
|
borderWidth: (_f = options.borderWidth) !== null && _f !== void 0 ? _f : 0,
|
|
@@ -1093,8 +1100,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
1093
1100
|
borderDashPhase: (_h = options.borderDashPhase) !== null && _h !== void 0 ? _h : undefined,
|
|
1094
1101
|
borderLineCap: (_j = options.borderLineCap) !== null && _j !== void 0 ? _j : undefined,
|
|
1095
1102
|
graphicsState: graphicsStateKey,
|
|
1103
|
+
fillRule: options.fillRule,
|
|
1104
|
+
matrix: options.matrix,
|
|
1105
|
+
clipSpaces: options.clipSpaces,
|
|
1096
1106
|
}));
|
|
1097
|
-
}
|
|
1107
|
+
}
|
|
1098
1108
|
/**
|
|
1099
1109
|
* Draw a line on this page. For example:
|
|
1100
1110
|
* ```js
|
|
@@ -1110,34 +1120,34 @@ var PDFPage = /** @class */ (function () {
|
|
|
1110
1120
|
* ```
|
|
1111
1121
|
* @param options The options to be used when drawing the line.
|
|
1112
1122
|
*/
|
|
1113
|
-
|
|
1123
|
+
drawLine(options) {
|
|
1114
1124
|
var _a, _b, _c, _d, _e;
|
|
1115
|
-
utils_1.assertIs(options.start, 'options.start', [
|
|
1125
|
+
(0, utils_1.assertIs)(options.start, 'options.start', [
|
|
1116
1126
|
[Object, '{ x: number, y: number }'],
|
|
1117
1127
|
]);
|
|
1118
|
-
utils_1.assertIs(options.end, 'options.end', [
|
|
1128
|
+
(0, utils_1.assertIs)(options.end, 'options.end', [
|
|
1119
1129
|
[Object, '{ x: number, y: number }'],
|
|
1120
1130
|
]);
|
|
1121
|
-
utils_1.assertIs(options.start.x, 'options.start.x', ['number']);
|
|
1122
|
-
utils_1.assertIs(options.start.y, 'options.start.y', ['number']);
|
|
1123
|
-
utils_1.assertIs(options.end.x, 'options.end.x', ['number']);
|
|
1124
|
-
utils_1.assertIs(options.end.y, 'options.end.y', ['number']);
|
|
1125
|
-
utils_1.assertOrUndefined(options.thickness, 'options.thickness', ['number']);
|
|
1126
|
-
utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
|
|
1127
|
-
utils_1.assertOrUndefined(options.dashArray, 'options.dashArray', [Array]);
|
|
1128
|
-
utils_1.assertOrUndefined(options.dashPhase, 'options.dashPhase', ['number']);
|
|
1129
|
-
utils_1.assertIsOneOfOrUndefined(options.lineCap, 'options.lineCap', operators_1.LineCapStyle);
|
|
1130
|
-
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
1131
|
-
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1132
|
-
|
|
1131
|
+
(0, utils_1.assertIs)(options.start.x, 'options.start.x', ['number']);
|
|
1132
|
+
(0, utils_1.assertIs)(options.start.y, 'options.start.y', ['number']);
|
|
1133
|
+
(0, utils_1.assertIs)(options.end.x, 'options.end.x', ['number']);
|
|
1134
|
+
(0, utils_1.assertIs)(options.end.y, 'options.end.y', ['number']);
|
|
1135
|
+
(0, utils_1.assertOrUndefined)(options.thickness, 'options.thickness', ['number']);
|
|
1136
|
+
(0, utils_1.assertOrUndefined)(options.color, 'options.color', [[Object, 'Color']]);
|
|
1137
|
+
(0, utils_1.assertOrUndefined)(options.dashArray, 'options.dashArray', [Array]);
|
|
1138
|
+
(0, utils_1.assertOrUndefined)(options.dashPhase, 'options.dashPhase', ['number']);
|
|
1139
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.lineCap, 'options.lineCap', operators_1.LineCapStyle);
|
|
1140
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'opacity.opacity', 0, 1);
|
|
1141
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1142
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1133
1143
|
borderOpacity: options.opacity,
|
|
1134
1144
|
blendMode: options.blendMode,
|
|
1135
1145
|
});
|
|
1136
1146
|
if (!('color' in options)) {
|
|
1137
|
-
options.color = colors_1.rgb(0, 0, 0);
|
|
1147
|
+
options.color = (0, colors_1.rgb)(0, 0, 0);
|
|
1138
1148
|
}
|
|
1139
|
-
|
|
1140
|
-
contentStream.push
|
|
1149
|
+
const contentStream = this.getContentStream();
|
|
1150
|
+
contentStream.push(...(0, operations_1.drawLine)({
|
|
1141
1151
|
start: options.start,
|
|
1142
1152
|
end: options.end,
|
|
1143
1153
|
thickness: (_a = options.thickness) !== null && _a !== void 0 ? _a : 1,
|
|
@@ -1146,8 +1156,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
1146
1156
|
dashPhase: (_d = options.dashPhase) !== null && _d !== void 0 ? _d : undefined,
|
|
1147
1157
|
lineCap: (_e = options.lineCap) !== null && _e !== void 0 ? _e : undefined,
|
|
1148
1158
|
graphicsState: graphicsStateKey,
|
|
1159
|
+
matrix: options.matrix,
|
|
1160
|
+
clipSpaces: options.clipSpaces,
|
|
1149
1161
|
}));
|
|
1150
|
-
}
|
|
1162
|
+
}
|
|
1151
1163
|
/**
|
|
1152
1164
|
* Draw a rectangle on this page. For example:
|
|
1153
1165
|
* ```js
|
|
@@ -1156,6 +1168,8 @@ var PDFPage = /** @class */ (function () {
|
|
|
1156
1168
|
* page.drawRectangle({
|
|
1157
1169
|
* x: 25,
|
|
1158
1170
|
* y: 75,
|
|
1171
|
+
* rx: 5, // This is the border radius
|
|
1172
|
+
* ry: 5,
|
|
1159
1173
|
* width: 250,
|
|
1160
1174
|
* height: 75,
|
|
1161
1175
|
* rotate: degrees(-15),
|
|
@@ -1168,57 +1182,62 @@ var PDFPage = /** @class */ (function () {
|
|
|
1168
1182
|
* ```
|
|
1169
1183
|
* @param options The options to be used when drawing the rectangle.
|
|
1170
1184
|
*/
|
|
1171
|
-
|
|
1172
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1173
|
-
|
|
1174
|
-
utils_1.assertOrUndefined(options.
|
|
1175
|
-
utils_1.assertOrUndefined(options.
|
|
1176
|
-
utils_1.assertOrUndefined(options.
|
|
1177
|
-
utils_1.assertOrUndefined(options.
|
|
1178
|
-
utils_1.assertOrUndefined(options.
|
|
1179
|
-
utils_1.assertOrUndefined(options.
|
|
1180
|
-
utils_1.assertOrUndefined(options.
|
|
1181
|
-
utils_1.assertOrUndefined(options.
|
|
1182
|
-
utils_1.
|
|
1183
|
-
utils_1.
|
|
1184
|
-
utils_1.assertOrUndefined(options.
|
|
1185
|
+
drawRectangle(options = {}) {
|
|
1186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1187
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
1188
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
1189
|
+
(0, utils_1.assertOrUndefined)(options.width, 'options.width', ['number']);
|
|
1190
|
+
(0, utils_1.assertOrUndefined)(options.height, 'options.height', ['number']);
|
|
1191
|
+
(0, utils_1.assertOrUndefined)(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
1192
|
+
(0, utils_1.assertOrUndefined)(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
1193
|
+
(0, utils_1.assertOrUndefined)(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
1194
|
+
(0, utils_1.assertOrUndefined)(options.borderWidth, 'options.borderWidth', ['number']);
|
|
1195
|
+
(0, utils_1.assertOrUndefined)(options.color, 'options.color', [[Object, 'Color']]);
|
|
1196
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'options.opacity', 0, 1);
|
|
1197
|
+
(0, utils_1.assertOrUndefined)(options.rx, 'options.rx', ['number']);
|
|
1198
|
+
(0, utils_1.assertOrUndefined)(options.ry, 'options.ry', ['number']);
|
|
1199
|
+
(0, utils_1.assertOrUndefined)(options.borderColor, 'options.borderColor', [
|
|
1185
1200
|
[Object, 'Color'],
|
|
1186
1201
|
]);
|
|
1187
|
-
utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
|
|
1202
|
+
(0, utils_1.assertOrUndefined)(options.borderDashArray, 'options.borderDashArray', [
|
|
1188
1203
|
Array,
|
|
1189
1204
|
]);
|
|
1190
|
-
utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1205
|
+
(0, utils_1.assertOrUndefined)(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1191
1206
|
'number',
|
|
1192
1207
|
]);
|
|
1193
|
-
utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1194
|
-
utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);
|
|
1195
|
-
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1196
|
-
|
|
1208
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1209
|
+
(0, utils_1.assertRangeOrUndefined)(options.borderOpacity, 'options.borderOpacity', 0, 1);
|
|
1210
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1211
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1197
1212
|
opacity: options.opacity,
|
|
1198
1213
|
borderOpacity: options.borderOpacity,
|
|
1199
1214
|
blendMode: options.blendMode,
|
|
1200
1215
|
});
|
|
1201
1216
|
if (!('color' in options) && !('borderColor' in options)) {
|
|
1202
|
-
options.color = colors_1.rgb(0, 0, 0);
|
|
1217
|
+
options.color = (0, colors_1.rgb)(0, 0, 0);
|
|
1203
1218
|
}
|
|
1204
|
-
|
|
1205
|
-
contentStream.push
|
|
1219
|
+
const contentStream = this.getContentStream();
|
|
1220
|
+
contentStream.push(...(0, operations_1.drawRectangle)({
|
|
1206
1221
|
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1207
1222
|
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1208
1223
|
width: (_c = options.width) !== null && _c !== void 0 ? _c : 150,
|
|
1209
1224
|
height: (_d = options.height) !== null && _d !== void 0 ? _d : 100,
|
|
1210
|
-
rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : rotations_1.degrees(0),
|
|
1211
|
-
xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : rotations_1.degrees(0),
|
|
1212
|
-
ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : rotations_1.degrees(0),
|
|
1225
|
+
rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : (0, rotations_1.degrees)(0),
|
|
1226
|
+
xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : (0, rotations_1.degrees)(0),
|
|
1227
|
+
ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : (0, rotations_1.degrees)(0),
|
|
1213
1228
|
borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,
|
|
1214
1229
|
color: (_j = options.color) !== null && _j !== void 0 ? _j : undefined,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1230
|
+
rx: (_k = options.rx) !== null && _k !== void 0 ? _k : 0,
|
|
1231
|
+
ry: (_l = options.ry) !== null && _l !== void 0 ? _l : 0,
|
|
1232
|
+
borderColor: (_m = options.borderColor) !== null && _m !== void 0 ? _m : undefined,
|
|
1233
|
+
borderDashArray: (_o = options.borderDashArray) !== null && _o !== void 0 ? _o : undefined,
|
|
1234
|
+
borderDashPhase: (_p = options.borderDashPhase) !== null && _p !== void 0 ? _p : undefined,
|
|
1218
1235
|
graphicsState: graphicsStateKey,
|
|
1219
|
-
borderLineCap: (
|
|
1236
|
+
borderLineCap: (_q = options.borderLineCap) !== null && _q !== void 0 ? _q : undefined,
|
|
1237
|
+
matrix: options.matrix,
|
|
1238
|
+
clipSpaces: options.clipSpaces,
|
|
1220
1239
|
}));
|
|
1221
|
-
}
|
|
1240
|
+
}
|
|
1222
1241
|
/**
|
|
1223
1242
|
* Draw a square on this page. For example:
|
|
1224
1243
|
* ```js
|
|
@@ -1238,12 +1257,11 @@ var PDFPage = /** @class */ (function () {
|
|
|
1238
1257
|
* ```
|
|
1239
1258
|
* @param options The options to be used when drawing the square.
|
|
1240
1259
|
*/
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
};
|
|
1260
|
+
drawSquare(options = {}) {
|
|
1261
|
+
const { size } = options;
|
|
1262
|
+
(0, utils_1.assertOrUndefined)(size, 'size', ['number']);
|
|
1263
|
+
this.drawRectangle(Object.assign(Object.assign({}, options), { width: size, height: size }));
|
|
1264
|
+
}
|
|
1247
1265
|
/**
|
|
1248
1266
|
* Draw an ellipse on this page. For example:
|
|
1249
1267
|
* ```js
|
|
@@ -1263,39 +1281,38 @@ var PDFPage = /** @class */ (function () {
|
|
|
1263
1281
|
* ```
|
|
1264
1282
|
* @param options The options to be used when drawing the ellipse.
|
|
1265
1283
|
*/
|
|
1266
|
-
|
|
1284
|
+
drawEllipse(options = {}) {
|
|
1267
1285
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1268
|
-
|
|
1269
|
-
utils_1.assertOrUndefined(options.
|
|
1270
|
-
utils_1.assertOrUndefined(options.
|
|
1271
|
-
utils_1.assertOrUndefined(options.
|
|
1272
|
-
utils_1.assertOrUndefined(options.
|
|
1273
|
-
utils_1.assertOrUndefined(options.
|
|
1274
|
-
utils_1.
|
|
1275
|
-
utils_1.
|
|
1276
|
-
utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
|
|
1286
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
1287
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
1288
|
+
(0, utils_1.assertOrUndefined)(options.xScale, 'options.xScale', ['number']);
|
|
1289
|
+
(0, utils_1.assertOrUndefined)(options.yScale, 'options.yScale', ['number']);
|
|
1290
|
+
(0, utils_1.assertOrUndefined)(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
1291
|
+
(0, utils_1.assertOrUndefined)(options.color, 'options.color', [[Object, 'Color']]);
|
|
1292
|
+
(0, utils_1.assertRangeOrUndefined)(options.opacity, 'opacity.opacity', 0, 1);
|
|
1293
|
+
(0, utils_1.assertOrUndefined)(options.borderColor, 'options.borderColor', [
|
|
1277
1294
|
[Object, 'Color'],
|
|
1278
1295
|
]);
|
|
1279
|
-
utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);
|
|
1280
|
-
utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);
|
|
1281
|
-
utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
|
|
1296
|
+
(0, utils_1.assertRangeOrUndefined)(options.borderOpacity, 'options.borderOpacity', 0, 1);
|
|
1297
|
+
(0, utils_1.assertOrUndefined)(options.borderWidth, 'options.borderWidth', ['number']);
|
|
1298
|
+
(0, utils_1.assertOrUndefined)(options.borderDashArray, 'options.borderDashArray', [
|
|
1282
1299
|
Array,
|
|
1283
1300
|
]);
|
|
1284
|
-
utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1301
|
+
(0, utils_1.assertOrUndefined)(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1285
1302
|
'number',
|
|
1286
1303
|
]);
|
|
1287
|
-
utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1288
|
-
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1289
|
-
|
|
1304
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1305
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1306
|
+
const graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1290
1307
|
opacity: options.opacity,
|
|
1291
1308
|
borderOpacity: options.borderOpacity,
|
|
1292
1309
|
blendMode: options.blendMode,
|
|
1293
1310
|
});
|
|
1294
1311
|
if (!('color' in options) && !('borderColor' in options)) {
|
|
1295
|
-
options.color = colors_1.rgb(0, 0, 0);
|
|
1312
|
+
options.color = (0, colors_1.rgb)(0, 0, 0);
|
|
1296
1313
|
}
|
|
1297
|
-
|
|
1298
|
-
contentStream.push
|
|
1314
|
+
const contentStream = this.getContentStream();
|
|
1315
|
+
contentStream.push(...(0, operations_1.drawEllipse)({
|
|
1299
1316
|
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1300
1317
|
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1301
1318
|
xScale: (_c = options.xScale) !== null && _c !== void 0 ? _c : 100,
|
|
@@ -1308,8 +1325,10 @@ var PDFPage = /** @class */ (function () {
|
|
|
1308
1325
|
borderDashPhase: (_k = options.borderDashPhase) !== null && _k !== void 0 ? _k : undefined,
|
|
1309
1326
|
borderLineCap: (_l = options.borderLineCap) !== null && _l !== void 0 ? _l : undefined,
|
|
1310
1327
|
graphicsState: graphicsStateKey,
|
|
1328
|
+
matrix: options.matrix,
|
|
1329
|
+
clipSpaces: options.clipSpaces,
|
|
1311
1330
|
}));
|
|
1312
|
-
}
|
|
1331
|
+
}
|
|
1313
1332
|
/**
|
|
1314
1333
|
* Draw a circle on this page. For example:
|
|
1315
1334
|
* ```js
|
|
@@ -1328,115 +1347,143 @@ var PDFPage = /** @class */ (function () {
|
|
|
1328
1347
|
* ```
|
|
1329
1348
|
* @param options The options to be used when drawing the ellipse.
|
|
1330
1349
|
*/
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
var oldFontKey = this.fontKey;
|
|
1350
|
+
drawCircle(options = {}) {
|
|
1351
|
+
const { size = 100 } = options;
|
|
1352
|
+
(0, utils_1.assertOrUndefined)(size, 'size', ['number']);
|
|
1353
|
+
this.drawEllipse(Object.assign(Object.assign({}, options), { xScale: size, yScale: size }));
|
|
1354
|
+
}
|
|
1355
|
+
setOrEmbedFont(font) {
|
|
1356
|
+
const oldFont = this.font;
|
|
1357
|
+
const oldFontKey = this.fontKey;
|
|
1340
1358
|
if (font)
|
|
1341
1359
|
this.setFont(font);
|
|
1342
1360
|
else
|
|
1343
1361
|
this.getFont();
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
return { oldFont
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1362
|
+
const newFont = this.font;
|
|
1363
|
+
const newFontKey = this.fontKey;
|
|
1364
|
+
return { oldFont, oldFontKey, newFont, newFontKey };
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Draw an SVG on this page. For example:
|
|
1368
|
+
* ```js
|
|
1369
|
+
* const svg = '<svg><path d="M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90"></path></svg>'
|
|
1370
|
+
*
|
|
1371
|
+
* // Draw svg
|
|
1372
|
+
* page.drawSvg(svg, { x: 25, y: 75 })
|
|
1373
|
+
* ```
|
|
1374
|
+
*
|
|
1375
|
+
* If the svg contains images, you must call embedSvg from the document that contains that page first:
|
|
1376
|
+
* ```js
|
|
1377
|
+
* const svg = '<svg><image href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="/></svg>'
|
|
1378
|
+
*
|
|
1379
|
+
* // Draw svg
|
|
1380
|
+
* const pdfSvg = await pdfDoc.embedSvg(svg)
|
|
1381
|
+
* page.drawSvg(pdfSvg, { x: 25, y: 75 })
|
|
1382
|
+
* ```
|
|
1383
|
+
* @param svg The SVG to be drawn.
|
|
1384
|
+
* @param options The options to be used when drawing the SVG.
|
|
1385
|
+
*/
|
|
1386
|
+
drawSvg(svg, options = {}) {
|
|
1387
|
+
var _a, _b;
|
|
1388
|
+
(0, utils_1.assertIs)(svg, 'svg', ['string', [PDFSvg_1.default, 'PDFSvg']]);
|
|
1389
|
+
(0, utils_1.assertOrUndefined)(options.x, 'options.x', ['number']);
|
|
1390
|
+
(0, utils_1.assertOrUndefined)(options.y, 'options.y', ['number']);
|
|
1391
|
+
(0, utils_1.assertOrUndefined)(options.width, 'options.width', ['number']);
|
|
1392
|
+
(0, utils_1.assertOrUndefined)(options.height, 'options.height', ['number']);
|
|
1393
|
+
(0, utils_1.assertIsOneOfOrUndefined)(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1394
|
+
(0, svg_1.drawSvg)(this, svg, {
|
|
1395
|
+
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1396
|
+
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1397
|
+
fonts: options.fonts,
|
|
1398
|
+
width: options.width,
|
|
1399
|
+
height: options.height,
|
|
1400
|
+
blendMode: options.blendMode,
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
getFont() {
|
|
1349
1404
|
if (!this.font || !this.fontKey) {
|
|
1350
|
-
|
|
1405
|
+
const font = this.doc.embedStandardFont(StandardFonts_1.StandardFonts.Helvetica);
|
|
1351
1406
|
this.setFont(font);
|
|
1352
1407
|
}
|
|
1353
1408
|
return [this.font, this.fontKey];
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1409
|
+
}
|
|
1410
|
+
resetFont() {
|
|
1356
1411
|
this.font = undefined;
|
|
1357
1412
|
this.fontKey = undefined;
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
if (useExisting === void 0) { useExisting = true; }
|
|
1413
|
+
}
|
|
1414
|
+
getContentStream(useExisting = true) {
|
|
1361
1415
|
if (useExisting && this.contentStream)
|
|
1362
1416
|
return this.contentStream;
|
|
1363
1417
|
this.contentStream = this.createContentStream();
|
|
1364
1418
|
this.contentStreamRef = this.doc.context.register(this.contentStream);
|
|
1365
1419
|
this.node.addContentStream(this.contentStreamRef);
|
|
1366
1420
|
return this.contentStream;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
operators[_i] = arguments[_i];
|
|
1372
|
-
}
|
|
1373
|
-
var dict = this.doc.context.obj({});
|
|
1374
|
-
var contentStream = core_1.PDFContentStream.of(dict, operators);
|
|
1421
|
+
}
|
|
1422
|
+
createContentStream(...operators) {
|
|
1423
|
+
const dict = this.doc.context.obj({});
|
|
1424
|
+
const contentStream = core_1.PDFContentStream.of(dict, operators);
|
|
1375
1425
|
return contentStream;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1426
|
+
}
|
|
1427
|
+
maybeEmbedGraphicsState(options) {
|
|
1428
|
+
const { opacity, borderOpacity, blendMode } = options;
|
|
1379
1429
|
if (opacity === undefined &&
|
|
1380
1430
|
borderOpacity === undefined &&
|
|
1381
1431
|
blendMode === undefined) {
|
|
1382
1432
|
return undefined;
|
|
1383
1433
|
}
|
|
1384
|
-
|
|
1434
|
+
const graphicsState = this.doc.context.obj({
|
|
1385
1435
|
Type: 'ExtGState',
|
|
1386
1436
|
ca: opacity,
|
|
1387
1437
|
CA: borderOpacity,
|
|
1388
1438
|
BM: blendMode,
|
|
1389
1439
|
});
|
|
1390
|
-
|
|
1440
|
+
const key = this.node.newExtGState('GS', graphicsState);
|
|
1391
1441
|
return key;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
for (
|
|
1396
|
-
|
|
1442
|
+
}
|
|
1443
|
+
scaleAnnot(annot, x, y) {
|
|
1444
|
+
const selectors = ['RD', 'CL', 'Vertices', 'QuadPoints', 'L', 'Rect'];
|
|
1445
|
+
for (let idx = 0, len = selectors.length; idx < len; idx++) {
|
|
1446
|
+
const list = annot.lookup(core_1.PDFName.of(selectors[idx]));
|
|
1397
1447
|
if (list instanceof core_1.PDFArray)
|
|
1398
1448
|
list.scalePDFNumbers(x, y);
|
|
1399
1449
|
}
|
|
1400
|
-
|
|
1450
|
+
const inkLists = annot.lookup(core_1.PDFName.of('InkList'));
|
|
1401
1451
|
if (inkLists instanceof core_1.PDFArray) {
|
|
1402
|
-
for (
|
|
1403
|
-
|
|
1452
|
+
for (let idx = 0, len = inkLists.size(); idx < len; idx++) {
|
|
1453
|
+
const arr = inkLists.lookup(idx);
|
|
1404
1454
|
if (arr instanceof core_1.PDFArray)
|
|
1405
1455
|
arr.scalePDFNumbers(x, y);
|
|
1406
1456
|
}
|
|
1407
1457
|
}
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
* > **NOTE:** You probably don't want to call this method directly. Instead,
|
|
1411
|
-
* > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]
|
|
1412
|
-
* > methods, which can create instances of [[PDFPage]] for you.
|
|
1413
|
-
*
|
|
1414
|
-
* Create an instance of [[PDFPage]] from an existing leaf node.
|
|
1415
|
-
*
|
|
1416
|
-
* @param leafNode The leaf node to be wrapped.
|
|
1417
|
-
* @param ref The unique reference for the page.
|
|
1418
|
-
* @param doc The document to which the page will belong.
|
|
1419
|
-
*/
|
|
1420
|
-
PDFPage.of = function (leafNode, ref, doc) {
|
|
1421
|
-
return new PDFPage(leafNode, ref, doc);
|
|
1422
|
-
};
|
|
1423
|
-
/**
|
|
1424
|
-
* > **NOTE:** You probably don't want to call this method directly. Instead,
|
|
1425
|
-
* > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]
|
|
1426
|
-
* > methods, which can create instances of [[PDFPage]] for you.
|
|
1427
|
-
*
|
|
1428
|
-
* Create an instance of [[PDFPage]].
|
|
1429
|
-
*
|
|
1430
|
-
* @param doc The document to which the page will belong.
|
|
1431
|
-
*/
|
|
1432
|
-
PDFPage.create = function (doc) {
|
|
1433
|
-
utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]);
|
|
1434
|
-
var dummyRef = core_1.PDFRef.of(-1);
|
|
1435
|
-
var pageLeaf = core_1.PDFPageLeaf.withContextAndParent(doc.context, dummyRef);
|
|
1436
|
-
var pageRef = doc.context.register(pageLeaf);
|
|
1437
|
-
return new PDFPage(pageLeaf, pageRef, doc);
|
|
1438
|
-
};
|
|
1439
|
-
return PDFPage;
|
|
1440
|
-
}());
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1441
1460
|
exports.default = PDFPage;
|
|
1461
|
+
/**
|
|
1462
|
+
* > **NOTE:** You probably don't want to call this method directly. Instead,
|
|
1463
|
+
* > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]
|
|
1464
|
+
* > methods, which can create instances of [[PDFPage]] for you.
|
|
1465
|
+
*
|
|
1466
|
+
* Create an instance of [[PDFPage]] from an existing leaf node.
|
|
1467
|
+
*
|
|
1468
|
+
* @param leafNode The leaf node to be wrapped.
|
|
1469
|
+
* @param ref The unique reference for the page.
|
|
1470
|
+
* @param doc The document to which the page will belong.
|
|
1471
|
+
*/
|
|
1472
|
+
PDFPage.of = (leafNode, ref, doc) => new PDFPage(leafNode, ref, doc);
|
|
1473
|
+
/**
|
|
1474
|
+
* > **NOTE:** You probably don't want to call this method directly. Instead,
|
|
1475
|
+
* > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]
|
|
1476
|
+
* > methods, which can create instances of [[PDFPage]] for you.
|
|
1477
|
+
*
|
|
1478
|
+
* Create an instance of [[PDFPage]].
|
|
1479
|
+
*
|
|
1480
|
+
* @param doc The document to which the page will belong.
|
|
1481
|
+
*/
|
|
1482
|
+
PDFPage.create = (doc) => {
|
|
1483
|
+
(0, utils_1.assertIs)(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]);
|
|
1484
|
+
const dummyRef = core_1.PDFRef.of(-1);
|
|
1485
|
+
const pageLeaf = core_1.PDFPageLeaf.withContextAndParent(doc.context, dummyRef);
|
|
1486
|
+
const pageRef = doc.context.register(pageLeaf);
|
|
1487
|
+
return new PDFPage(pageLeaf, pageRef, doc);
|
|
1488
|
+
};
|
|
1442
1489
|
//# sourceMappingURL=PDFPage.js.map
|