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