@adnsistemas/pdf-lib 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +1713 -0
- package/cjs/api/Embeddable.d.ts +8 -0
- package/cjs/api/Embeddable.d.ts.map +1 -0
- package/cjs/api/Embeddable.js +3 -0
- package/cjs/api/Embeddable.js.map +1 -0
- package/cjs/api/PDFDocument.d.ts +800 -0
- package/cjs/api/PDFDocument.d.ts.map +1 -0
- package/cjs/api/PDFDocument.js +1454 -0
- package/cjs/api/PDFDocument.js.map +1 -0
- package/cjs/api/PDFDocumentOptions.d.ts +43 -0
- package/cjs/api/PDFDocumentOptions.d.ts.map +1 -0
- package/cjs/api/PDFDocumentOptions.js +11 -0
- package/cjs/api/PDFDocumentOptions.js.map +1 -0
- package/cjs/api/PDFEmbeddedFile.d.ts +39 -0
- package/cjs/api/PDFEmbeddedFile.d.ts.map +1 -0
- package/cjs/api/PDFEmbeddedFile.js +84 -0
- package/cjs/api/PDFEmbeddedFile.js.map +1 -0
- package/cjs/api/PDFEmbeddedPage.d.ts +74 -0
- package/cjs/api/PDFEmbeddedPage.d.ts.map +1 -0
- package/cjs/api/PDFEmbeddedPage.js +95 -0
- package/cjs/api/PDFEmbeddedPage.js.map +1 -0
- package/cjs/api/PDFFont.d.ts +95 -0
- package/cjs/api/PDFFont.d.ts.map +1 -0
- package/cjs/api/PDFFont.js +143 -0
- package/cjs/api/PDFFont.js.map +1 -0
- package/cjs/api/PDFImage.d.ts +96 -0
- package/cjs/api/PDFImage.d.ts.map +1 -0
- package/cjs/api/PDFImage.js +132 -0
- package/cjs/api/PDFImage.js.map +1 -0
- package/cjs/api/PDFJavaScript.d.ts +39 -0
- package/cjs/api/PDFJavaScript.d.ts.map +1 -0
- package/cjs/api/PDFJavaScript.js +73 -0
- package/cjs/api/PDFJavaScript.js.map +1 -0
- package/cjs/api/PDFPage.d.ts +898 -0
- package/cjs/api/PDFPage.d.ts.map +1 -0
- package/cjs/api/PDFPage.js +1442 -0
- package/cjs/api/PDFPage.js.map +1 -0
- package/cjs/api/PDFPageOptions.d.ts +155 -0
- package/cjs/api/PDFPageOptions.d.ts.map +1 -0
- package/cjs/api/PDFPageOptions.js +19 -0
- package/cjs/api/PDFPageOptions.js.map +1 -0
- package/cjs/api/StandardFonts.d.ts +17 -0
- package/cjs/api/StandardFonts.d.ts.map +1 -0
- package/cjs/api/StandardFonts.js +21 -0
- package/cjs/api/StandardFonts.js.map +1 -0
- package/cjs/api/colors.d.ts +31 -0
- package/cjs/api/colors.d.ts.map +1 -0
- package/cjs/api/colors.js +59 -0
- package/cjs/api/colors.js.map +1 -0
- package/cjs/api/errors.d.ts +43 -0
- package/cjs/api/errors.d.ts.map +1 -0
- package/cjs/api/errors.js +168 -0
- package/cjs/api/errors.js.map +1 -0
- package/cjs/api/form/PDFButton.d.ts +138 -0
- package/cjs/api/form/PDFButton.d.ts.map +1 -0
- package/cjs/api/form/PDFButton.js +220 -0
- package/cjs/api/form/PDFButton.js.map +1 -0
- package/cjs/api/form/PDFCheckBox.d.ts +143 -0
- package/cjs/api/form/PDFCheckBox.d.ts.map +1 -0
- package/cjs/api/form/PDFCheckBox.js +236 -0
- package/cjs/api/form/PDFCheckBox.js.map +1 -0
- package/cjs/api/form/PDFDropdown.d.ts +403 -0
- package/cjs/api/form/PDFDropdown.d.ts.map +1 -0
- package/cjs/api/form/PDFDropdown.js +580 -0
- package/cjs/api/form/PDFDropdown.js.map +1 -0
- package/cjs/api/form/PDFField.d.ts +204 -0
- package/cjs/api/form/PDFField.d.ts.map +1 -0
- package/cjs/api/form/PDFField.js +384 -0
- package/cjs/api/form/PDFField.js.map +1 -0
- package/cjs/api/form/PDFForm.d.ts +412 -0
- package/cjs/api/form/PDFForm.d.ts.map +1 -0
- package/cjs/api/form/PDFForm.js +726 -0
- package/cjs/api/form/PDFForm.js.map +1 -0
- package/cjs/api/form/PDFOptionList.d.ts +336 -0
- package/cjs/api/form/PDFOptionList.d.ts.map +1 -0
- package/cjs/api/form/PDFOptionList.js +499 -0
- package/cjs/api/form/PDFOptionList.js.map +1 -0
- package/cjs/api/form/PDFRadioGroup.d.ts +253 -0
- package/cjs/api/form/PDFRadioGroup.d.ts.map +1 -0
- package/cjs/api/form/PDFRadioGroup.js +415 -0
- package/cjs/api/form/PDFRadioGroup.js.map +1 -0
- package/cjs/api/form/PDFSignature.d.ts +30 -0
- package/cjs/api/form/PDFSignature.d.ts.map +1 -0
- package/cjs/api/form/PDFSignature.js +43 -0
- package/cjs/api/form/PDFSignature.js.map +1 -0
- package/cjs/api/form/PDFTextField.d.ts +538 -0
- package/cjs/api/form/PDFTextField.d.ts.map +1 -0
- package/cjs/api/form/PDFTextField.js +739 -0
- package/cjs/api/form/PDFTextField.js.map +1 -0
- package/cjs/api/form/appearances.d.ts +42 -0
- package/cjs/api/form/appearances.d.ts.map +1 -0
- package/cjs/api/form/appearances.js +421 -0
- package/cjs/api/form/appearances.js.map +1 -0
- package/cjs/api/form/index.d.ts +11 -0
- package/cjs/api/form/index.d.ts.map +1 -0
- package/cjs/api/form/index.js +23 -0
- package/cjs/api/form/index.js.map +1 -0
- package/cjs/api/image/alignment.d.ts +6 -0
- package/cjs/api/image/alignment.d.ts.map +1 -0
- package/cjs/api/image/alignment.js +10 -0
- package/cjs/api/image/alignment.js.map +1 -0
- package/cjs/api/image/index.d.ts +2 -0
- package/cjs/api/image/index.d.ts.map +1 -0
- package/cjs/api/image/index.js +5 -0
- package/cjs/api/image/index.js.map +1 -0
- package/cjs/api/index.d.ts +22 -0
- package/cjs/api/index.d.ts.map +1 -0
- package/cjs/api/index.js +30 -0
- package/cjs/api/index.js.map +1 -0
- package/cjs/api/objects.d.ts +5 -0
- package/cjs/api/objects.d.ts.map +1 -0
- package/cjs/api/objects.js +14 -0
- package/cjs/api/objects.js.map +1 -0
- package/cjs/api/operations.d.ts +212 -0
- package/cjs/api/operations.d.ts.map +1 -0
- package/cjs/api/operations.js +488 -0
- package/cjs/api/operations.js.map +1 -0
- package/cjs/api/operators.d.ts +86 -0
- package/cjs/api/operators.d.ts.map +1 -0
- package/cjs/api/operators.js +231 -0
- package/cjs/api/operators.js.map +1 -0
- package/cjs/api/rotations.d.ts +39 -0
- package/cjs/api/rotations.d.ts.map +1 -0
- package/cjs/api/rotations.js +71 -0
- package/cjs/api/rotations.js.map +1 -0
- package/cjs/api/sizes.d.ts +53 -0
- package/cjs/api/sizes.d.ts.map +1 -0
- package/cjs/api/sizes.js +56 -0
- package/cjs/api/sizes.js.map +1 -0
- package/cjs/api/snapshot/DefaultDocumentSnapshot.d.ts +13 -0
- package/cjs/api/snapshot/DefaultDocumentSnapshot.d.ts.map +1 -0
- package/cjs/api/snapshot/DefaultDocumentSnapshot.js +28 -0
- package/cjs/api/snapshot/DefaultDocumentSnapshot.js.map +1 -0
- package/cjs/api/snapshot/DocumentSnapshot.d.ts +11 -0
- package/cjs/api/snapshot/DocumentSnapshot.d.ts.map +1 -0
- package/cjs/api/snapshot/DocumentSnapshot.js +3 -0
- package/cjs/api/snapshot/DocumentSnapshot.js.map +1 -0
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.d.ts +16 -0
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.d.ts.map +1 -0
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.js +44 -0
- package/cjs/api/snapshot/IncrementalDocumentSnapshot.js.map +1 -0
- package/cjs/api/snapshot/index.d.ts +4 -0
- package/cjs/api/snapshot/index.d.ts.map +1 -0
- package/cjs/api/snapshot/index.js +7 -0
- package/cjs/api/snapshot/index.js.map +1 -0
- package/cjs/api/svgPath.d.ts +3 -0
- package/cjs/api/svgPath.d.ts.map +1 -0
- package/cjs/api/svgPath.js +380 -0
- package/cjs/api/svgPath.js.map +1 -0
- package/cjs/api/text/alignment.d.ts +6 -0
- package/cjs/api/text/alignment.d.ts.map +1 -0
- package/cjs/api/text/alignment.js +10 -0
- package/cjs/api/text/alignment.js.map +1 -0
- package/cjs/api/text/index.d.ts +3 -0
- package/cjs/api/text/index.d.ts.map +1 -0
- package/cjs/api/text/index.js +6 -0
- package/cjs/api/text/index.js.map +1 -0
- package/cjs/api/text/layout.d.ts +55 -0
- package/cjs/api/text/layout.d.ts.map +1 -0
- package/cjs/api/text/layout.js +212 -0
- package/cjs/api/text/layout.js.map +1 -0
- package/cjs/core/PDFContext.d.ts +93 -0
- package/cjs/core/PDFContext.d.ts.map +1 -0
- package/cjs/core/PDFContext.js +210 -0
- package/cjs/core/PDFContext.js.map +1 -0
- package/cjs/core/PDFObjectCopier.d.ts +38 -0
- package/cjs/core/PDFObjectCopier.d.ts.map +1 -0
- package/cjs/core/PDFObjectCopier.js +119 -0
- package/cjs/core/PDFObjectCopier.js.map +1 -0
- package/cjs/core/acroform/PDFAcroButton.d.ts +22 -0
- package/cjs/core/acroform/PDFAcroButton.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroButton.js +96 -0
- package/cjs/core/acroform/PDFAcroButton.js.map +1 -0
- package/cjs/core/acroform/PDFAcroCheckBox.d.ts +14 -0
- package/cjs/core/acroform/PDFAcroCheckBox.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroCheckBox.js +50 -0
- package/cjs/core/acroform/PDFAcroCheckBox.js.map +1 -0
- package/cjs/core/acroform/PDFAcroChoice.d.ts +21 -0
- package/cjs/core/acroform/PDFAcroChoice.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroChoice.js +127 -0
- package/cjs/core/acroform/PDFAcroChoice.js.map +1 -0
- package/cjs/core/acroform/PDFAcroComboBox.d.ts +10 -0
- package/cjs/core/acroform/PDFAcroComboBox.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroComboBox.js +26 -0
- package/cjs/core/acroform/PDFAcroComboBox.js.map +1 -0
- package/cjs/core/acroform/PDFAcroField.d.ts +37 -0
- package/cjs/core/acroform/PDFAcroField.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroField.js +149 -0
- package/cjs/core/acroform/PDFAcroField.js.map +1 -0
- package/cjs/core/acroform/PDFAcroForm.d.ts +21 -0
- package/cjs/core/acroform/PDFAcroForm.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroForm.js +78 -0
- package/cjs/core/acroform/PDFAcroForm.js.map +1 -0
- package/cjs/core/acroform/PDFAcroListBox.d.ts +10 -0
- package/cjs/core/acroform/PDFAcroListBox.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroListBox.js +24 -0
- package/cjs/core/acroform/PDFAcroListBox.js.map +1 -0
- package/cjs/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
- package/cjs/core/acroform/PDFAcroNonTerminal.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroNonTerminal.js +34 -0
- package/cjs/core/acroform/PDFAcroNonTerminal.js.map +1 -0
- package/cjs/core/acroform/PDFAcroPushButton.d.ts +10 -0
- package/cjs/core/acroform/PDFAcroPushButton.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroPushButton.js +26 -0
- package/cjs/core/acroform/PDFAcroPushButton.js.map +1 -0
- package/cjs/core/acroform/PDFAcroRadioButton.d.ts +14 -0
- package/cjs/core/acroform/PDFAcroRadioButton.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroRadioButton.js +57 -0
- package/cjs/core/acroform/PDFAcroRadioButton.js.map +1 -0
- package/cjs/core/acroform/PDFAcroSignature.d.ts +8 -0
- package/cjs/core/acroform/PDFAcroSignature.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroSignature.js +16 -0
- package/cjs/core/acroform/PDFAcroSignature.js.map +1 -0
- package/cjs/core/acroform/PDFAcroTerminal.d.ts +17 -0
- package/cjs/core/acroform/PDFAcroTerminal.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroTerminal.js +70 -0
- package/cjs/core/acroform/PDFAcroTerminal.js.map +1 -0
- package/cjs/core/acroform/PDFAcroText.d.ts +23 -0
- package/cjs/core/acroform/PDFAcroText.d.ts.map +1 -0
- package/cjs/core/acroform/PDFAcroText.js +73 -0
- package/cjs/core/acroform/PDFAcroText.js.map +1 -0
- package/cjs/core/acroform/flags.d.ts +142 -0
- package/cjs/core/acroform/flags.d.ts.map +1 -0
- package/cjs/core/acroform/flags.js +150 -0
- package/cjs/core/acroform/flags.js.map +1 -0
- package/cjs/core/acroform/index.d.ts +16 -0
- package/cjs/core/acroform/index.d.ts.map +1 -0
- package/cjs/core/acroform/index.js +32 -0
- package/cjs/core/acroform/index.js.map +1 -0
- package/cjs/core/acroform/utils.d.ts +7 -0
- package/cjs/core/acroform/utils.d.ts.map +1 -0
- package/cjs/core/acroform/utils.js +127 -0
- package/cjs/core/acroform/utils.js.map +1 -0
- package/cjs/core/annotation/AppearanceCharacteristics.d.ts +34 -0
- package/cjs/core/annotation/AppearanceCharacteristics.d.ts.map +1 -0
- package/cjs/core/annotation/AppearanceCharacteristics.js +123 -0
- package/cjs/core/annotation/AppearanceCharacteristics.js.map +1 -0
- package/cjs/core/annotation/BorderStyle.d.ts +12 -0
- package/cjs/core/annotation/BorderStyle.d.ts.map +1 -0
- package/cjs/core/annotation/BorderStyle.js +29 -0
- package/cjs/core/annotation/BorderStyle.js.map +1 -0
- package/cjs/core/annotation/PDFAnnotation.d.ts +52 -0
- package/cjs/core/annotation/PDFAnnotation.d.ts.map +1 -0
- package/cjs/core/annotation/PDFAnnotation.js +123 -0
- package/cjs/core/annotation/PDFAnnotation.js.map +1 -0
- package/cjs/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
- package/cjs/core/annotation/PDFWidgetAnnotation.d.ts.map +1 -0
- package/cjs/core/annotation/PDFWidgetAnnotation.js +110 -0
- package/cjs/core/annotation/PDFWidgetAnnotation.js.map +1 -0
- package/cjs/core/annotation/flags.d.ts +80 -0
- package/cjs/core/annotation/flags.d.ts.map +1 -0
- package/cjs/core/annotation/flags.js +85 -0
- package/cjs/core/annotation/flags.js.map +1 -0
- package/cjs/core/annotation/index.d.ts +5 -0
- package/cjs/core/annotation/index.d.ts.map +1 -0
- package/cjs/core/annotation/index.js +11 -0
- package/cjs/core/annotation/index.js.map +1 -0
- package/cjs/core/document/PDFCrossRefSection.d.ts +28 -0
- package/cjs/core/document/PDFCrossRefSection.d.ts.map +1 -0
- package/cjs/core/document/PDFCrossRefSection.js +124 -0
- package/cjs/core/document/PDFCrossRefSection.js.map +1 -0
- package/cjs/core/document/PDFHeader.d.ts +11 -0
- package/cjs/core/document/PDFHeader.d.ts.map +1 -0
- package/cjs/core/document/PDFHeader.js +42 -0
- package/cjs/core/document/PDFHeader.js.map +1 -0
- package/cjs/core/document/PDFTrailer.d.ts +10 -0
- package/cjs/core/document/PDFTrailer.d.ts.map +1 -0
- package/cjs/core/document/PDFTrailer.js +43 -0
- package/cjs/core/document/PDFTrailer.js.map +1 -0
- package/cjs/core/document/PDFTrailerDict.d.ts +11 -0
- package/cjs/core/document/PDFTrailerDict.d.ts.map +1 -0
- package/cjs/core/document/PDFTrailerDict.js +32 -0
- package/cjs/core/document/PDFTrailerDict.js.map +1 -0
- package/cjs/core/embedders/CMap.d.ts +4 -0
- package/cjs/core/embedders/CMap.d.ts.map +1 -0
- package/cjs/core/embedders/CMap.js +43 -0
- package/cjs/core/embedders/CMap.js.map +1 -0
- package/cjs/core/embedders/CustomFontEmbedder.d.ts +45 -0
- package/cjs/core/embedders/CustomFontEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/CustomFontEmbedder.js +240 -0
- package/cjs/core/embedders/CustomFontEmbedder.js.map +1 -0
- package/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
- package/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/CustomFontSubsetEmbedder.js +68 -0
- package/cjs/core/embedders/CustomFontSubsetEmbedder.js.map +1 -0
- package/cjs/core/embedders/FileEmbedder.d.ts +34 -0
- package/cjs/core/embedders/FileEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/FileEmbedder.js +75 -0
- package/cjs/core/embedders/FileEmbedder.js.map +1 -0
- package/cjs/core/embedders/FontFlags.d.ts +14 -0
- package/cjs/core/embedders/FontFlags.d.ts.map +1 -0
- package/cjs/core/embedders/FontFlags.js +40 -0
- package/cjs/core/embedders/FontFlags.js.map +1 -0
- package/cjs/core/embedders/JavaScriptEmbedder.d.ts +11 -0
- package/cjs/core/embedders/JavaScriptEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/JavaScriptEmbedder.js +36 -0
- package/cjs/core/embedders/JavaScriptEmbedder.js.map +1 -0
- package/cjs/core/embedders/JpegEmbedder.d.ts +24 -0
- package/cjs/core/embedders/JpegEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/JpegEmbedder.js +107 -0
- package/cjs/core/embedders/JpegEmbedder.js.map +1 -0
- package/cjs/core/embedders/PDFPageEmbedder.d.ts +38 -0
- package/cjs/core/embedders/PDFPageEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/PDFPageEmbedder.js +91 -0
- package/cjs/core/embedders/PDFPageEmbedder.js.map +1 -0
- package/cjs/core/embedders/PngEmbedder.d.ts +20 -0
- package/cjs/core/embedders/PngEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/PngEmbedder.js +69 -0
- package/cjs/core/embedders/PngEmbedder.js.map +1 -0
- package/cjs/core/embedders/StandardFontEmbedder.d.ts +37 -0
- package/cjs/core/embedders/StandardFontEmbedder.d.ts.map +1 -0
- package/cjs/core/embedders/StandardFontEmbedder.js +98 -0
- package/cjs/core/embedders/StandardFontEmbedder.js.map +1 -0
- package/cjs/core/errors.d.ts +92 -0
- package/cjs/core/errors.d.ts.map +1 -0
- package/cjs/core/errors.js +323 -0
- package/cjs/core/errors.js.map +1 -0
- package/cjs/core/index.d.ts +48 -0
- package/cjs/core/index.d.ts.map +1 -0
- package/cjs/core/index.js +100 -0
- package/cjs/core/index.js.map +1 -0
- package/cjs/core/interactive/ViewerPreferences.d.ts +348 -0
- package/cjs/core/interactive/ViewerPreferences.d.ts.map +1 -0
- package/cjs/core/interactive/ViewerPreferences.js +511 -0
- package/cjs/core/interactive/ViewerPreferences.js.map +1 -0
- package/cjs/core/objects/PDFArray.d.ts +64 -0
- package/cjs/core/objects/PDFArray.d.ts.map +1 -0
- package/cjs/core/objects/PDFArray.js +117 -0
- package/cjs/core/objects/PDFArray.js.map +1 -0
- package/cjs/core/objects/PDFBool.d.ts +14 -0
- package/cjs/core/objects/PDFBool.d.ts.map +1 -0
- package/cjs/core/objects/PDFBool.js +52 -0
- package/cjs/core/objects/PDFBool.js.map +1 -0
- package/cjs/core/objects/PDFDict.d.ts +63 -0
- package/cjs/core/objects/PDFDict.d.ts.map +1 -0
- package/cjs/core/objects/PDFDict.js +143 -0
- package/cjs/core/objects/PDFDict.js.map +1 -0
- package/cjs/core/objects/PDFHexString.d.ts +17 -0
- package/cjs/core/objects/PDFHexString.d.ts.map +1 -0
- package/cjs/core/objects/PDFHexString.js +74 -0
- package/cjs/core/objects/PDFHexString.js.map +1 -0
- package/cjs/core/objects/PDFInvalidObject.d.ts +12 -0
- package/cjs/core/objects/PDFInvalidObject.d.ts.map +1 -0
- package/cjs/core/objects/PDFInvalidObject.js +32 -0
- package/cjs/core/objects/PDFInvalidObject.js.map +1 -0
- package/cjs/core/objects/PDFName.d.ts +42 -0
- package/cjs/core/objects/PDFName.d.ts.map +1 -0
- package/cjs/core/objects/PDFName.js +138 -0
- package/cjs/core/objects/PDFName.js.map +1 -0
- package/cjs/core/objects/PDFNull.d.ts +11 -0
- package/cjs/core/objects/PDFNull.d.ts.map +1 -0
- package/cjs/core/objects/PDFNull.js +33 -0
- package/cjs/core/objects/PDFNull.js.map +1 -0
- package/cjs/core/objects/PDFNumber.d.ts +16 -0
- package/cjs/core/objects/PDFNumber.d.ts.map +1 -0
- package/cjs/core/objects/PDFNumber.js +38 -0
- package/cjs/core/objects/PDFNumber.js.map +1 -0
- package/cjs/core/objects/PDFObject.d.ts +10 -0
- package/cjs/core/objects/PDFObject.d.ts.map +1 -0
- package/cjs/core/objects/PDFObject.js +25 -0
- package/cjs/core/objects/PDFObject.js.map +1 -0
- package/cjs/core/objects/PDFRawStream.d.ts +15 -0
- package/cjs/core/objects/PDFRawStream.d.ts.map +1 -0
- package/cjs/core/objects/PDFRawStream.js +34 -0
- package/cjs/core/objects/PDFRawStream.js.map +1 -0
- package/cjs/core/objects/PDFRef.d.ts +14 -0
- package/cjs/core/objects/PDFRef.d.ts.map +1 -0
- package/cjs/core/objects/PDFRef.js +47 -0
- package/cjs/core/objects/PDFRef.js.map +1 -0
- package/cjs/core/objects/PDFStream.d.ts +17 -0
- package/cjs/core/objects/PDFStream.d.ts.map +1 -0
- package/cjs/core/objects/PDFStream.js +75 -0
- package/cjs/core/objects/PDFStream.js.map +1 -0
- package/cjs/core/objects/PDFString.d.ts +17 -0
- package/cjs/core/objects/PDFString.d.ts.map +1 -0
- package/cjs/core/objects/PDFString.js +116 -0
- package/cjs/core/objects/PDFString.js.map +1 -0
- package/cjs/core/operators/PDFOperator.d.ts +20 -0
- package/cjs/core/operators/PDFOperator.d.ts.map +1 -0
- package/cjs/core/operators/PDFOperator.js +58 -0
- package/cjs/core/operators/PDFOperator.js.map +1 -0
- package/cjs/core/operators/PDFOperatorNames.d.ts +77 -0
- package/cjs/core/operators/PDFOperatorNames.d.ts.map +1 -0
- package/cjs/core/operators/PDFOperatorNames.js +88 -0
- package/cjs/core/operators/PDFOperatorNames.js.map +1 -0
- package/cjs/core/parser/BaseParser.d.ts +15 -0
- package/cjs/core/parser/BaseParser.d.ts.map +1 -0
- package/cjs/core/parser/BaseParser.js +110 -0
- package/cjs/core/parser/BaseParser.js.map +1 -0
- package/cjs/core/parser/ByteStream.d.ts +27 -0
- package/cjs/core/parser/ByteStream.d.ts.map +1 -0
- package/cjs/core/parser/ByteStream.js +64 -0
- package/cjs/core/parser/ByteStream.js.map +1 -0
- package/cjs/core/parser/PDFObjectParser.d.ts +30 -0
- package/cjs/core/parser/PDFObjectParser.d.ts.map +1 -0
- package/cjs/core/parser/PDFObjectParser.js +233 -0
- package/cjs/core/parser/PDFObjectParser.js.map +1 -0
- package/cjs/core/parser/PDFObjectStreamParser.d.ts +14 -0
- package/cjs/core/parser/PDFObjectStreamParser.d.ts.map +1 -0
- package/cjs/core/parser/PDFObjectStreamParser.js +70 -0
- package/cjs/core/parser/PDFObjectStreamParser.js.map +1 -0
- package/cjs/core/parser/PDFParser.d.ts +46 -0
- package/cjs/core/parser/PDFParser.d.ts.map +1 -0
- package/cjs/core/parser/PDFParser.js +362 -0
- package/cjs/core/parser/PDFParser.js.map +1 -0
- package/cjs/core/parser/PDFXRefStreamParser.d.ts +22 -0
- package/cjs/core/parser/PDFXRefStreamParser.d.ts.map +1 -0
- package/cjs/core/parser/PDFXRefStreamParser.js +93 -0
- package/cjs/core/parser/PDFXRefStreamParser.js.map +1 -0
- package/cjs/core/streams/Ascii85Stream.d.ts +10 -0
- package/cjs/core/streams/Ascii85Stream.d.ts.map +1 -0
- package/cjs/core/streams/Ascii85Stream.js +87 -0
- package/cjs/core/streams/Ascii85Stream.js.map +1 -0
- package/cjs/core/streams/AsciiHexStream.d.ts +10 -0
- package/cjs/core/streams/AsciiHexStream.d.ts.map +1 -0
- package/cjs/core/streams/AsciiHexStream.js +75 -0
- package/cjs/core/streams/AsciiHexStream.js.map +1 -0
- package/cjs/core/streams/DecodeStream.d.ts +27 -0
- package/cjs/core/streams/DecodeStream.d.ts.map +1 -0
- package/cjs/core/streams/DecodeStream.js +149 -0
- package/cjs/core/streams/DecodeStream.js.map +1 -0
- package/cjs/core/streams/FlateStream.d.ts +14 -0
- package/cjs/core/streams/FlateStream.d.ts.map +1 -0
- package/cjs/core/streams/FlateStream.js +371 -0
- package/cjs/core/streams/FlateStream.js.map +1 -0
- package/cjs/core/streams/LZWStream.d.ts +13 -0
- package/cjs/core/streams/LZWStream.d.ts.map +1 -0
- package/cjs/core/streams/LZWStream.js +137 -0
- package/cjs/core/streams/LZWStream.js.map +1 -0
- package/cjs/core/streams/RunLengthStream.d.ts +9 -0
- package/cjs/core/streams/RunLengthStream.d.ts.map +1 -0
- package/cjs/core/streams/RunLengthStream.js +55 -0
- package/cjs/core/streams/RunLengthStream.js.map +1 -0
- package/cjs/core/streams/Stream.d.ts +35 -0
- package/cjs/core/streams/Stream.d.ts.map +1 -0
- package/cjs/core/streams/Stream.js +106 -0
- package/cjs/core/streams/Stream.js.map +1 -0
- package/cjs/core/streams/decode.d.ts +4 -0
- package/cjs/core/streams/decode.d.ts.map +1 -0
- package/cjs/core/streams/decode.js +59 -0
- package/cjs/core/streams/decode.js.map +1 -0
- package/cjs/core/structures/PDFCatalog.d.ts +28 -0
- package/cjs/core/structures/PDFCatalog.d.ts.map +1 -0
- package/cjs/core/structures/PDFCatalog.js +79 -0
- package/cjs/core/structures/PDFCatalog.js.map +1 -0
- package/cjs/core/structures/PDFContentStream.d.ts +16 -0
- package/cjs/core/structures/PDFContentStream.d.ts.map +1 -0
- package/cjs/core/structures/PDFContentStream.js +60 -0
- package/cjs/core/structures/PDFContentStream.js.map +1 -0
- package/cjs/core/structures/PDFCrossRefStream.d.ts +54 -0
- package/cjs/core/structures/PDFCrossRefStream.d.ts.map +1 -0
- package/cjs/core/structures/PDFCrossRefStream.js +187 -0
- package/cjs/core/structures/PDFCrossRefStream.js.map +1 -0
- package/cjs/core/structures/PDFFlateStream.d.ts +14 -0
- package/cjs/core/structures/PDFFlateStream.d.ts.map +1 -0
- package/cjs/core/structures/PDFFlateStream.js +35 -0
- package/cjs/core/structures/PDFFlateStream.js.map +1 -0
- package/cjs/core/structures/PDFObjectStream.d.ts +21 -0
- package/cjs/core/structures/PDFObjectStream.d.ts.map +1 -0
- package/cjs/core/structures/PDFObjectStream.js +77 -0
- package/cjs/core/structures/PDFObjectStream.js.map +1 -0
- package/cjs/core/structures/PDFPageLeaf.d.ts +55 -0
- package/cjs/core/structures/PDFPageLeaf.d.ts.map +1 -0
- package/cjs/core/structures/PDFPageLeaf.js +208 -0
- package/cjs/core/structures/PDFPageLeaf.js.map +1 -0
- package/cjs/core/structures/PDFPageTree.d.ts +42 -0
- package/cjs/core/structures/PDFPageTree.d.ts.map +1 -0
- package/cjs/core/structures/PDFPageTree.js +177 -0
- package/cjs/core/structures/PDFPageTree.js.map +1 -0
- package/cjs/core/syntax/CharCodes.d.ts +62 -0
- package/cjs/core/syntax/CharCodes.d.ts.map +1 -0
- package/cjs/core/syntax/CharCodes.js +65 -0
- package/cjs/core/syntax/CharCodes.js.map +1 -0
- package/cjs/core/syntax/Delimiters.d.ts +2 -0
- package/cjs/core/syntax/Delimiters.d.ts.map +1 -0
- package/cjs/core/syntax/Delimiters.js +17 -0
- package/cjs/core/syntax/Delimiters.js.map +1 -0
- package/cjs/core/syntax/Irregular.d.ts +2 -0
- package/cjs/core/syntax/Irregular.d.ts.map +1 -0
- package/cjs/core/syntax/Irregular.js +13 -0
- package/cjs/core/syntax/Irregular.js.map +1 -0
- package/cjs/core/syntax/Keywords.d.ts +23 -0
- package/cjs/core/syntax/Keywords.d.ts.map +1 -0
- package/cjs/core/syntax/Keywords.js +84 -0
- package/cjs/core/syntax/Keywords.js.map +1 -0
- package/cjs/core/syntax/Numeric.d.ts +4 -0
- package/cjs/core/syntax/Numeric.d.ts.map +1 -0
- package/cjs/core/syntax/Numeric.js +25 -0
- package/cjs/core/syntax/Numeric.js.map +1 -0
- package/cjs/core/syntax/Whitespace.d.ts +2 -0
- package/cjs/core/syntax/Whitespace.d.ts.map +1 -0
- package/cjs/core/syntax/Whitespace.js +13 -0
- package/cjs/core/syntax/Whitespace.js.map +1 -0
- package/cjs/core/writers/PDFStreamWriter.d.ts +22 -0
- package/cjs/core/writers/PDFStreamWriter.d.ts.map +1 -0
- package/cjs/core/writers/PDFStreamWriter.js +133 -0
- package/cjs/core/writers/PDFStreamWriter.js.map +1 -0
- package/cjs/core/writers/PDFWriter.d.ts +33 -0
- package/cjs/core/writers/PDFWriter.d.ts.map +1 -0
- package/cjs/core/writers/PDFWriter.js +164 -0
- package/cjs/core/writers/PDFWriter.js.map +1 -0
- package/cjs/index.d.ts +5 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +8 -0
- package/cjs/index.js.map +1 -0
- package/cjs/types/fontkit.d.ts +582 -0
- package/cjs/types/fontkit.d.ts.map +1 -0
- package/cjs/types/fontkit.js +3 -0
- package/cjs/types/fontkit.js.map +1 -0
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.d.ts.map +1 -0
- package/cjs/types/index.js +3 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/matrix.d.ts +22 -0
- package/cjs/types/matrix.d.ts.map +1 -0
- package/cjs/types/matrix.js +5 -0
- package/cjs/types/matrix.js.map +1 -0
- package/cjs/utils/Cache.d.ts +11 -0
- package/cjs/utils/Cache.d.ts.map +1 -0
- package/cjs/utils/Cache.js +23 -0
- package/cjs/utils/Cache.js.map +1 -0
- package/cjs/utils/arrays.d.ts +16 -0
- package/cjs/utils/arrays.d.ts.map +1 -0
- package/cjs/utils/arrays.js +132 -0
- package/cjs/utils/arrays.js.map +1 -0
- package/cjs/utils/async.d.ts +6 -0
- package/cjs/utils/async.d.ts.map +1 -0
- package/cjs/utils/async.js +13 -0
- package/cjs/utils/async.js.map +1 -0
- package/cjs/utils/base64.d.ts +11 -0
- package/cjs/utils/base64.d.ts.map +1 -0
- package/cjs/utils/base64.js +87 -0
- package/cjs/utils/base64.js.map +1 -0
- package/cjs/utils/errors.d.ts +2 -0
- package/cjs/utils/errors.d.ts.map +1 -0
- package/cjs/utils/errors.js +7 -0
- package/cjs/utils/errors.js.map +1 -0
- package/cjs/utils/index.d.ts +12 -0
- package/cjs/utils/index.d.ts.map +1 -0
- package/cjs/utils/index.js +16 -0
- package/cjs/utils/index.js.map +1 -0
- package/cjs/utils/numbers.d.ts +24 -0
- package/cjs/utils/numbers.d.ts.map +1 -0
- package/cjs/utils/numbers.js +57 -0
- package/cjs/utils/numbers.js.map +1 -0
- package/cjs/utils/objects.d.ts +16 -0
- package/cjs/utils/objects.d.ts.map +1 -0
- package/cjs/utils/objects.js +11 -0
- package/cjs/utils/objects.js.map +1 -0
- package/cjs/utils/pdfDocEncoding.d.ts +8 -0
- package/cjs/utils/pdfDocEncoding.d.ts.map +1 -0
- package/cjs/utils/pdfDocEncoding.js +69 -0
- package/cjs/utils/pdfDocEncoding.js.map +1 -0
- package/cjs/utils/png.d.ts +18 -0
- package/cjs/utils/png.d.ts.map +1 -0
- package/cjs/utils/png.js +63 -0
- package/cjs/utils/png.js.map +1 -0
- package/cjs/utils/rng.d.ts +14 -0
- package/cjs/utils/rng.d.ts.map +1 -0
- package/cjs/utils/rng.js +23 -0
- package/cjs/utils/rng.js.map +1 -0
- package/cjs/utils/strings.d.ts +25 -0
- package/cjs/utils/strings.d.ts.map +1 -0
- package/cjs/utils/strings.js +141 -0
- package/cjs/utils/strings.js.map +1 -0
- package/cjs/utils/unicode.d.ts +187 -0
- package/cjs/utils/unicode.d.ts.map +1 -0
- package/cjs/utils/unicode.js +370 -0
- package/cjs/utils/unicode.js.map +1 -0
- package/cjs/utils/validators.d.ts +27 -0
- package/cjs/utils/validators.d.ts.map +1 -0
- package/cjs/utils/validators.js +183 -0
- package/cjs/utils/validators.js.map +1 -0
- package/dist/pdf-lib.esm.js +39613 -0
- package/dist/pdf-lib.esm.js.map +1 -0
- package/dist/pdf-lib.esm.min.js +16 -0
- package/dist/pdf-lib.esm.min.js.map +1 -0
- package/dist/pdf-lib.js +39886 -0
- package/dist/pdf-lib.js.map +1 -0
- package/dist/pdf-lib.min.js +16 -0
- package/dist/pdf-lib.min.js.map +1 -0
- package/es/api/Embeddable.d.ts +8 -0
- package/es/api/Embeddable.d.ts.map +1 -0
- package/es/api/Embeddable.js +1 -0
- package/es/api/Embeddable.js.map +1 -0
- package/es/api/PDFDocument.d.ts +800 -0
- package/es/api/PDFDocument.d.ts.map +1 -0
- package/es/api/PDFDocument.js +1452 -0
- package/es/api/PDFDocument.js.map +1 -0
- package/es/api/PDFDocumentOptions.d.ts +43 -0
- package/es/api/PDFDocumentOptions.d.ts.map +1 -0
- package/es/api/PDFDocumentOptions.js +8 -0
- package/es/api/PDFDocumentOptions.js.map +1 -0
- package/es/api/PDFEmbeddedFile.d.ts +39 -0
- package/es/api/PDFEmbeddedFile.d.ts.map +1 -0
- package/es/api/PDFEmbeddedFile.js +82 -0
- package/es/api/PDFEmbeddedFile.js.map +1 -0
- package/es/api/PDFEmbeddedPage.d.ts +74 -0
- package/es/api/PDFEmbeddedPage.d.ts.map +1 -0
- package/es/api/PDFEmbeddedPage.js +93 -0
- package/es/api/PDFEmbeddedPage.js.map +1 -0
- package/es/api/PDFFont.d.ts +95 -0
- package/es/api/PDFFont.d.ts.map +1 -0
- package/es/api/PDFFont.js +141 -0
- package/es/api/PDFFont.js.map +1 -0
- package/es/api/PDFImage.d.ts +96 -0
- package/es/api/PDFImage.d.ts.map +1 -0
- package/es/api/PDFImage.js +130 -0
- package/es/api/PDFImage.js.map +1 -0
- package/es/api/PDFJavaScript.d.ts +39 -0
- package/es/api/PDFJavaScript.d.ts.map +1 -0
- package/es/api/PDFJavaScript.js +71 -0
- package/es/api/PDFJavaScript.js.map +1 -0
- package/es/api/PDFPage.d.ts +898 -0
- package/es/api/PDFPage.d.ts.map +1 -0
- package/es/api/PDFPage.js +1440 -0
- package/es/api/PDFPage.js.map +1 -0
- package/es/api/PDFPageOptions.d.ts +155 -0
- package/es/api/PDFPageOptions.d.ts.map +1 -0
- package/es/api/PDFPageOptions.js +16 -0
- package/es/api/PDFPageOptions.js.map +1 -0
- package/es/api/StandardFonts.d.ts +17 -0
- package/es/api/StandardFonts.d.ts.map +1 -0
- package/es/api/StandardFonts.js +18 -0
- package/es/api/StandardFonts.js.map +1 -0
- package/es/api/colors.d.ts +31 -0
- package/es/api/colors.d.ts.map +1 -0
- package/es/api/colors.js +56 -0
- package/es/api/colors.js.map +1 -0
- package/es/api/errors.d.ts +43 -0
- package/es/api/errors.d.ts.map +1 -0
- package/es/api/errors.js +165 -0
- package/es/api/errors.js.map +1 -0
- package/es/api/form/PDFButton.d.ts +138 -0
- package/es/api/form/PDFButton.d.ts.map +1 -0
- package/es/api/form/PDFButton.js +218 -0
- package/es/api/form/PDFButton.js.map +1 -0
- package/es/api/form/PDFCheckBox.d.ts +143 -0
- package/es/api/form/PDFCheckBox.d.ts.map +1 -0
- package/es/api/form/PDFCheckBox.js +234 -0
- package/es/api/form/PDFCheckBox.js.map +1 -0
- package/es/api/form/PDFDropdown.d.ts +403 -0
- package/es/api/form/PDFDropdown.d.ts.map +1 -0
- package/es/api/form/PDFDropdown.js +578 -0
- package/es/api/form/PDFDropdown.js.map +1 -0
- package/es/api/form/PDFField.d.ts +204 -0
- package/es/api/form/PDFField.d.ts.map +1 -0
- package/es/api/form/PDFField.js +381 -0
- package/es/api/form/PDFField.js.map +1 -0
- package/es/api/form/PDFForm.d.ts +412 -0
- package/es/api/form/PDFForm.d.ts.map +1 -0
- package/es/api/form/PDFForm.js +724 -0
- package/es/api/form/PDFForm.js.map +1 -0
- package/es/api/form/PDFOptionList.d.ts +336 -0
- package/es/api/form/PDFOptionList.d.ts.map +1 -0
- package/es/api/form/PDFOptionList.js +497 -0
- package/es/api/form/PDFOptionList.js.map +1 -0
- package/es/api/form/PDFRadioGroup.d.ts +253 -0
- package/es/api/form/PDFRadioGroup.d.ts.map +1 -0
- package/es/api/form/PDFRadioGroup.js +413 -0
- package/es/api/form/PDFRadioGroup.js.map +1 -0
- package/es/api/form/PDFSignature.d.ts +30 -0
- package/es/api/form/PDFSignature.d.ts.map +1 -0
- package/es/api/form/PDFSignature.js +41 -0
- package/es/api/form/PDFSignature.js.map +1 -0
- package/es/api/form/PDFTextField.d.ts +538 -0
- package/es/api/form/PDFTextField.d.ts.map +1 -0
- package/es/api/form/PDFTextField.js +737 -0
- package/es/api/form/PDFTextField.js.map +1 -0
- package/es/api/form/appearances.d.ts +42 -0
- package/es/api/form/appearances.d.ts.map +1 -0
- package/es/api/form/appearances.js +418 -0
- package/es/api/form/appearances.js.map +1 -0
- package/es/api/form/index.d.ts +11 -0
- package/es/api/form/index.d.ts.map +1 -0
- package/es/api/form/index.js +11 -0
- package/es/api/form/index.js.map +1 -0
- package/es/api/image/alignment.d.ts +6 -0
- package/es/api/image/alignment.d.ts.map +1 -0
- package/es/api/image/alignment.js +7 -0
- package/es/api/image/alignment.js.map +1 -0
- package/es/api/image/index.d.ts +2 -0
- package/es/api/image/index.d.ts.map +1 -0
- package/es/api/image/index.js +2 -0
- package/es/api/image/index.js.map +1 -0
- package/es/api/index.d.ts +22 -0
- package/es/api/index.d.ts.map +1 -0
- package/es/api/index.js +21 -0
- package/es/api/index.js.map +1 -0
- package/es/api/objects.d.ts +5 -0
- package/es/api/objects.d.ts.map +1 -0
- package/es/api/objects.js +11 -0
- package/es/api/objects.js.map +1 -0
- package/es/api/operations.d.ts +212 -0
- package/es/api/operations.d.ts.map +1 -0
- package/es/api/operations.js +485 -0
- package/es/api/operations.js.map +1 -0
- package/es/api/operators.d.ts +86 -0
- package/es/api/operators.d.ts.map +1 -0
- package/es/api/operators.js +228 -0
- package/es/api/operators.js.map +1 -0
- package/es/api/rotations.d.ts +39 -0
- package/es/api/rotations.d.ts.map +1 -0
- package/es/api/rotations.js +68 -0
- package/es/api/rotations.js.map +1 -0
- package/es/api/sizes.d.ts +53 -0
- package/es/api/sizes.d.ts.map +1 -0
- package/es/api/sizes.js +53 -0
- package/es/api/sizes.js.map +1 -0
- package/es/api/snapshot/DefaultDocumentSnapshot.d.ts +13 -0
- package/es/api/snapshot/DefaultDocumentSnapshot.d.ts.map +1 -0
- package/es/api/snapshot/DefaultDocumentSnapshot.js +25 -0
- package/es/api/snapshot/DefaultDocumentSnapshot.js.map +1 -0
- package/es/api/snapshot/DocumentSnapshot.d.ts +11 -0
- package/es/api/snapshot/DocumentSnapshot.d.ts.map +1 -0
- package/es/api/snapshot/DocumentSnapshot.js +1 -0
- package/es/api/snapshot/DocumentSnapshot.js.map +1 -0
- package/es/api/snapshot/IncrementalDocumentSnapshot.d.ts +16 -0
- package/es/api/snapshot/IncrementalDocumentSnapshot.d.ts.map +1 -0
- package/es/api/snapshot/IncrementalDocumentSnapshot.js +41 -0
- package/es/api/snapshot/IncrementalDocumentSnapshot.js.map +1 -0
- package/es/api/snapshot/index.d.ts +4 -0
- package/es/api/snapshot/index.d.ts.map +1 -0
- package/es/api/snapshot/index.js +4 -0
- package/es/api/snapshot/index.js.map +1 -0
- package/es/api/svgPath.d.ts +3 -0
- package/es/api/svgPath.d.ts.map +1 -0
- package/es/api/svgPath.js +377 -0
- package/es/api/svgPath.js.map +1 -0
- package/es/api/text/alignment.d.ts +6 -0
- package/es/api/text/alignment.d.ts.map +1 -0
- package/es/api/text/alignment.js +7 -0
- package/es/api/text/alignment.js.map +1 -0
- package/es/api/text/index.d.ts +3 -0
- package/es/api/text/index.d.ts.map +1 -0
- package/es/api/text/index.js +3 -0
- package/es/api/text/index.js.map +1 -0
- package/es/api/text/layout.d.ts +55 -0
- package/es/api/text/layout.d.ts.map +1 -0
- package/es/api/text/layout.js +209 -0
- package/es/api/text/layout.js.map +1 -0
- package/es/core/PDFContext.d.ts +93 -0
- package/es/core/PDFContext.d.ts.map +1 -0
- package/es/core/PDFContext.js +208 -0
- package/es/core/PDFContext.js.map +1 -0
- package/es/core/PDFObjectCopier.d.ts +38 -0
- package/es/core/PDFObjectCopier.d.ts.map +1 -0
- package/es/core/PDFObjectCopier.js +116 -0
- package/es/core/PDFObjectCopier.js.map +1 -0
- package/es/core/acroform/PDFAcroButton.d.ts +22 -0
- package/es/core/acroform/PDFAcroButton.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroButton.js +94 -0
- package/es/core/acroform/PDFAcroButton.js.map +1 -0
- package/es/core/acroform/PDFAcroCheckBox.d.ts +14 -0
- package/es/core/acroform/PDFAcroCheckBox.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroCheckBox.js +48 -0
- package/es/core/acroform/PDFAcroCheckBox.js.map +1 -0
- package/es/core/acroform/PDFAcroChoice.d.ts +21 -0
- package/es/core/acroform/PDFAcroChoice.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroChoice.js +125 -0
- package/es/core/acroform/PDFAcroChoice.js.map +1 -0
- package/es/core/acroform/PDFAcroComboBox.d.ts +10 -0
- package/es/core/acroform/PDFAcroComboBox.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroComboBox.js +24 -0
- package/es/core/acroform/PDFAcroComboBox.js.map +1 -0
- package/es/core/acroform/PDFAcroField.d.ts +37 -0
- package/es/core/acroform/PDFAcroField.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroField.js +146 -0
- package/es/core/acroform/PDFAcroField.js.map +1 -0
- package/es/core/acroform/PDFAcroForm.d.ts +21 -0
- package/es/core/acroform/PDFAcroForm.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroForm.js +75 -0
- package/es/core/acroform/PDFAcroForm.js.map +1 -0
- package/es/core/acroform/PDFAcroListBox.d.ts +10 -0
- package/es/core/acroform/PDFAcroListBox.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroListBox.js +22 -0
- package/es/core/acroform/PDFAcroListBox.js.map +1 -0
- package/es/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
- package/es/core/acroform/PDFAcroNonTerminal.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroNonTerminal.js +32 -0
- package/es/core/acroform/PDFAcroNonTerminal.js.map +1 -0
- package/es/core/acroform/PDFAcroPushButton.d.ts +10 -0
- package/es/core/acroform/PDFAcroPushButton.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroPushButton.js +24 -0
- package/es/core/acroform/PDFAcroPushButton.js.map +1 -0
- package/es/core/acroform/PDFAcroRadioButton.d.ts +14 -0
- package/es/core/acroform/PDFAcroRadioButton.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroRadioButton.js +55 -0
- package/es/core/acroform/PDFAcroRadioButton.js.map +1 -0
- package/es/core/acroform/PDFAcroSignature.d.ts +8 -0
- package/es/core/acroform/PDFAcroSignature.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroSignature.js +14 -0
- package/es/core/acroform/PDFAcroSignature.js.map +1 -0
- package/es/core/acroform/PDFAcroTerminal.d.ts +17 -0
- package/es/core/acroform/PDFAcroTerminal.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroTerminal.js +68 -0
- package/es/core/acroform/PDFAcroTerminal.js.map +1 -0
- package/es/core/acroform/PDFAcroText.d.ts +23 -0
- package/es/core/acroform/PDFAcroText.d.ts.map +1 -0
- package/es/core/acroform/PDFAcroText.js +71 -0
- package/es/core/acroform/PDFAcroText.js.map +1 -0
- package/es/core/acroform/flags.d.ts +142 -0
- package/es/core/acroform/flags.d.ts.map +1 -0
- package/es/core/acroform/flags.js +147 -0
- package/es/core/acroform/flags.js.map +1 -0
- package/es/core/acroform/index.d.ts +16 -0
- package/es/core/acroform/index.d.ts.map +1 -0
- package/es/core/acroform/index.js +16 -0
- package/es/core/acroform/index.js.map +1 -0
- package/es/core/acroform/utils.d.ts +7 -0
- package/es/core/acroform/utils.d.ts.map +1 -0
- package/es/core/acroform/utils.js +123 -0
- package/es/core/acroform/utils.js.map +1 -0
- package/es/core/annotation/AppearanceCharacteristics.d.ts +34 -0
- package/es/core/annotation/AppearanceCharacteristics.d.ts.map +1 -0
- package/es/core/annotation/AppearanceCharacteristics.js +120 -0
- package/es/core/annotation/AppearanceCharacteristics.js.map +1 -0
- package/es/core/annotation/BorderStyle.d.ts +12 -0
- package/es/core/annotation/BorderStyle.d.ts.map +1 -0
- package/es/core/annotation/BorderStyle.js +26 -0
- package/es/core/annotation/BorderStyle.js.map +1 -0
- package/es/core/annotation/PDFAnnotation.d.ts +52 -0
- package/es/core/annotation/PDFAnnotation.d.ts.map +1 -0
- package/es/core/annotation/PDFAnnotation.js +120 -0
- package/es/core/annotation/PDFAnnotation.js.map +1 -0
- package/es/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
- package/es/core/annotation/PDFWidgetAnnotation.d.ts.map +1 -0
- package/es/core/annotation/PDFWidgetAnnotation.js +108 -0
- package/es/core/annotation/PDFWidgetAnnotation.js.map +1 -0
- package/es/core/annotation/flags.d.ts +80 -0
- package/es/core/annotation/flags.d.ts.map +1 -0
- package/es/core/annotation/flags.js +82 -0
- package/es/core/annotation/flags.js.map +1 -0
- package/es/core/annotation/index.d.ts +5 -0
- package/es/core/annotation/index.d.ts.map +1 -0
- package/es/core/annotation/index.js +5 -0
- package/es/core/annotation/index.js.map +1 -0
- package/es/core/document/PDFCrossRefSection.d.ts +28 -0
- package/es/core/document/PDFCrossRefSection.d.ts.map +1 -0
- package/es/core/document/PDFCrossRefSection.js +121 -0
- package/es/core/document/PDFCrossRefSection.js.map +1 -0
- package/es/core/document/PDFHeader.d.ts +11 -0
- package/es/core/document/PDFHeader.d.ts.map +1 -0
- package/es/core/document/PDFHeader.js +39 -0
- package/es/core/document/PDFHeader.js.map +1 -0
- package/es/core/document/PDFTrailer.d.ts +10 -0
- package/es/core/document/PDFTrailer.d.ts.map +1 -0
- package/es/core/document/PDFTrailer.js +40 -0
- package/es/core/document/PDFTrailer.js.map +1 -0
- package/es/core/document/PDFTrailerDict.d.ts +11 -0
- package/es/core/document/PDFTrailerDict.d.ts.map +1 -0
- package/es/core/document/PDFTrailerDict.js +29 -0
- package/es/core/document/PDFTrailerDict.js.map +1 -0
- package/es/core/embedders/CMap.d.ts +4 -0
- package/es/core/embedders/CMap.d.ts.map +1 -0
- package/es/core/embedders/CMap.js +40 -0
- package/es/core/embedders/CMap.js.map +1 -0
- package/es/core/embedders/CustomFontEmbedder.d.ts +45 -0
- package/es/core/embedders/CustomFontEmbedder.d.ts.map +1 -0
- package/es/core/embedders/CustomFontEmbedder.js +238 -0
- package/es/core/embedders/CustomFontEmbedder.js.map +1 -0
- package/es/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
- package/es/core/embedders/CustomFontSubsetEmbedder.d.ts.map +1 -0
- package/es/core/embedders/CustomFontSubsetEmbedder.js +66 -0
- package/es/core/embedders/CustomFontSubsetEmbedder.js.map +1 -0
- package/es/core/embedders/FileEmbedder.d.ts +34 -0
- package/es/core/embedders/FileEmbedder.d.ts.map +1 -0
- package/es/core/embedders/FileEmbedder.js +72 -0
- package/es/core/embedders/FileEmbedder.js.map +1 -0
- package/es/core/embedders/FontFlags.d.ts +14 -0
- package/es/core/embedders/FontFlags.d.ts.map +1 -0
- package/es/core/embedders/FontFlags.js +37 -0
- package/es/core/embedders/FontFlags.js.map +1 -0
- package/es/core/embedders/JavaScriptEmbedder.d.ts +11 -0
- package/es/core/embedders/JavaScriptEmbedder.d.ts.map +1 -0
- package/es/core/embedders/JavaScriptEmbedder.js +34 -0
- package/es/core/embedders/JavaScriptEmbedder.js.map +1 -0
- package/es/core/embedders/JpegEmbedder.d.ts +24 -0
- package/es/core/embedders/JpegEmbedder.d.ts.map +1 -0
- package/es/core/embedders/JpegEmbedder.js +105 -0
- package/es/core/embedders/JpegEmbedder.js.map +1 -0
- package/es/core/embedders/PDFPageEmbedder.d.ts +38 -0
- package/es/core/embedders/PDFPageEmbedder.d.ts.map +1 -0
- package/es/core/embedders/PDFPageEmbedder.js +89 -0
- package/es/core/embedders/PDFPageEmbedder.js.map +1 -0
- package/es/core/embedders/PngEmbedder.d.ts +20 -0
- package/es/core/embedders/PngEmbedder.d.ts.map +1 -0
- package/es/core/embedders/PngEmbedder.js +67 -0
- package/es/core/embedders/PngEmbedder.js.map +1 -0
- package/es/core/embedders/StandardFontEmbedder.d.ts +37 -0
- package/es/core/embedders/StandardFontEmbedder.d.ts.map +1 -0
- package/es/core/embedders/StandardFontEmbedder.js +95 -0
- package/es/core/embedders/StandardFontEmbedder.js.map +1 -0
- package/es/core/errors.d.ts +92 -0
- package/es/core/errors.d.ts.map +1 -0
- package/es/core/errors.js +320 -0
- package/es/core/errors.js.map +1 -0
- package/es/core/index.d.ts +48 -0
- package/es/core/index.d.ts.map +1 -0
- package/es/core/index.js +48 -0
- package/es/core/index.js.map +1 -0
- package/es/core/interactive/ViewerPreferences.d.ts +348 -0
- package/es/core/interactive/ViewerPreferences.d.ts.map +1 -0
- package/es/core/interactive/ViewerPreferences.js +507 -0
- package/es/core/interactive/ViewerPreferences.js.map +1 -0
- package/es/core/objects/PDFArray.d.ts +64 -0
- package/es/core/objects/PDFArray.d.ts.map +1 -0
- package/es/core/objects/PDFArray.js +115 -0
- package/es/core/objects/PDFArray.js.map +1 -0
- package/es/core/objects/PDFBool.d.ts +14 -0
- package/es/core/objects/PDFBool.d.ts.map +1 -0
- package/es/core/objects/PDFBool.js +50 -0
- package/es/core/objects/PDFBool.js.map +1 -0
- package/es/core/objects/PDFDict.d.ts +63 -0
- package/es/core/objects/PDFDict.d.ts.map +1 -0
- package/es/core/objects/PDFDict.js +141 -0
- package/es/core/objects/PDFDict.js.map +1 -0
- package/es/core/objects/PDFHexString.d.ts +17 -0
- package/es/core/objects/PDFHexString.d.ts.map +1 -0
- package/es/core/objects/PDFHexString.js +72 -0
- package/es/core/objects/PDFHexString.js.map +1 -0
- package/es/core/objects/PDFInvalidObject.d.ts +12 -0
- package/es/core/objects/PDFInvalidObject.d.ts.map +1 -0
- package/es/core/objects/PDFInvalidObject.js +30 -0
- package/es/core/objects/PDFInvalidObject.js.map +1 -0
- package/es/core/objects/PDFName.d.ts +42 -0
- package/es/core/objects/PDFName.d.ts.map +1 -0
- package/es/core/objects/PDFName.js +136 -0
- package/es/core/objects/PDFName.js.map +1 -0
- package/es/core/objects/PDFNull.d.ts +11 -0
- package/es/core/objects/PDFNull.d.ts.map +1 -0
- package/es/core/objects/PDFNull.js +31 -0
- package/es/core/objects/PDFNull.js.map +1 -0
- package/es/core/objects/PDFNumber.d.ts +16 -0
- package/es/core/objects/PDFNumber.d.ts.map +1 -0
- package/es/core/objects/PDFNumber.js +36 -0
- package/es/core/objects/PDFNumber.js.map +1 -0
- package/es/core/objects/PDFObject.d.ts +10 -0
- package/es/core/objects/PDFObject.d.ts.map +1 -0
- package/es/core/objects/PDFObject.js +23 -0
- package/es/core/objects/PDFObject.js.map +1 -0
- package/es/core/objects/PDFRawStream.d.ts +15 -0
- package/es/core/objects/PDFRawStream.d.ts.map +1 -0
- package/es/core/objects/PDFRawStream.js +32 -0
- package/es/core/objects/PDFRawStream.js.map +1 -0
- package/es/core/objects/PDFRef.d.ts +14 -0
- package/es/core/objects/PDFRef.d.ts.map +1 -0
- package/es/core/objects/PDFRef.js +45 -0
- package/es/core/objects/PDFRef.js.map +1 -0
- package/es/core/objects/PDFStream.d.ts +17 -0
- package/es/core/objects/PDFStream.d.ts.map +1 -0
- package/es/core/objects/PDFStream.js +73 -0
- package/es/core/objects/PDFStream.js.map +1 -0
- package/es/core/objects/PDFString.d.ts +17 -0
- package/es/core/objects/PDFString.d.ts.map +1 -0
- package/es/core/objects/PDFString.js +114 -0
- package/es/core/objects/PDFString.js.map +1 -0
- package/es/core/operators/PDFOperator.d.ts +20 -0
- package/es/core/operators/PDFOperator.d.ts.map +1 -0
- package/es/core/operators/PDFOperator.js +55 -0
- package/es/core/operators/PDFOperator.js.map +1 -0
- package/es/core/operators/PDFOperatorNames.d.ts +77 -0
- package/es/core/operators/PDFOperatorNames.d.ts.map +1 -0
- package/es/core/operators/PDFOperatorNames.js +86 -0
- package/es/core/operators/PDFOperatorNames.js.map +1 -0
- package/es/core/parser/BaseParser.d.ts +15 -0
- package/es/core/parser/BaseParser.d.ts.map +1 -0
- package/es/core/parser/BaseParser.js +107 -0
- package/es/core/parser/BaseParser.js.map +1 -0
- package/es/core/parser/ByteStream.d.ts +27 -0
- package/es/core/parser/ByteStream.d.ts.map +1 -0
- package/es/core/parser/ByteStream.js +61 -0
- package/es/core/parser/ByteStream.js.map +1 -0
- package/es/core/parser/PDFObjectParser.d.ts +30 -0
- package/es/core/parser/PDFObjectParser.d.ts.map +1 -0
- package/es/core/parser/PDFObjectParser.js +231 -0
- package/es/core/parser/PDFObjectParser.js.map +1 -0
- package/es/core/parser/PDFObjectStreamParser.d.ts +14 -0
- package/es/core/parser/PDFObjectStreamParser.d.ts.map +1 -0
- package/es/core/parser/PDFObjectStreamParser.js +68 -0
- package/es/core/parser/PDFObjectStreamParser.js.map +1 -0
- package/es/core/parser/PDFParser.d.ts +46 -0
- package/es/core/parser/PDFParser.d.ts.map +1 -0
- package/es/core/parser/PDFParser.js +360 -0
- package/es/core/parser/PDFParser.js.map +1 -0
- package/es/core/parser/PDFXRefStreamParser.d.ts +22 -0
- package/es/core/parser/PDFXRefStreamParser.d.ts.map +1 -0
- package/es/core/parser/PDFXRefStreamParser.js +90 -0
- package/es/core/parser/PDFXRefStreamParser.js.map +1 -0
- package/es/core/streams/Ascii85Stream.d.ts +10 -0
- package/es/core/streams/Ascii85Stream.d.ts.map +1 -0
- package/es/core/streams/Ascii85Stream.js +85 -0
- package/es/core/streams/Ascii85Stream.js.map +1 -0
- package/es/core/streams/AsciiHexStream.d.ts +10 -0
- package/es/core/streams/AsciiHexStream.d.ts.map +1 -0
- package/es/core/streams/AsciiHexStream.js +73 -0
- package/es/core/streams/AsciiHexStream.js.map +1 -0
- package/es/core/streams/DecodeStream.d.ts +27 -0
- package/es/core/streams/DecodeStream.d.ts.map +1 -0
- package/es/core/streams/DecodeStream.js +146 -0
- package/es/core/streams/DecodeStream.js.map +1 -0
- package/es/core/streams/FlateStream.d.ts +14 -0
- package/es/core/streams/FlateStream.d.ts.map +1 -0
- package/es/core/streams/FlateStream.js +369 -0
- package/es/core/streams/FlateStream.js.map +1 -0
- package/es/core/streams/LZWStream.d.ts +13 -0
- package/es/core/streams/LZWStream.d.ts.map +1 -0
- package/es/core/streams/LZWStream.js +135 -0
- package/es/core/streams/LZWStream.js.map +1 -0
- package/es/core/streams/RunLengthStream.d.ts +9 -0
- package/es/core/streams/RunLengthStream.d.ts.map +1 -0
- package/es/core/streams/RunLengthStream.js +53 -0
- package/es/core/streams/RunLengthStream.js.map +1 -0
- package/es/core/streams/Stream.d.ts +35 -0
- package/es/core/streams/Stream.d.ts.map +1 -0
- package/es/core/streams/Stream.js +104 -0
- package/es/core/streams/Stream.js.map +1 -0
- package/es/core/streams/decode.d.ts +4 -0
- package/es/core/streams/decode.d.ts.map +1 -0
- package/es/core/streams/decode.js +55 -0
- package/es/core/streams/decode.js.map +1 -0
- package/es/core/structures/PDFCatalog.d.ts +28 -0
- package/es/core/structures/PDFCatalog.d.ts.map +1 -0
- package/es/core/structures/PDFCatalog.js +77 -0
- package/es/core/structures/PDFCatalog.js.map +1 -0
- package/es/core/structures/PDFContentStream.d.ts +16 -0
- package/es/core/structures/PDFContentStream.d.ts.map +1 -0
- package/es/core/structures/PDFContentStream.js +58 -0
- package/es/core/structures/PDFContentStream.js.map +1 -0
- package/es/core/structures/PDFCrossRefStream.d.ts +54 -0
- package/es/core/structures/PDFCrossRefStream.d.ts.map +1 -0
- package/es/core/structures/PDFCrossRefStream.js +184 -0
- package/es/core/structures/PDFCrossRefStream.js.map +1 -0
- package/es/core/structures/PDFFlateStream.d.ts +14 -0
- package/es/core/structures/PDFFlateStream.d.ts.map +1 -0
- package/es/core/structures/PDFFlateStream.js +33 -0
- package/es/core/structures/PDFFlateStream.js.map +1 -0
- package/es/core/structures/PDFObjectStream.d.ts +21 -0
- package/es/core/structures/PDFObjectStream.d.ts.map +1 -0
- package/es/core/structures/PDFObjectStream.js +75 -0
- package/es/core/structures/PDFObjectStream.js.map +1 -0
- package/es/core/structures/PDFPageLeaf.d.ts +55 -0
- package/es/core/structures/PDFPageLeaf.d.ts.map +1 -0
- package/es/core/structures/PDFPageLeaf.js +206 -0
- package/es/core/structures/PDFPageLeaf.js.map +1 -0
- package/es/core/structures/PDFPageTree.d.ts +42 -0
- package/es/core/structures/PDFPageTree.d.ts.map +1 -0
- package/es/core/structures/PDFPageTree.js +175 -0
- package/es/core/structures/PDFPageTree.js.map +1 -0
- package/es/core/syntax/CharCodes.d.ts +62 -0
- package/es/core/syntax/CharCodes.d.ts.map +1 -0
- package/es/core/syntax/CharCodes.js +63 -0
- package/es/core/syntax/CharCodes.js.map +1 -0
- package/es/core/syntax/Delimiters.d.ts +2 -0
- package/es/core/syntax/Delimiters.d.ts.map +1 -0
- package/es/core/syntax/Delimiters.js +13 -0
- package/es/core/syntax/Delimiters.js.map +1 -0
- package/es/core/syntax/Irregular.d.ts +2 -0
- package/es/core/syntax/Irregular.d.ts.map +1 -0
- package/es/core/syntax/Irregular.js +9 -0
- package/es/core/syntax/Irregular.js.map +1 -0
- package/es/core/syntax/Keywords.d.ts +23 -0
- package/es/core/syntax/Keywords.d.ts.map +1 -0
- package/es/core/syntax/Keywords.js +81 -0
- package/es/core/syntax/Keywords.js.map +1 -0
- package/es/core/syntax/Numeric.d.ts +4 -0
- package/es/core/syntax/Numeric.d.ts.map +1 -0
- package/es/core/syntax/Numeric.js +21 -0
- package/es/core/syntax/Numeric.js.map +1 -0
- package/es/core/syntax/Whitespace.d.ts +2 -0
- package/es/core/syntax/Whitespace.d.ts.map +1 -0
- package/es/core/syntax/Whitespace.js +9 -0
- package/es/core/syntax/Whitespace.js.map +1 -0
- package/es/core/writers/PDFStreamWriter.d.ts +22 -0
- package/es/core/writers/PDFStreamWriter.d.ts.map +1 -0
- package/es/core/writers/PDFStreamWriter.js +131 -0
- package/es/core/writers/PDFStreamWriter.js.map +1 -0
- package/es/core/writers/PDFWriter.d.ts +33 -0
- package/es/core/writers/PDFWriter.d.ts.map +1 -0
- package/es/core/writers/PDFWriter.js +162 -0
- package/es/core/writers/PDFWriter.js.map +1 -0
- package/es/index.d.ts +5 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5 -0
- package/es/index.js.map +1 -0
- package/es/types/fontkit.d.ts +582 -0
- package/es/types/fontkit.d.ts.map +1 -0
- package/es/types/fontkit.js +1 -0
- package/es/types/fontkit.js.map +1 -0
- package/es/types/index.d.ts +2 -0
- package/es/types/index.d.ts.map +1 -0
- package/es/types/index.js +1 -0
- package/es/types/index.js.map +1 -0
- package/es/types/matrix.d.ts +22 -0
- package/es/types/matrix.d.ts.map +1 -0
- package/es/types/matrix.js +2 -0
- package/es/types/matrix.js.map +1 -0
- package/es/utils/Cache.d.ts +11 -0
- package/es/utils/Cache.d.ts.map +1 -0
- package/es/utils/Cache.js +21 -0
- package/es/utils/Cache.js.map +1 -0
- package/es/utils/arrays.d.ts +16 -0
- package/es/utils/arrays.d.ts.map +1 -0
- package/es/utils/arrays.js +129 -0
- package/es/utils/arrays.js.map +1 -0
- package/es/utils/async.d.ts +6 -0
- package/es/utils/async.d.ts.map +1 -0
- package/es/utils/async.js +10 -0
- package/es/utils/async.js.map +1 -0
- package/es/utils/base64.d.ts +11 -0
- package/es/utils/base64.d.ts.map +1 -0
- package/es/utils/base64.js +84 -0
- package/es/utils/base64.js.map +1 -0
- package/es/utils/errors.d.ts +2 -0
- package/es/utils/errors.d.ts.map +1 -0
- package/es/utils/errors.js +4 -0
- package/es/utils/errors.js.map +1 -0
- package/es/utils/index.d.ts +12 -0
- package/es/utils/index.d.ts.map +1 -0
- package/es/utils/index.js +12 -0
- package/es/utils/index.js.map +1 -0
- package/es/utils/numbers.d.ts +24 -0
- package/es/utils/numbers.d.ts.map +1 -0
- package/es/utils/numbers.js +54 -0
- package/es/utils/numbers.js.map +1 -0
- package/es/utils/objects.d.ts +16 -0
- package/es/utils/objects.d.ts.map +1 -0
- package/es/utils/objects.js +8 -0
- package/es/utils/objects.js.map +1 -0
- package/es/utils/pdfDocEncoding.d.ts +8 -0
- package/es/utils/pdfDocEncoding.d.ts.map +1 -0
- package/es/utils/pdfDocEncoding.js +66 -0
- package/es/utils/pdfDocEncoding.js.map +1 -0
- package/es/utils/png.d.ts +18 -0
- package/es/utils/png.d.ts.map +1 -0
- package/es/utils/png.js +59 -0
- package/es/utils/png.js.map +1 -0
- package/es/utils/rng.d.ts +14 -0
- package/es/utils/rng.d.ts.map +1 -0
- package/es/utils/rng.js +20 -0
- package/es/utils/rng.js.map +1 -0
- package/es/utils/strings.d.ts +25 -0
- package/es/utils/strings.d.ts.map +1 -0
- package/es/utils/strings.js +138 -0
- package/es/utils/strings.js.map +1 -0
- package/es/utils/unicode.d.ts +187 -0
- package/es/utils/unicode.d.ts.map +1 -0
- package/es/utils/unicode.js +367 -0
- package/es/utils/unicode.js.map +1 -0
- package/es/utils/validators.d.ts +27 -0
- package/es/utils/validators.d.ts.map +1 -0
- package/es/utils/validators.js +180 -0
- package/es/utils/validators.js.map +1 -0
- package/package.json +144 -0
- package/src/api/Embeddable.ts +7 -0
- package/src/api/PDFDocument.ts +1495 -0
- package/src/api/PDFDocumentOptions.ts +50 -0
- package/src/api/PDFEmbeddedFile.ts +90 -0
- package/src/api/PDFEmbeddedPage.ts +104 -0
- package/src/api/PDFFont.ts +154 -0
- package/src/api/PDFImage.ts +143 -0
- package/src/api/PDFJavaScript.ts +82 -0
- package/src/api/PDFPage.ts +1621 -0
- package/src/api/PDFPageOptions.ts +158 -0
- package/src/api/StandardFonts.ts +16 -0
- package/src/api/colors.ts +104 -0
- package/src/api/errors.ts +111 -0
- package/src/api/form/PDFButton.ts +267 -0
- package/src/api/form/PDFCheckBox.ts +262 -0
- package/src/api/form/PDFDropdown.ts +652 -0
- package/src/api/form/PDFField.ts +521 -0
- package/src/api/form/PDFForm.ts +852 -0
- package/src/api/form/PDFOptionList.ts +571 -0
- package/src/api/form/PDFRadioGroup.ts +471 -0
- package/src/api/form/PDFSignature.ts +53 -0
- package/src/api/form/PDFTextField.ts +826 -0
- package/src/api/form/appearances.ts +665 -0
- package/src/api/form/index.ts +10 -0
- package/src/api/image/alignment.ts +5 -0
- package/src/api/image/index.ts +1 -0
- package/src/api/index.ts +21 -0
- package/src/api/objects.ts +10 -0
- package/src/api/operations.ts +800 -0
- package/src/api/operators.ts +360 -0
- package/src/api/rotations.ts +87 -0
- package/src/api/sizes.ts +52 -0
- package/src/api/snapshot/DefaultDocumentSnapshot.ts +29 -0
- package/src/api/snapshot/DocumentSnapshot.ts +14 -0
- package/src/api/snapshot/IncrementalDocumentSnapshot.ts +59 -0
- package/src/api/snapshot/index.ts +3 -0
- package/src/api/svgPath.ts +489 -0
- package/src/api/text/alignment.ts +5 -0
- package/src/api/text/index.ts +2 -0
- package/src/api/text/layout.ts +343 -0
- package/src/core/PDFContext.ts +316 -0
- package/src/core/PDFObjectCopier.ts +143 -0
- package/src/core/acroform/PDFAcroButton.ts +114 -0
- package/src/core/acroform/PDFAcroCheckBox.ts +49 -0
- package/src/core/acroform/PDFAcroChoice.ts +153 -0
- package/src/core/acroform/PDFAcroComboBox.ts +22 -0
- package/src/core/acroform/PDFAcroField.ts +167 -0
- package/src/core/acroform/PDFAcroForm.ts +102 -0
- package/src/core/acroform/PDFAcroListBox.ts +20 -0
- package/src/core/acroform/PDFAcroNonTerminal.ts +34 -0
- package/src/core/acroform/PDFAcroPushButton.ts +22 -0
- package/src/core/acroform/PDFAcroRadioButton.ts +58 -0
- package/src/core/acroform/PDFAcroSignature.ts +10 -0
- package/src/core/acroform/PDFAcroTerminal.ts +71 -0
- package/src/core/acroform/PDFAcroText.ts +76 -0
- package/src/core/acroform/flags.ts +162 -0
- package/src/core/acroform/index.ts +15 -0
- package/src/core/acroform/utils.ts +135 -0
- package/src/core/annotation/AppearanceCharacteristics.ts +133 -0
- package/src/core/annotation/BorderStyle.ts +31 -0
- package/src/core/annotation/PDFAnnotation.ts +148 -0
- package/src/core/annotation/PDFWidgetAnnotation.ts +112 -0
- package/src/core/annotation/flags.ts +90 -0
- package/src/core/annotation/index.ts +4 -0
- package/src/core/document/PDFCrossRefSection.ts +173 -0
- package/src/core/document/PDFHeader.ts +49 -0
- package/src/core/document/PDFTrailer.ts +49 -0
- package/src/core/document/PDFTrailerDict.ts +39 -0
- package/src/core/embedders/CMap.ts +70 -0
- package/src/core/embedders/CustomFontEmbedder.ts +249 -0
- package/src/core/embedders/CustomFontSubsetEmbedder.ts +84 -0
- package/src/core/embedders/FileEmbedder.ts +95 -0
- package/src/core/embedders/FontFlags.ts +45 -0
- package/src/core/embedders/JavaScriptEmbedder.ts +34 -0
- package/src/core/embedders/JpegEmbedder.ts +127 -0
- package/src/core/embedders/PDFPageEmbedder.ts +141 -0
- package/src/core/embedders/PngEmbedder.ts +69 -0
- package/src/core/embedders/StandardFontEmbedder.ts +130 -0
- package/src/core/errors.ts +221 -0
- package/src/core/index.ts +69 -0
- package/src/core/interactive/ViewerPreferences.ts +579 -0
- package/src/core/objects/PDFArray.ts +185 -0
- package/src/core/objects/PDFBool.ts +53 -0
- package/src/core/objects/PDFDict.ts +232 -0
- package/src/core/objects/PDFHexString.ts +94 -0
- package/src/core/objects/PDFInvalidObject.ts +34 -0
- package/src/core/objects/PDFName.ts +159 -0
- package/src/core/objects/PDFNull.ts +30 -0
- package/src/core/objects/PDFNumber.ts +44 -0
- package/src/core/objects/PDFObject.ts +28 -0
- package/src/core/objects/PDFRawStream.ts +38 -0
- package/src/core/objects/PDFRef.ts +55 -0
- package/src/core/objects/PDFStream.ts +93 -0
- package/src/core/objects/PDFString.ts +118 -0
- package/src/core/operators/PDFOperator.ts +79 -0
- package/src/core/operators/PDFOperatorNames.ts +92 -0
- package/src/core/parser/BaseParser.ts +119 -0
- package/src/core/parser/ByteStream.ts +76 -0
- package/src/core/parser/PDFObjectParser.ts +274 -0
- package/src/core/parser/PDFObjectStreamParser.ts +67 -0
- package/src/core/parser/PDFParser.ts +377 -0
- package/src/core/parser/PDFXRefStreamParser.ts +131 -0
- package/src/core/streams/Ascii85Stream.ts +98 -0
- package/src/core/streams/AsciiHexStream.ts +77 -0
- package/src/core/streams/DecodeStream.ts +170 -0
- package/src/core/streams/FlateStream.ts +407 -0
- package/src/core/streams/LZWStream.ts +164 -0
- package/src/core/streams/RunLengthStream.ts +55 -0
- package/src/core/streams/Stream.ts +132 -0
- package/src/core/streams/decode.ts +73 -0
- package/src/core/structures/PDFCatalog.ts +85 -0
- package/src/core/structures/PDFContentStream.ts +58 -0
- package/src/core/structures/PDFCrossRefStream.ts +246 -0
- package/src/core/structures/PDFFlateStream.ts +43 -0
- package/src/core/structures/PDFObjectStream.ts +101 -0
- package/src/core/structures/PDFPageLeaf.ts +265 -0
- package/src/core/structures/PDFPageTree.ts +195 -0
- package/src/core/syntax/CharCodes.ts +62 -0
- package/src/core/syntax/Delimiters.ts +14 -0
- package/src/core/syntax/Irregular.ts +10 -0
- package/src/core/syntax/Keywords.ts +83 -0
- package/src/core/syntax/Numeric.ts +26 -0
- package/src/core/syntax/Whitespace.ts +10 -0
- package/src/core/writers/PDFStreamWriter.ts +158 -0
- package/src/core/writers/PDFWriter.ts +194 -0
- package/src/index.ts +4 -0
- package/src/types/fontkit.ts +640 -0
- package/src/types/index.ts +1 -0
- package/src/types/matrix.ts +29 -0
- package/src/utils/Cache.ts +26 -0
- package/src/utils/arrays.ts +146 -0
- package/src/utils/async.ts +8 -0
- package/src/utils/base64.ts +99 -0
- package/src/utils/errors.ts +3 -0
- package/src/utils/index.ts +11 -0
- package/src/utils/numbers.ts +55 -0
- package/src/utils/objects.ts +13 -0
- package/src/utils/pdfDocEncoding.ts +69 -0
- package/src/utils/png.ts +70 -0
- package/src/utils/rng.ts +21 -0
- package/src/utils/strings.ts +182 -0
- package/src/utils/unicode.ts +386 -0
- package/src/utils/validators.ts +228 -0
- package/ts3.4/apps/deno/dummy.d.ts +20 -0
- package/ts3.4/cjs/api/Embeddable.d.ts +8 -0
- package/ts3.4/cjs/api/PDFDocument.d.ts +800 -0
- package/ts3.4/cjs/api/PDFDocumentOptions.d.ts +43 -0
- package/ts3.4/cjs/api/PDFEmbeddedFile.d.ts +39 -0
- package/ts3.4/cjs/api/PDFEmbeddedPage.d.ts +74 -0
- package/ts3.4/cjs/api/PDFFont.d.ts +95 -0
- package/ts3.4/cjs/api/PDFImage.d.ts +96 -0
- package/ts3.4/cjs/api/PDFJavaScript.d.ts +39 -0
- package/ts3.4/cjs/api/PDFPage.d.ts +898 -0
- package/ts3.4/cjs/api/PDFPageOptions.d.ts +155 -0
- package/ts3.4/cjs/api/StandardFonts.d.ts +17 -0
- package/ts3.4/cjs/api/colors.d.ts +31 -0
- package/ts3.4/cjs/api/errors.d.ts +43 -0
- package/ts3.4/cjs/api/form/PDFButton.d.ts +138 -0
- package/ts3.4/cjs/api/form/PDFCheckBox.d.ts +143 -0
- package/ts3.4/cjs/api/form/PDFDropdown.d.ts +403 -0
- package/ts3.4/cjs/api/form/PDFField.d.ts +204 -0
- package/ts3.4/cjs/api/form/PDFForm.d.ts +412 -0
- package/ts3.4/cjs/api/form/PDFOptionList.d.ts +336 -0
- package/ts3.4/cjs/api/form/PDFRadioGroup.d.ts +253 -0
- package/ts3.4/cjs/api/form/PDFSignature.d.ts +30 -0
- package/ts3.4/cjs/api/form/PDFTextField.d.ts +538 -0
- package/ts3.4/cjs/api/form/appearances.d.ts +42 -0
- package/ts3.4/cjs/api/form/index.d.ts +11 -0
- package/ts3.4/cjs/api/image/alignment.d.ts +6 -0
- package/ts3.4/cjs/api/image/index.d.ts +2 -0
- package/ts3.4/cjs/api/index.d.ts +22 -0
- package/ts3.4/cjs/api/objects.d.ts +5 -0
- package/ts3.4/cjs/api/operations.d.ts +212 -0
- package/ts3.4/cjs/api/operators.d.ts +86 -0
- package/ts3.4/cjs/api/rotations.d.ts +39 -0
- package/ts3.4/cjs/api/sizes.d.ts +53 -0
- package/ts3.4/cjs/api/snapshot/DefaultDocumentSnapshot.d.ts +13 -0
- package/ts3.4/cjs/api/snapshot/DocumentSnapshot.d.ts +11 -0
- package/ts3.4/cjs/api/snapshot/IncrementalDocumentSnapshot.d.ts +16 -0
- package/ts3.4/cjs/api/snapshot/index.d.ts +4 -0
- package/ts3.4/cjs/api/svgPath.d.ts +3 -0
- package/ts3.4/cjs/api/text/alignment.d.ts +6 -0
- package/ts3.4/cjs/api/text/index.d.ts +3 -0
- package/ts3.4/cjs/api/text/layout.d.ts +55 -0
- package/ts3.4/cjs/core/PDFContext.d.ts +93 -0
- package/ts3.4/cjs/core/PDFObjectCopier.d.ts +38 -0
- package/ts3.4/cjs/core/acroform/PDFAcroButton.d.ts +22 -0
- package/ts3.4/cjs/core/acroform/PDFAcroCheckBox.d.ts +14 -0
- package/ts3.4/cjs/core/acroform/PDFAcroChoice.d.ts +21 -0
- package/ts3.4/cjs/core/acroform/PDFAcroComboBox.d.ts +10 -0
- package/ts3.4/cjs/core/acroform/PDFAcroField.d.ts +37 -0
- package/ts3.4/cjs/core/acroform/PDFAcroForm.d.ts +21 -0
- package/ts3.4/cjs/core/acroform/PDFAcroListBox.d.ts +10 -0
- package/ts3.4/cjs/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
- package/ts3.4/cjs/core/acroform/PDFAcroPushButton.d.ts +10 -0
- package/ts3.4/cjs/core/acroform/PDFAcroRadioButton.d.ts +14 -0
- package/ts3.4/cjs/core/acroform/PDFAcroSignature.d.ts +8 -0
- package/ts3.4/cjs/core/acroform/PDFAcroTerminal.d.ts +17 -0
- package/ts3.4/cjs/core/acroform/PDFAcroText.d.ts +23 -0
- package/ts3.4/cjs/core/acroform/flags.d.ts +142 -0
- package/ts3.4/cjs/core/acroform/index.d.ts +16 -0
- package/ts3.4/cjs/core/acroform/utils.d.ts +7 -0
- package/ts3.4/cjs/core/annotation/AppearanceCharacteristics.d.ts +34 -0
- package/ts3.4/cjs/core/annotation/BorderStyle.d.ts +12 -0
- package/ts3.4/cjs/core/annotation/PDFAnnotation.d.ts +52 -0
- package/ts3.4/cjs/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
- package/ts3.4/cjs/core/annotation/flags.d.ts +80 -0
- package/ts3.4/cjs/core/annotation/index.d.ts +5 -0
- package/ts3.4/cjs/core/document/PDFCrossRefSection.d.ts +28 -0
- package/ts3.4/cjs/core/document/PDFHeader.d.ts +11 -0
- package/ts3.4/cjs/core/document/PDFTrailer.d.ts +10 -0
- package/ts3.4/cjs/core/document/PDFTrailerDict.d.ts +11 -0
- package/ts3.4/cjs/core/embedders/CMap.d.ts +4 -0
- package/ts3.4/cjs/core/embedders/CustomFontEmbedder.d.ts +45 -0
- package/ts3.4/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
- package/ts3.4/cjs/core/embedders/FileEmbedder.d.ts +34 -0
- package/ts3.4/cjs/core/embedders/FontFlags.d.ts +14 -0
- package/ts3.4/cjs/core/embedders/JavaScriptEmbedder.d.ts +11 -0
- package/ts3.4/cjs/core/embedders/JpegEmbedder.d.ts +24 -0
- package/ts3.4/cjs/core/embedders/PDFPageEmbedder.d.ts +38 -0
- package/ts3.4/cjs/core/embedders/PngEmbedder.d.ts +20 -0
- package/ts3.4/cjs/core/embedders/StandardFontEmbedder.d.ts +37 -0
- package/ts3.4/cjs/core/errors.d.ts +92 -0
- package/ts3.4/cjs/core/index.d.ts +48 -0
- package/ts3.4/cjs/core/interactive/ViewerPreferences.d.ts +348 -0
- package/ts3.4/cjs/core/objects/PDFArray.d.ts +64 -0
- package/ts3.4/cjs/core/objects/PDFBool.d.ts +14 -0
- package/ts3.4/cjs/core/objects/PDFDict.d.ts +63 -0
- package/ts3.4/cjs/core/objects/PDFHexString.d.ts +17 -0
- package/ts3.4/cjs/core/objects/PDFInvalidObject.d.ts +12 -0
- package/ts3.4/cjs/core/objects/PDFName.d.ts +42 -0
- package/ts3.4/cjs/core/objects/PDFNull.d.ts +11 -0
- package/ts3.4/cjs/core/objects/PDFNumber.d.ts +16 -0
- package/ts3.4/cjs/core/objects/PDFObject.d.ts +10 -0
- package/ts3.4/cjs/core/objects/PDFRawStream.d.ts +15 -0
- package/ts3.4/cjs/core/objects/PDFRef.d.ts +14 -0
- package/ts3.4/cjs/core/objects/PDFStream.d.ts +17 -0
- package/ts3.4/cjs/core/objects/PDFString.d.ts +17 -0
- package/ts3.4/cjs/core/operators/PDFOperator.d.ts +20 -0
- package/ts3.4/cjs/core/operators/PDFOperatorNames.d.ts +77 -0
- package/ts3.4/cjs/core/parser/BaseParser.d.ts +15 -0
- package/ts3.4/cjs/core/parser/ByteStream.d.ts +27 -0
- package/ts3.4/cjs/core/parser/PDFObjectParser.d.ts +30 -0
- package/ts3.4/cjs/core/parser/PDFObjectStreamParser.d.ts +14 -0
- package/ts3.4/cjs/core/parser/PDFParser.d.ts +46 -0
- package/ts3.4/cjs/core/parser/PDFXRefStreamParser.d.ts +22 -0
- package/ts3.4/cjs/core/streams/Ascii85Stream.d.ts +10 -0
- package/ts3.4/cjs/core/streams/AsciiHexStream.d.ts +10 -0
- package/ts3.4/cjs/core/streams/DecodeStream.d.ts +27 -0
- package/ts3.4/cjs/core/streams/FlateStream.d.ts +14 -0
- package/ts3.4/cjs/core/streams/LZWStream.d.ts +13 -0
- package/ts3.4/cjs/core/streams/RunLengthStream.d.ts +9 -0
- package/ts3.4/cjs/core/streams/Stream.d.ts +35 -0
- package/ts3.4/cjs/core/streams/decode.d.ts +4 -0
- package/ts3.4/cjs/core/structures/PDFCatalog.d.ts +28 -0
- package/ts3.4/cjs/core/structures/PDFContentStream.d.ts +16 -0
- package/ts3.4/cjs/core/structures/PDFCrossRefStream.d.ts +54 -0
- package/ts3.4/cjs/core/structures/PDFFlateStream.d.ts +14 -0
- package/ts3.4/cjs/core/structures/PDFObjectStream.d.ts +21 -0
- package/ts3.4/cjs/core/structures/PDFPageLeaf.d.ts +55 -0
- package/ts3.4/cjs/core/structures/PDFPageTree.d.ts +42 -0
- package/ts3.4/cjs/core/syntax/CharCodes.d.ts +62 -0
- package/ts3.4/cjs/core/syntax/Delimiters.d.ts +2 -0
- package/ts3.4/cjs/core/syntax/Irregular.d.ts +2 -0
- package/ts3.4/cjs/core/syntax/Keywords.d.ts +23 -0
- package/ts3.4/cjs/core/syntax/Numeric.d.ts +4 -0
- package/ts3.4/cjs/core/syntax/Whitespace.d.ts +2 -0
- package/ts3.4/cjs/core/writers/PDFStreamWriter.d.ts +22 -0
- package/ts3.4/cjs/core/writers/PDFWriter.d.ts +33 -0
- package/ts3.4/cjs/index.d.ts +5 -0
- package/ts3.4/cjs/types/fontkit.d.ts +582 -0
- package/ts3.4/cjs/types/index.d.ts +2 -0
- package/ts3.4/cjs/types/matrix.d.ts +22 -0
- package/ts3.4/cjs/utils/Cache.d.ts +11 -0
- package/ts3.4/cjs/utils/arrays.d.ts +16 -0
- package/ts3.4/cjs/utils/async.d.ts +6 -0
- package/ts3.4/cjs/utils/base64.d.ts +11 -0
- package/ts3.4/cjs/utils/errors.d.ts +2 -0
- package/ts3.4/cjs/utils/index.d.ts +12 -0
- package/ts3.4/cjs/utils/numbers.d.ts +24 -0
- package/ts3.4/cjs/utils/objects.d.ts +16 -0
- package/ts3.4/cjs/utils/pdfDocEncoding.d.ts +8 -0
- package/ts3.4/cjs/utils/png.d.ts +18 -0
- package/ts3.4/cjs/utils/rng.d.ts +14 -0
- package/ts3.4/cjs/utils/strings.d.ts +25 -0
- package/ts3.4/cjs/utils/unicode.d.ts +187 -0
- package/ts3.4/cjs/utils/validators.d.ts +27 -0
- package/ts3.4/es/api/Embeddable.d.ts +8 -0
- package/ts3.4/es/api/PDFDocument.d.ts +800 -0
- package/ts3.4/es/api/PDFDocumentOptions.d.ts +43 -0
- package/ts3.4/es/api/PDFEmbeddedFile.d.ts +39 -0
- package/ts3.4/es/api/PDFEmbeddedPage.d.ts +74 -0
- package/ts3.4/es/api/PDFFont.d.ts +95 -0
- package/ts3.4/es/api/PDFImage.d.ts +96 -0
- package/ts3.4/es/api/PDFJavaScript.d.ts +39 -0
- package/ts3.4/es/api/PDFPage.d.ts +898 -0
- package/ts3.4/es/api/PDFPageOptions.d.ts +155 -0
- package/ts3.4/es/api/StandardFonts.d.ts +17 -0
- package/ts3.4/es/api/colors.d.ts +31 -0
- package/ts3.4/es/api/errors.d.ts +43 -0
- package/ts3.4/es/api/form/PDFButton.d.ts +138 -0
- package/ts3.4/es/api/form/PDFCheckBox.d.ts +143 -0
- package/ts3.4/es/api/form/PDFDropdown.d.ts +403 -0
- package/ts3.4/es/api/form/PDFField.d.ts +204 -0
- package/ts3.4/es/api/form/PDFForm.d.ts +412 -0
- package/ts3.4/es/api/form/PDFOptionList.d.ts +336 -0
- package/ts3.4/es/api/form/PDFRadioGroup.d.ts +253 -0
- package/ts3.4/es/api/form/PDFSignature.d.ts +30 -0
- package/ts3.4/es/api/form/PDFTextField.d.ts +538 -0
- package/ts3.4/es/api/form/appearances.d.ts +42 -0
- package/ts3.4/es/api/form/index.d.ts +11 -0
- package/ts3.4/es/api/image/alignment.d.ts +6 -0
- package/ts3.4/es/api/image/index.d.ts +2 -0
- package/ts3.4/es/api/index.d.ts +22 -0
- package/ts3.4/es/api/objects.d.ts +5 -0
- package/ts3.4/es/api/operations.d.ts +212 -0
- package/ts3.4/es/api/operators.d.ts +86 -0
- package/ts3.4/es/api/rotations.d.ts +39 -0
- package/ts3.4/es/api/sizes.d.ts +53 -0
- package/ts3.4/es/api/snapshot/DefaultDocumentSnapshot.d.ts +13 -0
- package/ts3.4/es/api/snapshot/DocumentSnapshot.d.ts +11 -0
- package/ts3.4/es/api/snapshot/IncrementalDocumentSnapshot.d.ts +16 -0
- package/ts3.4/es/api/snapshot/index.d.ts +4 -0
- package/ts3.4/es/api/svgPath.d.ts +3 -0
- package/ts3.4/es/api/text/alignment.d.ts +6 -0
- package/ts3.4/es/api/text/index.d.ts +3 -0
- package/ts3.4/es/api/text/layout.d.ts +55 -0
- package/ts3.4/es/core/PDFContext.d.ts +93 -0
- package/ts3.4/es/core/PDFObjectCopier.d.ts +38 -0
- package/ts3.4/es/core/acroform/PDFAcroButton.d.ts +22 -0
- package/ts3.4/es/core/acroform/PDFAcroCheckBox.d.ts +14 -0
- package/ts3.4/es/core/acroform/PDFAcroChoice.d.ts +21 -0
- package/ts3.4/es/core/acroform/PDFAcroComboBox.d.ts +10 -0
- package/ts3.4/es/core/acroform/PDFAcroField.d.ts +37 -0
- package/ts3.4/es/core/acroform/PDFAcroForm.d.ts +21 -0
- package/ts3.4/es/core/acroform/PDFAcroListBox.d.ts +10 -0
- package/ts3.4/es/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
- package/ts3.4/es/core/acroform/PDFAcroPushButton.d.ts +10 -0
- package/ts3.4/es/core/acroform/PDFAcroRadioButton.d.ts +14 -0
- package/ts3.4/es/core/acroform/PDFAcroSignature.d.ts +8 -0
- package/ts3.4/es/core/acroform/PDFAcroTerminal.d.ts +17 -0
- package/ts3.4/es/core/acroform/PDFAcroText.d.ts +23 -0
- package/ts3.4/es/core/acroform/flags.d.ts +142 -0
- package/ts3.4/es/core/acroform/index.d.ts +16 -0
- package/ts3.4/es/core/acroform/utils.d.ts +7 -0
- package/ts3.4/es/core/annotation/AppearanceCharacteristics.d.ts +34 -0
- package/ts3.4/es/core/annotation/BorderStyle.d.ts +12 -0
- package/ts3.4/es/core/annotation/PDFAnnotation.d.ts +52 -0
- package/ts3.4/es/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
- package/ts3.4/es/core/annotation/flags.d.ts +80 -0
- package/ts3.4/es/core/annotation/index.d.ts +5 -0
- package/ts3.4/es/core/document/PDFCrossRefSection.d.ts +28 -0
- package/ts3.4/es/core/document/PDFHeader.d.ts +11 -0
- package/ts3.4/es/core/document/PDFTrailer.d.ts +10 -0
- package/ts3.4/es/core/document/PDFTrailerDict.d.ts +11 -0
- package/ts3.4/es/core/embedders/CMap.d.ts +4 -0
- package/ts3.4/es/core/embedders/CustomFontEmbedder.d.ts +45 -0
- package/ts3.4/es/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
- package/ts3.4/es/core/embedders/FileEmbedder.d.ts +34 -0
- package/ts3.4/es/core/embedders/FontFlags.d.ts +14 -0
- package/ts3.4/es/core/embedders/JavaScriptEmbedder.d.ts +11 -0
- package/ts3.4/es/core/embedders/JpegEmbedder.d.ts +24 -0
- package/ts3.4/es/core/embedders/PDFPageEmbedder.d.ts +38 -0
- package/ts3.4/es/core/embedders/PngEmbedder.d.ts +20 -0
- package/ts3.4/es/core/embedders/StandardFontEmbedder.d.ts +37 -0
- package/ts3.4/es/core/errors.d.ts +92 -0
- package/ts3.4/es/core/index.d.ts +48 -0
- package/ts3.4/es/core/interactive/ViewerPreferences.d.ts +348 -0
- package/ts3.4/es/core/objects/PDFArray.d.ts +64 -0
- package/ts3.4/es/core/objects/PDFBool.d.ts +14 -0
- package/ts3.4/es/core/objects/PDFDict.d.ts +63 -0
- package/ts3.4/es/core/objects/PDFHexString.d.ts +17 -0
- package/ts3.4/es/core/objects/PDFInvalidObject.d.ts +12 -0
- package/ts3.4/es/core/objects/PDFName.d.ts +42 -0
- package/ts3.4/es/core/objects/PDFNull.d.ts +11 -0
- package/ts3.4/es/core/objects/PDFNumber.d.ts +16 -0
- package/ts3.4/es/core/objects/PDFObject.d.ts +10 -0
- package/ts3.4/es/core/objects/PDFRawStream.d.ts +15 -0
- package/ts3.4/es/core/objects/PDFRef.d.ts +14 -0
- package/ts3.4/es/core/objects/PDFStream.d.ts +17 -0
- package/ts3.4/es/core/objects/PDFString.d.ts +17 -0
- package/ts3.4/es/core/operators/PDFOperator.d.ts +20 -0
- package/ts3.4/es/core/operators/PDFOperatorNames.d.ts +77 -0
- package/ts3.4/es/core/parser/BaseParser.d.ts +15 -0
- package/ts3.4/es/core/parser/ByteStream.d.ts +27 -0
- package/ts3.4/es/core/parser/PDFObjectParser.d.ts +30 -0
- package/ts3.4/es/core/parser/PDFObjectStreamParser.d.ts +14 -0
- package/ts3.4/es/core/parser/PDFParser.d.ts +46 -0
- package/ts3.4/es/core/parser/PDFXRefStreamParser.d.ts +22 -0
- package/ts3.4/es/core/streams/Ascii85Stream.d.ts +10 -0
- package/ts3.4/es/core/streams/AsciiHexStream.d.ts +10 -0
- package/ts3.4/es/core/streams/DecodeStream.d.ts +27 -0
- package/ts3.4/es/core/streams/FlateStream.d.ts +14 -0
- package/ts3.4/es/core/streams/LZWStream.d.ts +13 -0
- package/ts3.4/es/core/streams/RunLengthStream.d.ts +9 -0
- package/ts3.4/es/core/streams/Stream.d.ts +35 -0
- package/ts3.4/es/core/streams/decode.d.ts +4 -0
- package/ts3.4/es/core/structures/PDFCatalog.d.ts +28 -0
- package/ts3.4/es/core/structures/PDFContentStream.d.ts +16 -0
- package/ts3.4/es/core/structures/PDFCrossRefStream.d.ts +54 -0
- package/ts3.4/es/core/structures/PDFFlateStream.d.ts +14 -0
- package/ts3.4/es/core/structures/PDFObjectStream.d.ts +21 -0
- package/ts3.4/es/core/structures/PDFPageLeaf.d.ts +55 -0
- package/ts3.4/es/core/structures/PDFPageTree.d.ts +42 -0
- package/ts3.4/es/core/syntax/CharCodes.d.ts +62 -0
- package/ts3.4/es/core/syntax/Delimiters.d.ts +2 -0
- package/ts3.4/es/core/syntax/Irregular.d.ts +2 -0
- package/ts3.4/es/core/syntax/Keywords.d.ts +23 -0
- package/ts3.4/es/core/syntax/Numeric.d.ts +4 -0
- package/ts3.4/es/core/syntax/Whitespace.d.ts +2 -0
- package/ts3.4/es/core/writers/PDFStreamWriter.d.ts +22 -0
- package/ts3.4/es/core/writers/PDFWriter.d.ts +33 -0
- package/ts3.4/es/index.d.ts +5 -0
- package/ts3.4/es/types/fontkit.d.ts +582 -0
- package/ts3.4/es/types/index.d.ts +2 -0
- package/ts3.4/es/types/matrix.d.ts +22 -0
- package/ts3.4/es/utils/Cache.d.ts +11 -0
- package/ts3.4/es/utils/arrays.d.ts +16 -0
- package/ts3.4/es/utils/async.d.ts +6 -0
- package/ts3.4/es/utils/base64.d.ts +11 -0
- package/ts3.4/es/utils/errors.d.ts +2 -0
- package/ts3.4/es/utils/index.d.ts +12 -0
- package/ts3.4/es/utils/numbers.d.ts +24 -0
- package/ts3.4/es/utils/objects.d.ts +16 -0
- package/ts3.4/es/utils/pdfDocEncoding.d.ts +8 -0
- package/ts3.4/es/utils/png.d.ts +18 -0
- package/ts3.4/es/utils/rng.d.ts +14 -0
- package/ts3.4/es/utils/strings.d.ts +25 -0
- package/ts3.4/es/utils/unicode.d.ts +187 -0
- package/ts3.4/es/utils/validators.d.ts +27 -0
- package/yarn.lock +4446 -0
|
@@ -0,0 +1,1442 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var colors_1 = require("./colors");
|
|
5
|
+
var operations_1 = require("./operations");
|
|
6
|
+
var operators_1 = require("./operators");
|
|
7
|
+
var PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument"));
|
|
8
|
+
var PDFEmbeddedPage_1 = tslib_1.__importDefault(require("./PDFEmbeddedPage"));
|
|
9
|
+
var PDFFont_1 = tslib_1.__importDefault(require("./PDFFont"));
|
|
10
|
+
var PDFImage_1 = tslib_1.__importDefault(require("./PDFImage"));
|
|
11
|
+
var PDFPageOptions_1 = require("./PDFPageOptions");
|
|
12
|
+
var rotations_1 = require("./rotations");
|
|
13
|
+
var StandardFonts_1 = require("./StandardFonts");
|
|
14
|
+
var core_1 = require("../core");
|
|
15
|
+
var utils_1 = require("../utils");
|
|
16
|
+
/**
|
|
17
|
+
* Represents a single page of a [[PDFDocument]].
|
|
18
|
+
*/
|
|
19
|
+
var PDFPage = /** @class */ (function () {
|
|
20
|
+
function PDFPage(leafNode, ref, doc) {
|
|
21
|
+
this.fontSize = 24;
|
|
22
|
+
this.fontColor = colors_1.rgb(0, 0, 0);
|
|
23
|
+
this.lineHeight = 24;
|
|
24
|
+
this.x = 0;
|
|
25
|
+
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']]);
|
|
29
|
+
this.node = leafNode;
|
|
30
|
+
this.ref = ref;
|
|
31
|
+
this.doc = doc;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Rotate this page by a multiple of 90 degrees. For example:
|
|
35
|
+
* ```js
|
|
36
|
+
* import { degrees } from 'pdf-lib'
|
|
37
|
+
*
|
|
38
|
+
* page.setRotation(degrees(-90))
|
|
39
|
+
* page.setRotation(degrees(0))
|
|
40
|
+
* page.setRotation(degrees(90))
|
|
41
|
+
* page.setRotation(degrees(180))
|
|
42
|
+
* page.setRotation(degrees(270))
|
|
43
|
+
* ```
|
|
44
|
+
* @param angle The angle to rotate this page.
|
|
45
|
+
*/
|
|
46
|
+
PDFPage.prototype.setRotation = function (angle) {
|
|
47
|
+
var degreesAngle = rotations_1.toDegrees(angle);
|
|
48
|
+
utils_1.assertMultiple(degreesAngle, 'degreesAngle', 90);
|
|
49
|
+
this.node.set(core_1.PDFName.of('Rotate'), this.doc.context.obj(degreesAngle));
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Get this page's rotation angle in degrees. For example:
|
|
53
|
+
* ```js
|
|
54
|
+
* const rotationAngle = page.getRotation().angle;
|
|
55
|
+
* ```
|
|
56
|
+
* @returns The rotation angle of the page in degrees (always a multiple of
|
|
57
|
+
* 90 degrees).
|
|
58
|
+
*/
|
|
59
|
+
PDFPage.prototype.getRotation = function () {
|
|
60
|
+
var Rotate = this.node.Rotate();
|
|
61
|
+
return rotations_1.degrees(Rotate ? Rotate.asNumber() : 0);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Resize this page by increasing or decreasing its width and height. For
|
|
65
|
+
* example:
|
|
66
|
+
* ```js
|
|
67
|
+
* page.setSize(250, 500)
|
|
68
|
+
* page.setSize(page.getWidth() + 50, page.getHeight() + 100)
|
|
69
|
+
* page.setSize(page.getWidth() - 50, page.getHeight() - 100)
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* Note that the PDF specification does not allow for pages to have explicit
|
|
73
|
+
* widths and heights. Instead it defines the "size" of a page in terms of
|
|
74
|
+
* five rectangles: the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox. As a
|
|
75
|
+
* result, this method cannot directly change the width and height of a page.
|
|
76
|
+
* Instead, it works by adjusting these five boxes.
|
|
77
|
+
*
|
|
78
|
+
* This method performs the following steps:
|
|
79
|
+
* 1. Set width & height of MediaBox.
|
|
80
|
+
* 2. Set width & height of CropBox, if it has same dimensions as MediaBox.
|
|
81
|
+
* 3. Set width & height of BleedBox, if it has same dimensions as MediaBox.
|
|
82
|
+
* 4. Set width & height of TrimBox, if it has same dimensions as MediaBox.
|
|
83
|
+
* 5. Set width & height of ArtBox, if it has same dimensions as MediaBox.
|
|
84
|
+
*
|
|
85
|
+
* This approach works well for most PDF documents as all PDF pages must
|
|
86
|
+
* have a MediaBox, but relatively few have a CropBox, BleedBox, TrimBox, or
|
|
87
|
+
* ArtBox. And when they do have these additional boxes, they often have the
|
|
88
|
+
* same dimensions as the MediaBox. However, if you find this method does not
|
|
89
|
+
* work for your document, consider setting the boxes directly:
|
|
90
|
+
* * [[PDFPage.setMediaBox]]
|
|
91
|
+
* * [[PDFPage.setCropBox]]
|
|
92
|
+
* * [[PDFPage.setBleedBox]]
|
|
93
|
+
* * [[PDFPage.setTrimBox]]
|
|
94
|
+
* * [[PDFPage.setArtBox]]
|
|
95
|
+
*
|
|
96
|
+
* @param width The new width of the page.
|
|
97
|
+
* @param height The new height of the page.
|
|
98
|
+
*/
|
|
99
|
+
PDFPage.prototype.setSize = function (width, height) {
|
|
100
|
+
utils_1.assertIs(width, 'width', ['number']);
|
|
101
|
+
utils_1.assertIs(height, 'height', ['number']);
|
|
102
|
+
var mediaBox = this.getMediaBox();
|
|
103
|
+
this.setMediaBox(mediaBox.x, mediaBox.y, width, height);
|
|
104
|
+
var cropBox = this.getCropBox();
|
|
105
|
+
var bleedBox = this.getBleedBox();
|
|
106
|
+
var trimBox = this.getTrimBox();
|
|
107
|
+
var artBox = this.getArtBox();
|
|
108
|
+
var hasCropBox = this.node.CropBox();
|
|
109
|
+
var hasBleedBox = this.node.BleedBox();
|
|
110
|
+
var hasTrimBox = this.node.TrimBox();
|
|
111
|
+
var hasArtBox = this.node.ArtBox();
|
|
112
|
+
if (hasCropBox && utils_1.rectanglesAreEqual(cropBox, mediaBox)) {
|
|
113
|
+
this.setCropBox(mediaBox.x, mediaBox.y, width, height);
|
|
114
|
+
}
|
|
115
|
+
if (hasBleedBox && utils_1.rectanglesAreEqual(bleedBox, mediaBox)) {
|
|
116
|
+
this.setBleedBox(mediaBox.x, mediaBox.y, width, height);
|
|
117
|
+
}
|
|
118
|
+
if (hasTrimBox && utils_1.rectanglesAreEqual(trimBox, mediaBox)) {
|
|
119
|
+
this.setTrimBox(mediaBox.x, mediaBox.y, width, height);
|
|
120
|
+
}
|
|
121
|
+
if (hasArtBox && utils_1.rectanglesAreEqual(artBox, mediaBox)) {
|
|
122
|
+
this.setArtBox(mediaBox.x, mediaBox.y, width, height);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Resize this page by increasing or decreasing its width. For example:
|
|
127
|
+
* ```js
|
|
128
|
+
* page.setWidth(250)
|
|
129
|
+
* page.setWidth(page.getWidth() + 50)
|
|
130
|
+
* page.setWidth(page.getWidth() - 50)
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* This method uses [[PDFPage.setSize]] to set the page's width.
|
|
134
|
+
*
|
|
135
|
+
* @param width The new width of the page.
|
|
136
|
+
*/
|
|
137
|
+
PDFPage.prototype.setWidth = function (width) {
|
|
138
|
+
utils_1.assertIs(width, 'width', ['number']);
|
|
139
|
+
this.setSize(width, this.getSize().height);
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Resize this page by increasing or decreasing its height. For example:
|
|
143
|
+
* ```js
|
|
144
|
+
* page.setHeight(500)
|
|
145
|
+
* page.setHeight(page.getWidth() + 100)
|
|
146
|
+
* page.setHeight(page.getWidth() - 100)
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* This method uses [[PDFPage.setSize]] to set the page's height.
|
|
150
|
+
*
|
|
151
|
+
* @param height The new height of the page.
|
|
152
|
+
*/
|
|
153
|
+
PDFPage.prototype.setHeight = function (height) {
|
|
154
|
+
utils_1.assertIs(height, 'height', ['number']);
|
|
155
|
+
this.setSize(this.getSize().width, height);
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Set the MediaBox of this page. For example:
|
|
159
|
+
* ```js
|
|
160
|
+
* const mediaBox = page.getMediaBox()
|
|
161
|
+
*
|
|
162
|
+
* page.setMediaBox(0, 0, 250, 500)
|
|
163
|
+
* page.setMediaBox(mediaBox.x, mediaBox.y, 50, 100)
|
|
164
|
+
* page.setMediaBox(15, 5, mediaBox.width - 50, mediaBox.height - 100)
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* See [[PDFPage.getMediaBox]] for details about what the MediaBox represents.
|
|
168
|
+
*
|
|
169
|
+
* @param x The x coordinate of the lower left corner of the new MediaBox.
|
|
170
|
+
* @param y The y coordinate of the lower left corner of the new MediaBox.
|
|
171
|
+
* @param width The width of the new MediaBox.
|
|
172
|
+
* @param height The height of the new MediaBox.
|
|
173
|
+
*/
|
|
174
|
+
PDFPage.prototype.setMediaBox = function (x, y, width, height) {
|
|
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
|
+
var mediaBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
180
|
+
this.node.set(core_1.PDFName.MediaBox, mediaBox);
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Set the CropBox of this page. For example:
|
|
184
|
+
* ```js
|
|
185
|
+
* const cropBox = page.getCropBox()
|
|
186
|
+
*
|
|
187
|
+
* page.setCropBox(0, 0, 250, 500)
|
|
188
|
+
* page.setCropBox(cropBox.x, cropBox.y, 50, 100)
|
|
189
|
+
* page.setCropBox(15, 5, cropBox.width - 50, cropBox.height - 100)
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* See [[PDFPage.getCropBox]] for details about what the CropBox represents.
|
|
193
|
+
*
|
|
194
|
+
* @param x The x coordinate of the lower left corner of the new CropBox.
|
|
195
|
+
* @param y The y coordinate of the lower left corner of the new CropBox.
|
|
196
|
+
* @param width The width of the new CropBox.
|
|
197
|
+
* @param height The height of the new CropBox.
|
|
198
|
+
*/
|
|
199
|
+
PDFPage.prototype.setCropBox = function (x, y, width, height) {
|
|
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
|
+
var cropBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
205
|
+
this.node.set(core_1.PDFName.CropBox, cropBox);
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Set the BleedBox of this page. For example:
|
|
209
|
+
* ```js
|
|
210
|
+
* const bleedBox = page.getBleedBox()
|
|
211
|
+
*
|
|
212
|
+
* page.setBleedBox(0, 0, 250, 500)
|
|
213
|
+
* page.setBleedBox(bleedBox.x, bleedBox.y, 50, 100)
|
|
214
|
+
* page.setBleedBox(15, 5, bleedBox.width - 50, bleedBox.height - 100)
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* See [[PDFPage.getBleedBox]] for details about what the BleedBox represents.
|
|
218
|
+
*
|
|
219
|
+
* @param x The x coordinate of the lower left corner of the new BleedBox.
|
|
220
|
+
* @param y The y coordinate of the lower left corner of the new BleedBox.
|
|
221
|
+
* @param width The width of the new BleedBox.
|
|
222
|
+
* @param height The height of the new BleedBox.
|
|
223
|
+
*/
|
|
224
|
+
PDFPage.prototype.setBleedBox = function (x, y, width, height) {
|
|
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
|
+
var bleedBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
230
|
+
this.node.set(core_1.PDFName.BleedBox, bleedBox);
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Set the TrimBox of this page. For example:
|
|
234
|
+
* ```js
|
|
235
|
+
* const trimBox = page.getTrimBox()
|
|
236
|
+
*
|
|
237
|
+
* page.setTrimBox(0, 0, 250, 500)
|
|
238
|
+
* page.setTrimBox(trimBox.x, trimBox.y, 50, 100)
|
|
239
|
+
* page.setTrimBox(15, 5, trimBox.width - 50, trimBox.height - 100)
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* See [[PDFPage.getTrimBox]] for details about what the TrimBox represents.
|
|
243
|
+
*
|
|
244
|
+
* @param x The x coordinate of the lower left corner of the new TrimBox.
|
|
245
|
+
* @param y The y coordinate of the lower left corner of the new TrimBox.
|
|
246
|
+
* @param width The width of the new TrimBox.
|
|
247
|
+
* @param height The height of the new TrimBox.
|
|
248
|
+
*/
|
|
249
|
+
PDFPage.prototype.setTrimBox = function (x, y, width, height) {
|
|
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
|
+
var trimBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
255
|
+
this.node.set(core_1.PDFName.TrimBox, trimBox);
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Set the ArtBox of this page. For example:
|
|
259
|
+
* ```js
|
|
260
|
+
* const artBox = page.getArtBox()
|
|
261
|
+
*
|
|
262
|
+
* page.setArtBox(0, 0, 250, 500)
|
|
263
|
+
* page.setArtBox(artBox.x, artBox.y, 50, 100)
|
|
264
|
+
* page.setArtBox(15, 5, artBox.width - 50, artBox.height - 100)
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* See [[PDFPage.getArtBox]] for details about what the ArtBox represents.
|
|
268
|
+
*
|
|
269
|
+
* @param x The x coordinate of the lower left corner of the new ArtBox.
|
|
270
|
+
* @param y The y coordinate of the lower left corner of the new ArtBox.
|
|
271
|
+
* @param width The width of the new ArtBox.
|
|
272
|
+
* @param height The height of the new ArtBox.
|
|
273
|
+
*/
|
|
274
|
+
PDFPage.prototype.setArtBox = function (x, y, width, height) {
|
|
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
|
+
var artBox = this.doc.context.obj([x, y, x + width, y + height]);
|
|
280
|
+
this.node.set(core_1.PDFName.ArtBox, artBox);
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Get this page's width and height. For example:
|
|
284
|
+
* ```js
|
|
285
|
+
* const { width, height } = page.getSize()
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* This method uses [[PDFPage.getMediaBox]] to obtain the page's
|
|
289
|
+
* width and height.
|
|
290
|
+
*
|
|
291
|
+
* @returns The width and height of the page.
|
|
292
|
+
*/
|
|
293
|
+
PDFPage.prototype.getSize = function () {
|
|
294
|
+
var _a = this.getMediaBox(), width = _a.width, height = _a.height;
|
|
295
|
+
return { width: width, height: height };
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Get this page's width. For example:
|
|
299
|
+
* ```js
|
|
300
|
+
* const width = page.getWidth()
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* This method uses [[PDFPage.getSize]] to obtain the page's size.
|
|
304
|
+
*
|
|
305
|
+
* @returns The width of the page.
|
|
306
|
+
*/
|
|
307
|
+
PDFPage.prototype.getWidth = function () {
|
|
308
|
+
return this.getSize().width;
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Get this page's height. For example:
|
|
312
|
+
* ```js
|
|
313
|
+
* const height = page.getHeight()
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* This method uses [[PDFPage.getSize]] to obtain the page's size.
|
|
317
|
+
*
|
|
318
|
+
* @returns The height of the page.
|
|
319
|
+
*/
|
|
320
|
+
PDFPage.prototype.getHeight = function () {
|
|
321
|
+
return this.getSize().height;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Get the rectangle defining this page's MediaBox. For example:
|
|
325
|
+
* ```js
|
|
326
|
+
* const { x, y, width, height } = page.getMediaBox()
|
|
327
|
+
* ```
|
|
328
|
+
*
|
|
329
|
+
* The MediaBox of a page defines the boundaries of the physical medium on
|
|
330
|
+
* which the page is to be displayed/printed. It may include extended area
|
|
331
|
+
* surrounding the page content for bleed marks, printing marks, etc...
|
|
332
|
+
* It may also include areas close to the edges of the medium that cannot be
|
|
333
|
+
* marked because of physical limitations of the output device. Content
|
|
334
|
+
* falling outside this boundary may safely be discarded without affecting
|
|
335
|
+
* the meaning of the PDF file.
|
|
336
|
+
*
|
|
337
|
+
* @returns An object defining the lower left corner of the MediaBox and its
|
|
338
|
+
* width & height.
|
|
339
|
+
*/
|
|
340
|
+
PDFPage.prototype.getMediaBox = function () {
|
|
341
|
+
var mediaBox = this.node.MediaBox();
|
|
342
|
+
return mediaBox.asRectangle();
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Get the rectangle defining this page's CropBox. For example:
|
|
346
|
+
* ```js
|
|
347
|
+
* const { x, y, width, height } = page.getCropBox()
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* The CropBox of a page defines the region to which the contents of the page
|
|
351
|
+
* shall be clipped when displayed or printed. Unlike the other boxes, the
|
|
352
|
+
* CropBox does not necessarily represent the physical page geometry. It
|
|
353
|
+
* merely imposes clipping on the page contents.
|
|
354
|
+
*
|
|
355
|
+
* The CropBox's default value is the page's MediaBox.
|
|
356
|
+
*
|
|
357
|
+
* @returns An object defining the lower left corner of the CropBox and its
|
|
358
|
+
* width & height.
|
|
359
|
+
*/
|
|
360
|
+
PDFPage.prototype.getCropBox = function () {
|
|
361
|
+
var _a;
|
|
362
|
+
var cropBox = this.node.CropBox();
|
|
363
|
+
return (_a = cropBox === null || cropBox === void 0 ? void 0 : cropBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getMediaBox();
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Get the rectangle defining this page's BleedBox. For example:
|
|
367
|
+
* ```js
|
|
368
|
+
* const { x, y, width, height } = page.getBleedBox()
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* The BleedBox of a page defines the region to which the contents of the
|
|
372
|
+
* page shall be clipped when output in a production environment. This may
|
|
373
|
+
* include any extra bleed area needed to accommodate the physical
|
|
374
|
+
* limitations of cutting, folding, and trimming equipment. The actual
|
|
375
|
+
* printed page may include printing marks that fall outside the BleedBox.
|
|
376
|
+
*
|
|
377
|
+
* The BleedBox's default value is the page's CropBox.
|
|
378
|
+
*
|
|
379
|
+
* @returns An object defining the lower left corner of the BleedBox and its
|
|
380
|
+
* width & height.
|
|
381
|
+
*/
|
|
382
|
+
PDFPage.prototype.getBleedBox = function () {
|
|
383
|
+
var _a;
|
|
384
|
+
var bleedBox = this.node.BleedBox();
|
|
385
|
+
return (_a = bleedBox === null || bleedBox === void 0 ? void 0 : bleedBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Get the rectangle defining this page's TrimBox. For example:
|
|
389
|
+
* ```js
|
|
390
|
+
* const { x, y, width, height } = page.getTrimBox()
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* The TrimBox of a page defines the intended dimensions of the finished
|
|
394
|
+
* page after trimming. It may be smaller than the MediaBox to allow for
|
|
395
|
+
* production-related content, such as printing instructions, cut marks, or
|
|
396
|
+
* color bars.
|
|
397
|
+
*
|
|
398
|
+
* The TrimBox's default value is the page's CropBox.
|
|
399
|
+
*
|
|
400
|
+
* @returns An object defining the lower left corner of the TrimBox and its
|
|
401
|
+
* width & height.
|
|
402
|
+
*/
|
|
403
|
+
PDFPage.prototype.getTrimBox = function () {
|
|
404
|
+
var _a;
|
|
405
|
+
var trimBox = this.node.TrimBox();
|
|
406
|
+
return (_a = trimBox === null || trimBox === void 0 ? void 0 : trimBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Get the rectangle defining this page's ArtBox. For example:
|
|
410
|
+
* ```js
|
|
411
|
+
* const { x, y, width, height } = page.getArtBox()
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
414
|
+
* The ArtBox of a page defines the extent of the page's meaningful content
|
|
415
|
+
* (including potential white space).
|
|
416
|
+
*
|
|
417
|
+
* The ArtBox's default value is the page's CropBox.
|
|
418
|
+
*
|
|
419
|
+
* @returns An object defining the lower left corner of the ArtBox and its
|
|
420
|
+
* width & height.
|
|
421
|
+
*/
|
|
422
|
+
PDFPage.prototype.getArtBox = function () {
|
|
423
|
+
var _a;
|
|
424
|
+
var artBox = this.node.ArtBox();
|
|
425
|
+
return (_a = artBox === null || artBox === void 0 ? void 0 : artBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Translate this page's content to a new location on the page. This operation
|
|
429
|
+
* is often useful after resizing the page with [[setSize]]. For example:
|
|
430
|
+
* ```js
|
|
431
|
+
* // Add 50 units of whitespace to the top and right of the page
|
|
432
|
+
* page.setSize(page.getWidth() + 50, page.getHeight() + 50)
|
|
433
|
+
*
|
|
434
|
+
* // Move the page's content from the lower-left corner of the page
|
|
435
|
+
* // to the top-right corner.
|
|
436
|
+
* page.translateContent(50, 50)
|
|
437
|
+
*
|
|
438
|
+
* // Now there are 50 units of whitespace to the left and bottom of the page
|
|
439
|
+
* ```
|
|
440
|
+
* See also: [[resetPosition]]
|
|
441
|
+
* @param x The new position on the x-axis for this page's content.
|
|
442
|
+
* @param y The new position on the y-axis for this page's content.
|
|
443
|
+
*/
|
|
444
|
+
PDFPage.prototype.translateContent = function (x, y) {
|
|
445
|
+
utils_1.assertIs(x, 'x', ['number']);
|
|
446
|
+
utils_1.assertIs(y, 'y', ['number']);
|
|
447
|
+
this.node.normalize();
|
|
448
|
+
this.getContentStream();
|
|
449
|
+
var start = this.createContentStream(operators_1.pushGraphicsState(), operators_1.translate(x, y));
|
|
450
|
+
var startRef = this.doc.context.register(start);
|
|
451
|
+
var end = this.createContentStream(operators_1.popGraphicsState());
|
|
452
|
+
var endRef = this.doc.context.register(end);
|
|
453
|
+
this.node.wrapContentStreams(startRef, endRef);
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Scale the size, content, and annotations of a page.
|
|
457
|
+
*
|
|
458
|
+
* For example:
|
|
459
|
+
* ```js
|
|
460
|
+
* page.scale(0.5, 0.5);
|
|
461
|
+
* ```
|
|
462
|
+
*
|
|
463
|
+
* @param x The factor by which the width for the page should be scaled
|
|
464
|
+
* (e.g. `0.5` is 50%).
|
|
465
|
+
* @param y The factor by which the height for the page should be scaled
|
|
466
|
+
* (e.g. `2.0` is 200%).
|
|
467
|
+
*/
|
|
468
|
+
PDFPage.prototype.scale = function (x, y) {
|
|
469
|
+
utils_1.assertIs(x, 'x', ['number']);
|
|
470
|
+
utils_1.assertIs(y, 'y', ['number']);
|
|
471
|
+
this.setSize(this.getWidth() * x, this.getHeight() * y);
|
|
472
|
+
this.scaleContent(x, y);
|
|
473
|
+
this.scaleAnnotations(x, y);
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* Scale the content of a page. This is useful after resizing an existing
|
|
477
|
+
* page. This scales only the content, not the annotations.
|
|
478
|
+
*
|
|
479
|
+
* For example:
|
|
480
|
+
* ```js
|
|
481
|
+
* // Bisect the size of the page
|
|
482
|
+
* page.setSize(page.getWidth() / 2, page.getHeight() / 2);
|
|
483
|
+
*
|
|
484
|
+
* // Scale the content of the page down by 50% in x and y
|
|
485
|
+
* page.scaleContent(0.5, 0.5);
|
|
486
|
+
* ```
|
|
487
|
+
* See also: [[scaleAnnotations]]
|
|
488
|
+
* @param x The factor by which the x-axis for the content should be scaled
|
|
489
|
+
* (e.g. `0.5` is 50%).
|
|
490
|
+
* @param y The factor by which the y-axis for the content should be scaled
|
|
491
|
+
* (e.g. `2.0` is 200%).
|
|
492
|
+
*/
|
|
493
|
+
PDFPage.prototype.scaleContent = function (x, y) {
|
|
494
|
+
utils_1.assertIs(x, 'x', ['number']);
|
|
495
|
+
utils_1.assertIs(y, 'y', ['number']);
|
|
496
|
+
this.node.normalize();
|
|
497
|
+
this.getContentStream();
|
|
498
|
+
var start = this.createContentStream(operators_1.pushGraphicsState(), operators_1.scale(x, y));
|
|
499
|
+
var startRef = this.doc.context.register(start);
|
|
500
|
+
var end = this.createContentStream(operators_1.popGraphicsState());
|
|
501
|
+
var endRef = this.doc.context.register(end);
|
|
502
|
+
this.node.wrapContentStreams(startRef, endRef);
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* Scale the annotations of a page. This is useful if you want to scale a
|
|
506
|
+
* page with comments or other annotations.
|
|
507
|
+
* ```js
|
|
508
|
+
* // Scale the content of the page down by 50% in x and y
|
|
509
|
+
* page.scaleContent(0.5, 0.5);
|
|
510
|
+
*
|
|
511
|
+
* // Scale the content of the page down by 50% in x and y
|
|
512
|
+
* page.scaleAnnotations(0.5, 0.5);
|
|
513
|
+
* ```
|
|
514
|
+
* See also: [[scaleContent]]
|
|
515
|
+
* @param x The factor by which the x-axis for the annotations should be
|
|
516
|
+
* scaled (e.g. `0.5` is 50%).
|
|
517
|
+
* @param y The factor by which the y-axis for the annotations should be
|
|
518
|
+
* scaled (e.g. `2.0` is 200%).
|
|
519
|
+
*/
|
|
520
|
+
PDFPage.prototype.scaleAnnotations = function (x, y) {
|
|
521
|
+
utils_1.assertIs(x, 'x', ['number']);
|
|
522
|
+
utils_1.assertIs(y, 'y', ['number']);
|
|
523
|
+
var annots = this.node.Annots();
|
|
524
|
+
if (!annots)
|
|
525
|
+
return;
|
|
526
|
+
for (var idx = 0; idx < annots.size(); idx++) {
|
|
527
|
+
var annot = annots.lookup(idx);
|
|
528
|
+
if (annot instanceof core_1.PDFDict)
|
|
529
|
+
this.scaleAnnot(annot, x, y);
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* Reset the x and y coordinates of this page to `(0, 0)`. This operation is
|
|
534
|
+
* often useful after calling [[translateContent]]. For example:
|
|
535
|
+
* ```js
|
|
536
|
+
* // Shift the page's contents up and to the right by 50 units
|
|
537
|
+
* page.translateContent(50, 50)
|
|
538
|
+
*
|
|
539
|
+
* // This text will shifted - it will be drawn at (50, 50)
|
|
540
|
+
* page.drawText('I am shifted')
|
|
541
|
+
*
|
|
542
|
+
* // Move back to (0, 0)
|
|
543
|
+
* page.resetPosition()
|
|
544
|
+
*
|
|
545
|
+
* // This text will not be shifted - it will be drawn at (0, 0)
|
|
546
|
+
* page.drawText('I am not shifted')
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
PDFPage.prototype.resetPosition = function () {
|
|
550
|
+
this.getContentStream(false);
|
|
551
|
+
this.x = 0;
|
|
552
|
+
this.y = 0;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Choose a default font for this page. The default font will be used whenever
|
|
556
|
+
* text is drawn on this page and no font is specified. For example:
|
|
557
|
+
* ```js
|
|
558
|
+
* import { StandardFonts } from 'pdf-lib'
|
|
559
|
+
*
|
|
560
|
+
* const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
|
|
561
|
+
* const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)
|
|
562
|
+
* const courierFont = await pdfDoc.embedFont(StandardFonts.Courier)
|
|
563
|
+
*
|
|
564
|
+
* const page = pdfDoc.addPage()
|
|
565
|
+
*
|
|
566
|
+
* page.setFont(helveticaFont)
|
|
567
|
+
* page.drawText('I will be drawn in Helvetica')
|
|
568
|
+
*
|
|
569
|
+
* page.setFont(timesRomanFont)
|
|
570
|
+
* page.drawText('I will be drawn in Courier', { font: courierFont })
|
|
571
|
+
* ```
|
|
572
|
+
* @param font The default font to be used when drawing text on this page.
|
|
573
|
+
*/
|
|
574
|
+
PDFPage.prototype.setFont = function (font) {
|
|
575
|
+
// 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
|
+
this.font = font;
|
|
578
|
+
this.fontKey = this.node.newFontDictionary(this.font.name, this.font.ref);
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* Choose a default font size for this page. The default font size will be
|
|
582
|
+
* used whenever text is drawn on this page and no font size is specified.
|
|
583
|
+
* For example:
|
|
584
|
+
* ```js
|
|
585
|
+
* page.setFontSize(12)
|
|
586
|
+
* page.drawText('I will be drawn in size 12')
|
|
587
|
+
*
|
|
588
|
+
* page.setFontSize(36)
|
|
589
|
+
* page.drawText('I will be drawn in size 24', { fontSize: 24 })
|
|
590
|
+
* ```
|
|
591
|
+
* @param fontSize The default font size to be used when drawing text on this
|
|
592
|
+
* page.
|
|
593
|
+
*/
|
|
594
|
+
PDFPage.prototype.setFontSize = function (fontSize) {
|
|
595
|
+
utils_1.assertIs(fontSize, 'fontSize', ['number']);
|
|
596
|
+
this.fontSize = fontSize;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* Choose a default font color for this page. The default font color will be
|
|
600
|
+
* used whenever text is drawn on this page and no font color is specified.
|
|
601
|
+
* For example:
|
|
602
|
+
* ```js
|
|
603
|
+
* import { rgb, cmyk, grayscale } from 'pdf-lib'
|
|
604
|
+
*
|
|
605
|
+
* page.setFontColor(rgb(0.97, 0.02, 0.97))
|
|
606
|
+
* page.drawText('I will be drawn in pink')
|
|
607
|
+
*
|
|
608
|
+
* page.setFontColor(cmyk(0.4, 0.7, 0.39, 0.15))
|
|
609
|
+
* page.drawText('I will be drawn in gray', { color: grayscale(0.5) })
|
|
610
|
+
* ```
|
|
611
|
+
* @param fontColor The default font color to be used when drawing text on
|
|
612
|
+
* this page.
|
|
613
|
+
*/
|
|
614
|
+
PDFPage.prototype.setFontColor = function (fontColor) {
|
|
615
|
+
utils_1.assertIs(fontColor, 'fontColor', [[Object, 'Color']]);
|
|
616
|
+
this.fontColor = fontColor;
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* Choose a default line height for this page. The default line height will be
|
|
620
|
+
* used whenever text is drawn on this page and no line height is specified.
|
|
621
|
+
* For example:
|
|
622
|
+
* ```js
|
|
623
|
+
* page.setLineHeight(12);
|
|
624
|
+
* page.drawText('These lines will be vertically \n separated by 12 units')
|
|
625
|
+
*
|
|
626
|
+
* page.setLineHeight(36);
|
|
627
|
+
* page.drawText('These lines will be vertically \n separated by 24 units', {
|
|
628
|
+
* lineHeight: 24
|
|
629
|
+
* })
|
|
630
|
+
* ```
|
|
631
|
+
* @param lineHeight The default line height to be used when drawing text on
|
|
632
|
+
* this page.
|
|
633
|
+
*/
|
|
634
|
+
PDFPage.prototype.setLineHeight = function (lineHeight) {
|
|
635
|
+
utils_1.assertIs(lineHeight, 'lineHeight', ['number']);
|
|
636
|
+
this.lineHeight = lineHeight;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Get the default position of this page. For example:
|
|
640
|
+
* ```js
|
|
641
|
+
* const { x, y } = page.getPosition()
|
|
642
|
+
* ```
|
|
643
|
+
* @returns The default position of the page.
|
|
644
|
+
*/
|
|
645
|
+
PDFPage.prototype.getPosition = function () {
|
|
646
|
+
return { x: this.x, y: this.y };
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* Get the default x coordinate of this page. For example:
|
|
650
|
+
* ```js
|
|
651
|
+
* const x = page.getX()
|
|
652
|
+
* ```
|
|
653
|
+
* @returns The default x coordinate of the page.
|
|
654
|
+
*/
|
|
655
|
+
PDFPage.prototype.getX = function () {
|
|
656
|
+
return this.x;
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* Get the default y coordinate of this page. For example:
|
|
660
|
+
* ```js
|
|
661
|
+
* const y = page.getY()
|
|
662
|
+
* ```
|
|
663
|
+
* @returns The default y coordinate of the page.
|
|
664
|
+
*/
|
|
665
|
+
PDFPage.prototype.getY = function () {
|
|
666
|
+
return this.y;
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* Change the default position of this page. For example:
|
|
670
|
+
* ```js
|
|
671
|
+
* page.moveTo(0, 0)
|
|
672
|
+
* page.drawText('I will be drawn at the origin')
|
|
673
|
+
*
|
|
674
|
+
* page.moveTo(0, 25)
|
|
675
|
+
* page.drawText('I will be drawn 25 units up')
|
|
676
|
+
*
|
|
677
|
+
* page.moveTo(25, 25)
|
|
678
|
+
* page.drawText('I will be drawn 25 units up and 25 units to the right')
|
|
679
|
+
* ```
|
|
680
|
+
* @param x The new default position on the x-axis for this page.
|
|
681
|
+
* @param y The new default position on the y-axis for this page.
|
|
682
|
+
*/
|
|
683
|
+
PDFPage.prototype.moveTo = function (x, y) {
|
|
684
|
+
utils_1.assertIs(x, 'x', ['number']);
|
|
685
|
+
utils_1.assertIs(y, 'y', ['number']);
|
|
686
|
+
this.x = x;
|
|
687
|
+
this.y = y;
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* Change the default position of this page to be further down the y-axis.
|
|
691
|
+
* For example:
|
|
692
|
+
* ```js
|
|
693
|
+
* page.moveTo(50, 50)
|
|
694
|
+
* page.drawText('I will be drawn at (50, 50)')
|
|
695
|
+
*
|
|
696
|
+
* page.moveDown(10)
|
|
697
|
+
* page.drawText('I will be drawn at (50, 40)')
|
|
698
|
+
* ```
|
|
699
|
+
* @param yDecrease The amount by which the page's default position along the
|
|
700
|
+
* y-axis should be decreased.
|
|
701
|
+
*/
|
|
702
|
+
PDFPage.prototype.moveDown = function (yDecrease) {
|
|
703
|
+
utils_1.assertIs(yDecrease, 'yDecrease', ['number']);
|
|
704
|
+
this.y -= yDecrease;
|
|
705
|
+
};
|
|
706
|
+
/**
|
|
707
|
+
* Change the default position of this page to be further up the y-axis.
|
|
708
|
+
* For example:
|
|
709
|
+
* ```js
|
|
710
|
+
* page.moveTo(50, 50)
|
|
711
|
+
* page.drawText('I will be drawn at (50, 50)')
|
|
712
|
+
*
|
|
713
|
+
* page.moveUp(10)
|
|
714
|
+
* page.drawText('I will be drawn at (50, 60)')
|
|
715
|
+
* ```
|
|
716
|
+
* @param yIncrease The amount by which the page's default position along the
|
|
717
|
+
* y-axis should be increased.
|
|
718
|
+
*/
|
|
719
|
+
PDFPage.prototype.moveUp = function (yIncrease) {
|
|
720
|
+
utils_1.assertIs(yIncrease, 'yIncrease', ['number']);
|
|
721
|
+
this.y += yIncrease;
|
|
722
|
+
};
|
|
723
|
+
/**
|
|
724
|
+
* Change the default position of this page to be further left on the x-axis.
|
|
725
|
+
* For example:
|
|
726
|
+
* ```js
|
|
727
|
+
* page.moveTo(50, 50)
|
|
728
|
+
* page.drawText('I will be drawn at (50, 50)')
|
|
729
|
+
*
|
|
730
|
+
* page.moveLeft(10)
|
|
731
|
+
* page.drawText('I will be drawn at (40, 50)')
|
|
732
|
+
* ```
|
|
733
|
+
* @param xDecrease The amount by which the page's default position along the
|
|
734
|
+
* x-axis should be decreased.
|
|
735
|
+
*/
|
|
736
|
+
PDFPage.prototype.moveLeft = function (xDecrease) {
|
|
737
|
+
utils_1.assertIs(xDecrease, 'xDecrease', ['number']);
|
|
738
|
+
this.x -= xDecrease;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* Change the default position of this page to be further right on the y-axis.
|
|
742
|
+
* For example:
|
|
743
|
+
* ```js
|
|
744
|
+
* page.moveTo(50, 50)
|
|
745
|
+
* page.drawText('I will be drawn at (50, 50)')
|
|
746
|
+
*
|
|
747
|
+
* page.moveRight(10)
|
|
748
|
+
* page.drawText('I will be drawn at (60, 50)')
|
|
749
|
+
* ```
|
|
750
|
+
* @param xIncrease The amount by which the page's default position along the
|
|
751
|
+
* x-axis should be increased.
|
|
752
|
+
*/
|
|
753
|
+
PDFPage.prototype.moveRight = function (xIncrease) {
|
|
754
|
+
utils_1.assertIs(xIncrease, 'xIncrease', ['number']);
|
|
755
|
+
this.x += xIncrease;
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Push one or more operators to the end of this page's current content
|
|
759
|
+
* stream. For example:
|
|
760
|
+
* ```js
|
|
761
|
+
* import {
|
|
762
|
+
* pushGraphicsState,
|
|
763
|
+
* moveTo,
|
|
764
|
+
* lineTo,
|
|
765
|
+
* closePath,
|
|
766
|
+
* setFillingColor,
|
|
767
|
+
* rgb,
|
|
768
|
+
* fill,
|
|
769
|
+
* popGraphicsState,
|
|
770
|
+
* } from 'pdf-lib'
|
|
771
|
+
*
|
|
772
|
+
* // Draw a green triangle in the lower-left corner of the page
|
|
773
|
+
* page.pushOperators(
|
|
774
|
+
* pushGraphicsState(),
|
|
775
|
+
* moveTo(0, 0),
|
|
776
|
+
* lineTo(100, 0),
|
|
777
|
+
* lineTo(50, 100),
|
|
778
|
+
* closePath(),
|
|
779
|
+
* setFillingColor(rgb(0.0, 1.0, 0.0)),
|
|
780
|
+
* fill(),
|
|
781
|
+
* popGraphicsState(),
|
|
782
|
+
* )
|
|
783
|
+
* ```
|
|
784
|
+
* @param operator The operators to be pushed.
|
|
785
|
+
*/
|
|
786
|
+
PDFPage.prototype.pushOperators = function () {
|
|
787
|
+
var operator = [];
|
|
788
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
789
|
+
operator[_i] = arguments[_i];
|
|
790
|
+
}
|
|
791
|
+
utils_1.assertEachIs(operator, 'operator', [[core_1.PDFOperator, 'PDFOperator']]);
|
|
792
|
+
var contentStream = this.getContentStream();
|
|
793
|
+
contentStream.push.apply(contentStream, operator);
|
|
794
|
+
};
|
|
795
|
+
/**
|
|
796
|
+
* Draw one or more lines of text on this page. For example:
|
|
797
|
+
* ```js
|
|
798
|
+
* import { StandardFonts, rgb } from 'pdf-lib'
|
|
799
|
+
*
|
|
800
|
+
* const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)
|
|
801
|
+
* const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
|
|
802
|
+
*
|
|
803
|
+
* const page = pdfDoc.addPage()
|
|
804
|
+
*
|
|
805
|
+
* page.setFont(helveticaFont)
|
|
806
|
+
*
|
|
807
|
+
* page.moveTo(5, 200)
|
|
808
|
+
* page.drawText('The Life of an Egg', { size: 36 })
|
|
809
|
+
*
|
|
810
|
+
* page.moveDown(36)
|
|
811
|
+
* page.drawText('An Epic Tale of Woe', { size: 30 })
|
|
812
|
+
*
|
|
813
|
+
* page.drawText(
|
|
814
|
+
* `Humpty Dumpty sat on a wall \n` +
|
|
815
|
+
* `Humpty Dumpty had a great fall; \n` +
|
|
816
|
+
* `All the king's horses and all the king's men \n` +
|
|
817
|
+
* `Couldn't put Humpty together again. \n`,
|
|
818
|
+
* {
|
|
819
|
+
* x: 25,
|
|
820
|
+
* y: 100,
|
|
821
|
+
* font: timesRomanFont,
|
|
822
|
+
* size: 24,
|
|
823
|
+
* color: rgb(1, 0, 0),
|
|
824
|
+
* lineHeight: 24,
|
|
825
|
+
* opacity: 0.75,
|
|
826
|
+
* },
|
|
827
|
+
* )
|
|
828
|
+
* ```
|
|
829
|
+
* @param text The text to be drawn.
|
|
830
|
+
* @param options The options to be used when drawing the text.
|
|
831
|
+
*/
|
|
832
|
+
PDFPage.prototype.drawText = function (text, options) {
|
|
833
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
834
|
+
if (options === void 0) { options = {}; }
|
|
835
|
+
utils_1.assertIs(text, 'text', ['string']);
|
|
836
|
+
utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
|
|
837
|
+
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
838
|
+
utils_1.assertOrUndefined(options.font, 'options.font', [[PDFFont_1.default, 'PDFFont']]);
|
|
839
|
+
utils_1.assertOrUndefined(options.size, 'options.size', ['number']);
|
|
840
|
+
utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
841
|
+
utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
842
|
+
utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
843
|
+
utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
|
|
844
|
+
utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
|
|
845
|
+
utils_1.assertOrUndefined(options.lineHeight, 'options.lineHeight', ['number']);
|
|
846
|
+
utils_1.assertOrUndefined(options.maxWidth, 'options.maxWidth', ['number']);
|
|
847
|
+
utils_1.assertOrUndefined(options.wordBreaks, 'options.wordBreaks', [Array]);
|
|
848
|
+
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
849
|
+
var _h = this.setOrEmbedFont(options.font), oldFont = _h.oldFont, newFont = _h.newFont, newFontKey = _h.newFontKey;
|
|
850
|
+
var fontSize = options.size || this.fontSize;
|
|
851
|
+
var wordBreaks = options.wordBreaks || this.doc.defaultWordBreaks;
|
|
852
|
+
var textWidth = function (t) { return newFont.widthOfTextAtSize(t, fontSize); };
|
|
853
|
+
var lines = options.maxWidth === undefined
|
|
854
|
+
? utils_1.lineSplit(utils_1.cleanText(text))
|
|
855
|
+
: utils_1.breakTextIntoLines(text, wordBreaks, options.maxWidth, textWidth);
|
|
856
|
+
var encodedLines = new Array(lines.length);
|
|
857
|
+
for (var idx = 0, len = lines.length; idx < len; idx++) {
|
|
858
|
+
encodedLines[idx] = newFont.encodeText(lines[idx]);
|
|
859
|
+
}
|
|
860
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
861
|
+
opacity: options.opacity,
|
|
862
|
+
blendMode: options.blendMode,
|
|
863
|
+
});
|
|
864
|
+
var contentStream = this.getContentStream();
|
|
865
|
+
contentStream.push.apply(contentStream, operations_1.drawLinesOfText(encodedLines, {
|
|
866
|
+
color: (_a = options.color) !== null && _a !== void 0 ? _a : this.fontColor,
|
|
867
|
+
font: newFontKey,
|
|
868
|
+
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),
|
|
872
|
+
x: (_e = options.x) !== null && _e !== void 0 ? _e : this.x,
|
|
873
|
+
y: (_f = options.y) !== null && _f !== void 0 ? _f : this.y,
|
|
874
|
+
lineHeight: (_g = options.lineHeight) !== null && _g !== void 0 ? _g : this.lineHeight,
|
|
875
|
+
graphicsState: graphicsStateKey,
|
|
876
|
+
}));
|
|
877
|
+
if (options.font) {
|
|
878
|
+
if (oldFont)
|
|
879
|
+
this.setFont(oldFont);
|
|
880
|
+
else
|
|
881
|
+
this.resetFont();
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
/**
|
|
885
|
+
* Draw an image on this page. For example:
|
|
886
|
+
* ```js
|
|
887
|
+
* import { degrees } from 'pdf-lib'
|
|
888
|
+
*
|
|
889
|
+
* const jpgUrl = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'
|
|
890
|
+
* const jpgImageBytes = await fetch(jpgUrl).then((res) => res.arrayBuffer())
|
|
891
|
+
*
|
|
892
|
+
* const jpgImage = await pdfDoc.embedJpg(jpgImageBytes)
|
|
893
|
+
* const jpgDims = jpgImage.scale(0.5)
|
|
894
|
+
*
|
|
895
|
+
* const page = pdfDoc.addPage()
|
|
896
|
+
*
|
|
897
|
+
* page.drawImage(jpgImage, {
|
|
898
|
+
* x: 25,
|
|
899
|
+
* y: 25,
|
|
900
|
+
* width: jpgDims.width,
|
|
901
|
+
* height: jpgDims.height,
|
|
902
|
+
* rotate: degrees(30),
|
|
903
|
+
* opacity: 0.75,
|
|
904
|
+
* })
|
|
905
|
+
* ```
|
|
906
|
+
* @param image The image to be drawn.
|
|
907
|
+
* @param options The options to be used when drawing the image.
|
|
908
|
+
*/
|
|
909
|
+
PDFPage.prototype.drawImage = function (image, options) {
|
|
910
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
911
|
+
if (options === void 0) { options = {}; }
|
|
912
|
+
// 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
|
+
var xObjectKey = this.node.newXObject('Image', image.ref);
|
|
924
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
925
|
+
opacity: options.opacity,
|
|
926
|
+
blendMode: options.blendMode,
|
|
927
|
+
});
|
|
928
|
+
var contentStream = this.getContentStream();
|
|
929
|
+
contentStream.push.apply(contentStream, operations_1.drawImage(xObjectKey, {
|
|
930
|
+
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
931
|
+
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
932
|
+
width: (_c = options.width) !== null && _c !== void 0 ? _c : image.size().width,
|
|
933
|
+
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),
|
|
937
|
+
graphicsState: graphicsStateKey,
|
|
938
|
+
}));
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* Draw an embedded PDF page on this page. For example:
|
|
942
|
+
* ```js
|
|
943
|
+
* import { degrees } from 'pdf-lib'
|
|
944
|
+
*
|
|
945
|
+
* const pdfDoc = await PDFDocument.create()
|
|
946
|
+
* const page = pdfDoc.addPage()
|
|
947
|
+
*
|
|
948
|
+
* const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'
|
|
949
|
+
* const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())
|
|
950
|
+
*
|
|
951
|
+
* // Embed page 74 from the PDF
|
|
952
|
+
* const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, 73)
|
|
953
|
+
*
|
|
954
|
+
* page.drawPage(embeddedPage, {
|
|
955
|
+
* x: 250,
|
|
956
|
+
* y: 200,
|
|
957
|
+
* xScale: 0.5,
|
|
958
|
+
* yScale: 0.5,
|
|
959
|
+
* rotate: degrees(30),
|
|
960
|
+
* opacity: 0.75,
|
|
961
|
+
* })
|
|
962
|
+
* ```
|
|
963
|
+
*
|
|
964
|
+
* The `options` argument accepts both `width`/`height` and `xScale`/`yScale`
|
|
965
|
+
* as options. Since each of these options defines the size of the drawn page,
|
|
966
|
+
* if both options are given, `width` and `height` take precedence and the
|
|
967
|
+
* corresponding scale variants are ignored.
|
|
968
|
+
*
|
|
969
|
+
* @param embeddedPage The embedded page to be drawn.
|
|
970
|
+
* @param options The options to be used when drawing the embedded page.
|
|
971
|
+
*/
|
|
972
|
+
PDFPage.prototype.drawPage = function (embeddedPage, options) {
|
|
973
|
+
var _a, _b, _c, _d, _e;
|
|
974
|
+
if (options === void 0) { options = {}; }
|
|
975
|
+
// TODO: Reuse embeddedPage XObject name if we've already added this embeddedPage to Resources.XObjects
|
|
976
|
+
utils_1.assertIs(embeddedPage, 'embeddedPage', [
|
|
977
|
+
[PDFEmbeddedPage_1.default, 'PDFEmbeddedPage'],
|
|
978
|
+
]);
|
|
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
|
+
var xObjectKey = this.node.newXObject('EmbeddedPdfPage', embeddedPage.ref);
|
|
991
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
992
|
+
opacity: options.opacity,
|
|
993
|
+
blendMode: options.blendMode,
|
|
994
|
+
});
|
|
995
|
+
// prettier-ignore
|
|
996
|
+
var xScale = (options.width !== undefined ? options.width / embeddedPage.width
|
|
997
|
+
: options.xScale !== undefined ? options.xScale
|
|
998
|
+
: 1);
|
|
999
|
+
// prettier-ignore
|
|
1000
|
+
var yScale = (options.height !== undefined ? options.height / embeddedPage.height
|
|
1001
|
+
: options.yScale !== undefined ? options.yScale
|
|
1002
|
+
: 1);
|
|
1003
|
+
var contentStream = this.getContentStream();
|
|
1004
|
+
contentStream.push.apply(contentStream, operations_1.drawPage(xObjectKey, {
|
|
1005
|
+
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1006
|
+
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1007
|
+
xScale: xScale,
|
|
1008
|
+
yScale: 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),
|
|
1012
|
+
graphicsState: graphicsStateKey,
|
|
1013
|
+
}));
|
|
1014
|
+
};
|
|
1015
|
+
/**
|
|
1016
|
+
* Draw an SVG path on this page. For example:
|
|
1017
|
+
* ```js
|
|
1018
|
+
* import { rgb } from 'pdf-lib'
|
|
1019
|
+
*
|
|
1020
|
+
* const svgPath = 'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90'
|
|
1021
|
+
*
|
|
1022
|
+
* // Draw path as black line
|
|
1023
|
+
* page.drawSvgPath(svgPath, { x: 25, y: 75 })
|
|
1024
|
+
*
|
|
1025
|
+
* // Change border style and opacity
|
|
1026
|
+
* page.drawSvgPath(svgPath, {
|
|
1027
|
+
* x: 25,
|
|
1028
|
+
* y: 275,
|
|
1029
|
+
* borderColor: rgb(0.5, 0.5, 0.5),
|
|
1030
|
+
* borderWidth: 2,
|
|
1031
|
+
* borderOpacity: 0.75,
|
|
1032
|
+
* })
|
|
1033
|
+
*
|
|
1034
|
+
* // Set fill color and opacity
|
|
1035
|
+
* page.drawSvgPath(svgPath, {
|
|
1036
|
+
* x: 25,
|
|
1037
|
+
* y: 475,
|
|
1038
|
+
* color: rgb(1.0, 0, 0),
|
|
1039
|
+
* opacity: 0.75,
|
|
1040
|
+
* })
|
|
1041
|
+
*
|
|
1042
|
+
* // Draw 50% of original size
|
|
1043
|
+
* page.drawSvgPath(svgPath, {
|
|
1044
|
+
* x: 25,
|
|
1045
|
+
* y: 675,
|
|
1046
|
+
* scale: 0.5,
|
|
1047
|
+
* })
|
|
1048
|
+
* ```
|
|
1049
|
+
* @param path The SVG path to be drawn.
|
|
1050
|
+
* @param options The options to be used when drawing the SVG path.
|
|
1051
|
+
*/
|
|
1052
|
+
PDFPage.prototype.drawSvgPath = function (path, options) {
|
|
1053
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1054
|
+
if (options === void 0) { options = {}; }
|
|
1055
|
+
utils_1.assertIs(path, 'path', ['string']);
|
|
1056
|
+
utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
|
|
1057
|
+
utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
|
|
1058
|
+
utils_1.assertOrUndefined(options.scale, 'options.scale', ['number']);
|
|
1059
|
+
utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
1060
|
+
utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);
|
|
1061
|
+
utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
|
|
1062
|
+
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
1063
|
+
utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
|
|
1064
|
+
[Object, 'Color'],
|
|
1065
|
+
]);
|
|
1066
|
+
utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
|
|
1067
|
+
Array,
|
|
1068
|
+
]);
|
|
1069
|
+
utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1070
|
+
'number',
|
|
1071
|
+
]);
|
|
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
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1076
|
+
opacity: options.opacity,
|
|
1077
|
+
borderOpacity: options.borderOpacity,
|
|
1078
|
+
blendMode: options.blendMode,
|
|
1079
|
+
});
|
|
1080
|
+
if (!('color' in options) && !('borderColor' in options)) {
|
|
1081
|
+
options.borderColor = colors_1.rgb(0, 0, 0);
|
|
1082
|
+
}
|
|
1083
|
+
var contentStream = this.getContentStream();
|
|
1084
|
+
contentStream.push.apply(contentStream, operations_1.drawSvgPath(path, {
|
|
1085
|
+
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1086
|
+
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1087
|
+
scale: options.scale,
|
|
1088
|
+
rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
|
|
1089
|
+
color: (_d = options.color) !== null && _d !== void 0 ? _d : undefined,
|
|
1090
|
+
borderColor: (_e = options.borderColor) !== null && _e !== void 0 ? _e : undefined,
|
|
1091
|
+
borderWidth: (_f = options.borderWidth) !== null && _f !== void 0 ? _f : 0,
|
|
1092
|
+
borderDashArray: (_g = options.borderDashArray) !== null && _g !== void 0 ? _g : undefined,
|
|
1093
|
+
borderDashPhase: (_h = options.borderDashPhase) !== null && _h !== void 0 ? _h : undefined,
|
|
1094
|
+
borderLineCap: (_j = options.borderLineCap) !== null && _j !== void 0 ? _j : undefined,
|
|
1095
|
+
graphicsState: graphicsStateKey,
|
|
1096
|
+
}));
|
|
1097
|
+
};
|
|
1098
|
+
/**
|
|
1099
|
+
* Draw a line on this page. For example:
|
|
1100
|
+
* ```js
|
|
1101
|
+
* import { rgb } from 'pdf-lib'
|
|
1102
|
+
*
|
|
1103
|
+
* page.drawLine({
|
|
1104
|
+
* start: { x: 25, y: 75 },
|
|
1105
|
+
* end: { x: 125, y: 175 },
|
|
1106
|
+
* thickness: 2,
|
|
1107
|
+
* color: rgb(0.75, 0.2, 0.2),
|
|
1108
|
+
* opacity: 0.75,
|
|
1109
|
+
* })
|
|
1110
|
+
* ```
|
|
1111
|
+
* @param options The options to be used when drawing the line.
|
|
1112
|
+
*/
|
|
1113
|
+
PDFPage.prototype.drawLine = function (options) {
|
|
1114
|
+
var _a, _b, _c, _d, _e;
|
|
1115
|
+
utils_1.assertIs(options.start, 'options.start', [
|
|
1116
|
+
[Object, '{ x: number, y: number }'],
|
|
1117
|
+
]);
|
|
1118
|
+
utils_1.assertIs(options.end, 'options.end', [
|
|
1119
|
+
[Object, '{ x: number, y: number }'],
|
|
1120
|
+
]);
|
|
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
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1133
|
+
borderOpacity: options.opacity,
|
|
1134
|
+
blendMode: options.blendMode,
|
|
1135
|
+
});
|
|
1136
|
+
if (!('color' in options)) {
|
|
1137
|
+
options.color = colors_1.rgb(0, 0, 0);
|
|
1138
|
+
}
|
|
1139
|
+
var contentStream = this.getContentStream();
|
|
1140
|
+
contentStream.push.apply(contentStream, operations_1.drawLine({
|
|
1141
|
+
start: options.start,
|
|
1142
|
+
end: options.end,
|
|
1143
|
+
thickness: (_a = options.thickness) !== null && _a !== void 0 ? _a : 1,
|
|
1144
|
+
color: (_b = options.color) !== null && _b !== void 0 ? _b : undefined,
|
|
1145
|
+
dashArray: (_c = options.dashArray) !== null && _c !== void 0 ? _c : undefined,
|
|
1146
|
+
dashPhase: (_d = options.dashPhase) !== null && _d !== void 0 ? _d : undefined,
|
|
1147
|
+
lineCap: (_e = options.lineCap) !== null && _e !== void 0 ? _e : undefined,
|
|
1148
|
+
graphicsState: graphicsStateKey,
|
|
1149
|
+
}));
|
|
1150
|
+
};
|
|
1151
|
+
/**
|
|
1152
|
+
* Draw a rectangle on this page. For example:
|
|
1153
|
+
* ```js
|
|
1154
|
+
* import { degrees, grayscale, rgb } from 'pdf-lib'
|
|
1155
|
+
*
|
|
1156
|
+
* page.drawRectangle({
|
|
1157
|
+
* x: 25,
|
|
1158
|
+
* y: 75,
|
|
1159
|
+
* width: 250,
|
|
1160
|
+
* height: 75,
|
|
1161
|
+
* rotate: degrees(-15),
|
|
1162
|
+
* borderWidth: 5,
|
|
1163
|
+
* borderColor: grayscale(0.5),
|
|
1164
|
+
* color: rgb(0.75, 0.2, 0.2),
|
|
1165
|
+
* opacity: 0.5,
|
|
1166
|
+
* borderOpacity: 0.75,
|
|
1167
|
+
* })
|
|
1168
|
+
* ```
|
|
1169
|
+
* @param options The options to be used when drawing the rectangle.
|
|
1170
|
+
*/
|
|
1171
|
+
PDFPage.prototype.drawRectangle = function (options) {
|
|
1172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1173
|
+
if (options === void 0) { options = {}; }
|
|
1174
|
+
utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
|
|
1175
|
+
utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
|
|
1176
|
+
utils_1.assertOrUndefined(options.width, 'options.width', ['number']);
|
|
1177
|
+
utils_1.assertOrUndefined(options.height, 'options.height', ['number']);
|
|
1178
|
+
utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
1179
|
+
utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
|
|
1180
|
+
utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
|
|
1181
|
+
utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);
|
|
1182
|
+
utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
|
|
1183
|
+
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
1184
|
+
utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
|
|
1185
|
+
[Object, 'Color'],
|
|
1186
|
+
]);
|
|
1187
|
+
utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
|
|
1188
|
+
Array,
|
|
1189
|
+
]);
|
|
1190
|
+
utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1191
|
+
'number',
|
|
1192
|
+
]);
|
|
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
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1197
|
+
opacity: options.opacity,
|
|
1198
|
+
borderOpacity: options.borderOpacity,
|
|
1199
|
+
blendMode: options.blendMode,
|
|
1200
|
+
});
|
|
1201
|
+
if (!('color' in options) && !('borderColor' in options)) {
|
|
1202
|
+
options.color = colors_1.rgb(0, 0, 0);
|
|
1203
|
+
}
|
|
1204
|
+
var contentStream = this.getContentStream();
|
|
1205
|
+
contentStream.push.apply(contentStream, operations_1.drawRectangle({
|
|
1206
|
+
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1207
|
+
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1208
|
+
width: (_c = options.width) !== null && _c !== void 0 ? _c : 150,
|
|
1209
|
+
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),
|
|
1213
|
+
borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,
|
|
1214
|
+
color: (_j = options.color) !== null && _j !== void 0 ? _j : undefined,
|
|
1215
|
+
borderColor: (_k = options.borderColor) !== null && _k !== void 0 ? _k : undefined,
|
|
1216
|
+
borderDashArray: (_l = options.borderDashArray) !== null && _l !== void 0 ? _l : undefined,
|
|
1217
|
+
borderDashPhase: (_m = options.borderDashPhase) !== null && _m !== void 0 ? _m : undefined,
|
|
1218
|
+
graphicsState: graphicsStateKey,
|
|
1219
|
+
borderLineCap: (_o = options.borderLineCap) !== null && _o !== void 0 ? _o : undefined,
|
|
1220
|
+
}));
|
|
1221
|
+
};
|
|
1222
|
+
/**
|
|
1223
|
+
* Draw a square on this page. For example:
|
|
1224
|
+
* ```js
|
|
1225
|
+
* import { degrees, grayscale, rgb } from 'pdf-lib'
|
|
1226
|
+
*
|
|
1227
|
+
* page.drawSquare({
|
|
1228
|
+
* x: 25,
|
|
1229
|
+
* y: 75,
|
|
1230
|
+
* size: 100,
|
|
1231
|
+
* rotate: degrees(-15),
|
|
1232
|
+
* borderWidth: 5,
|
|
1233
|
+
* borderColor: grayscale(0.5),
|
|
1234
|
+
* color: rgb(0.75, 0.2, 0.2),
|
|
1235
|
+
* opacity: 0.5,
|
|
1236
|
+
* borderOpacity: 0.75,
|
|
1237
|
+
* })
|
|
1238
|
+
* ```
|
|
1239
|
+
* @param options The options to be used when drawing the square.
|
|
1240
|
+
*/
|
|
1241
|
+
PDFPage.prototype.drawSquare = function (options) {
|
|
1242
|
+
if (options === void 0) { options = {}; }
|
|
1243
|
+
var size = options.size;
|
|
1244
|
+
utils_1.assertOrUndefined(size, 'size', ['number']);
|
|
1245
|
+
this.drawRectangle(tslib_1.__assign(tslib_1.__assign({}, options), { width: size, height: size }));
|
|
1246
|
+
};
|
|
1247
|
+
/**
|
|
1248
|
+
* Draw an ellipse on this page. For example:
|
|
1249
|
+
* ```js
|
|
1250
|
+
* import { grayscale, rgb } from 'pdf-lib'
|
|
1251
|
+
*
|
|
1252
|
+
* page.drawEllipse({
|
|
1253
|
+
* x: 200,
|
|
1254
|
+
* y: 75,
|
|
1255
|
+
* xScale: 100,
|
|
1256
|
+
* yScale: 50,
|
|
1257
|
+
* borderWidth: 5,
|
|
1258
|
+
* borderColor: grayscale(0.5),
|
|
1259
|
+
* color: rgb(0.75, 0.2, 0.2),
|
|
1260
|
+
* opacity: 0.5,
|
|
1261
|
+
* borderOpacity: 0.75,
|
|
1262
|
+
* })
|
|
1263
|
+
* ```
|
|
1264
|
+
* @param options The options to be used when drawing the ellipse.
|
|
1265
|
+
*/
|
|
1266
|
+
PDFPage.prototype.drawEllipse = function (options) {
|
|
1267
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1268
|
+
if (options === void 0) { options = {}; }
|
|
1269
|
+
utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
|
|
1270
|
+
utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
|
|
1271
|
+
utils_1.assertOrUndefined(options.xScale, 'options.xScale', ['number']);
|
|
1272
|
+
utils_1.assertOrUndefined(options.yScale, 'options.yScale', ['number']);
|
|
1273
|
+
utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
|
|
1274
|
+
utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
|
|
1275
|
+
utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
|
|
1276
|
+
utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
|
|
1277
|
+
[Object, 'Color'],
|
|
1278
|
+
]);
|
|
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', [
|
|
1282
|
+
Array,
|
|
1283
|
+
]);
|
|
1284
|
+
utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
|
|
1285
|
+
'number',
|
|
1286
|
+
]);
|
|
1287
|
+
utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
|
|
1288
|
+
utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
|
|
1289
|
+
var graphicsStateKey = this.maybeEmbedGraphicsState({
|
|
1290
|
+
opacity: options.opacity,
|
|
1291
|
+
borderOpacity: options.borderOpacity,
|
|
1292
|
+
blendMode: options.blendMode,
|
|
1293
|
+
});
|
|
1294
|
+
if (!('color' in options) && !('borderColor' in options)) {
|
|
1295
|
+
options.color = colors_1.rgb(0, 0, 0);
|
|
1296
|
+
}
|
|
1297
|
+
var contentStream = this.getContentStream();
|
|
1298
|
+
contentStream.push.apply(contentStream, operations_1.drawEllipse({
|
|
1299
|
+
x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
|
|
1300
|
+
y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
|
|
1301
|
+
xScale: (_c = options.xScale) !== null && _c !== void 0 ? _c : 100,
|
|
1302
|
+
yScale: (_d = options.yScale) !== null && _d !== void 0 ? _d : 100,
|
|
1303
|
+
rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : undefined,
|
|
1304
|
+
color: (_f = options.color) !== null && _f !== void 0 ? _f : undefined,
|
|
1305
|
+
borderColor: (_g = options.borderColor) !== null && _g !== void 0 ? _g : undefined,
|
|
1306
|
+
borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,
|
|
1307
|
+
borderDashArray: (_j = options.borderDashArray) !== null && _j !== void 0 ? _j : undefined,
|
|
1308
|
+
borderDashPhase: (_k = options.borderDashPhase) !== null && _k !== void 0 ? _k : undefined,
|
|
1309
|
+
borderLineCap: (_l = options.borderLineCap) !== null && _l !== void 0 ? _l : undefined,
|
|
1310
|
+
graphicsState: graphicsStateKey,
|
|
1311
|
+
}));
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* Draw a circle on this page. For example:
|
|
1315
|
+
* ```js
|
|
1316
|
+
* import { grayscale, rgb } from 'pdf-lib'
|
|
1317
|
+
*
|
|
1318
|
+
* page.drawCircle({
|
|
1319
|
+
* x: 200,
|
|
1320
|
+
* y: 150,
|
|
1321
|
+
* size: 100,
|
|
1322
|
+
* borderWidth: 5,
|
|
1323
|
+
* borderColor: grayscale(0.5),
|
|
1324
|
+
* color: rgb(0.75, 0.2, 0.2),
|
|
1325
|
+
* opacity: 0.5,
|
|
1326
|
+
* borderOpacity: 0.75,
|
|
1327
|
+
* })
|
|
1328
|
+
* ```
|
|
1329
|
+
* @param options The options to be used when drawing the ellipse.
|
|
1330
|
+
*/
|
|
1331
|
+
PDFPage.prototype.drawCircle = function (options) {
|
|
1332
|
+
if (options === void 0) { options = {}; }
|
|
1333
|
+
var _a = options.size, size = _a === void 0 ? 100 : _a;
|
|
1334
|
+
utils_1.assertOrUndefined(size, 'size', ['number']);
|
|
1335
|
+
this.drawEllipse(tslib_1.__assign(tslib_1.__assign({}, options), { xScale: size, yScale: size }));
|
|
1336
|
+
};
|
|
1337
|
+
PDFPage.prototype.setOrEmbedFont = function (font) {
|
|
1338
|
+
var oldFont = this.font;
|
|
1339
|
+
var oldFontKey = this.fontKey;
|
|
1340
|
+
if (font)
|
|
1341
|
+
this.setFont(font);
|
|
1342
|
+
else
|
|
1343
|
+
this.getFont();
|
|
1344
|
+
var newFont = this.font;
|
|
1345
|
+
var newFontKey = this.fontKey;
|
|
1346
|
+
return { oldFont: oldFont, oldFontKey: oldFontKey, newFont: newFont, newFontKey: newFontKey };
|
|
1347
|
+
};
|
|
1348
|
+
PDFPage.prototype.getFont = function () {
|
|
1349
|
+
if (!this.font || !this.fontKey) {
|
|
1350
|
+
var font = this.doc.embedStandardFont(StandardFonts_1.StandardFonts.Helvetica);
|
|
1351
|
+
this.setFont(font);
|
|
1352
|
+
}
|
|
1353
|
+
return [this.font, this.fontKey];
|
|
1354
|
+
};
|
|
1355
|
+
PDFPage.prototype.resetFont = function () {
|
|
1356
|
+
this.font = undefined;
|
|
1357
|
+
this.fontKey = undefined;
|
|
1358
|
+
};
|
|
1359
|
+
PDFPage.prototype.getContentStream = function (useExisting) {
|
|
1360
|
+
if (useExisting === void 0) { useExisting = true; }
|
|
1361
|
+
if (useExisting && this.contentStream)
|
|
1362
|
+
return this.contentStream;
|
|
1363
|
+
this.contentStream = this.createContentStream();
|
|
1364
|
+
this.contentStreamRef = this.doc.context.register(this.contentStream);
|
|
1365
|
+
this.node.addContentStream(this.contentStreamRef);
|
|
1366
|
+
return this.contentStream;
|
|
1367
|
+
};
|
|
1368
|
+
PDFPage.prototype.createContentStream = function () {
|
|
1369
|
+
var operators = [];
|
|
1370
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1371
|
+
operators[_i] = arguments[_i];
|
|
1372
|
+
}
|
|
1373
|
+
var dict = this.doc.context.obj({});
|
|
1374
|
+
var contentStream = core_1.PDFContentStream.of(dict, operators);
|
|
1375
|
+
return contentStream;
|
|
1376
|
+
};
|
|
1377
|
+
PDFPage.prototype.maybeEmbedGraphicsState = function (options) {
|
|
1378
|
+
var opacity = options.opacity, borderOpacity = options.borderOpacity, blendMode = options.blendMode;
|
|
1379
|
+
if (opacity === undefined &&
|
|
1380
|
+
borderOpacity === undefined &&
|
|
1381
|
+
blendMode === undefined) {
|
|
1382
|
+
return undefined;
|
|
1383
|
+
}
|
|
1384
|
+
var graphicsState = this.doc.context.obj({
|
|
1385
|
+
Type: 'ExtGState',
|
|
1386
|
+
ca: opacity,
|
|
1387
|
+
CA: borderOpacity,
|
|
1388
|
+
BM: blendMode,
|
|
1389
|
+
});
|
|
1390
|
+
var key = this.node.newExtGState('GS', graphicsState);
|
|
1391
|
+
return key;
|
|
1392
|
+
};
|
|
1393
|
+
PDFPage.prototype.scaleAnnot = function (annot, x, y) {
|
|
1394
|
+
var selectors = ['RD', 'CL', 'Vertices', 'QuadPoints', 'L', 'Rect'];
|
|
1395
|
+
for (var idx = 0, len = selectors.length; idx < len; idx++) {
|
|
1396
|
+
var list = annot.lookup(core_1.PDFName.of(selectors[idx]));
|
|
1397
|
+
if (list instanceof core_1.PDFArray)
|
|
1398
|
+
list.scalePDFNumbers(x, y);
|
|
1399
|
+
}
|
|
1400
|
+
var inkLists = annot.lookup(core_1.PDFName.of('InkList'));
|
|
1401
|
+
if (inkLists instanceof core_1.PDFArray) {
|
|
1402
|
+
for (var idx = 0, len = inkLists.size(); idx < len; idx++) {
|
|
1403
|
+
var arr = inkLists.lookup(idx);
|
|
1404
|
+
if (arr instanceof core_1.PDFArray)
|
|
1405
|
+
arr.scalePDFNumbers(x, y);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
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
|
+
}());
|
|
1441
|
+
exports.default = PDFPage;
|
|
1442
|
+
//# sourceMappingURL=PDFPage.js.map
|