@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,1454 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var errors_1 = require("./errors");
|
|
5
|
+
var PDFEmbeddedPage_1 = tslib_1.__importDefault(require("./PDFEmbeddedPage"));
|
|
6
|
+
var PDFFont_1 = tslib_1.__importDefault(require("./PDFFont"));
|
|
7
|
+
var PDFImage_1 = tslib_1.__importDefault(require("./PDFImage"));
|
|
8
|
+
var PDFPage_1 = tslib_1.__importDefault(require("./PDFPage"));
|
|
9
|
+
var PDFForm_1 = tslib_1.__importDefault(require("./form/PDFForm"));
|
|
10
|
+
var sizes_1 = require("./sizes");
|
|
11
|
+
var core_1 = require("../core");
|
|
12
|
+
var PDFDocumentOptions_1 = require("./PDFDocumentOptions");
|
|
13
|
+
var utils_1 = require("../utils");
|
|
14
|
+
var FileEmbedder_1 = tslib_1.__importStar(require("../core/embedders/FileEmbedder"));
|
|
15
|
+
var PDFEmbeddedFile_1 = tslib_1.__importDefault(require("./PDFEmbeddedFile"));
|
|
16
|
+
var PDFJavaScript_1 = tslib_1.__importDefault(require("./PDFJavaScript"));
|
|
17
|
+
var JavaScriptEmbedder_1 = tslib_1.__importDefault(require("../core/embedders/JavaScriptEmbedder"));
|
|
18
|
+
var snapshot_1 = require("./snapshot");
|
|
19
|
+
/**
|
|
20
|
+
* Represents a PDF document.
|
|
21
|
+
*/
|
|
22
|
+
var PDFDocument = /** @class */ (function () {
|
|
23
|
+
function PDFDocument(context, ignoreEncryption, updateMetadata) {
|
|
24
|
+
var _this = this;
|
|
25
|
+
/** The default word breaks used in PDFPage.drawText */
|
|
26
|
+
this.defaultWordBreaks = [' '];
|
|
27
|
+
this.computePages = function () {
|
|
28
|
+
var pages = [];
|
|
29
|
+
_this.catalog.Pages().traverse(function (node, ref) {
|
|
30
|
+
if (node instanceof core_1.PDFPageLeaf) {
|
|
31
|
+
var page = _this.pageMap.get(node);
|
|
32
|
+
if (!page) {
|
|
33
|
+
page = PDFPage_1.default.of(node, ref, _this);
|
|
34
|
+
_this.pageMap.set(node, page);
|
|
35
|
+
}
|
|
36
|
+
pages.push(page);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return pages;
|
|
40
|
+
};
|
|
41
|
+
this.getOrCreateForm = function () {
|
|
42
|
+
var acroForm = _this.catalog.getOrCreateAcroForm();
|
|
43
|
+
return PDFForm_1.default.of(acroForm, _this);
|
|
44
|
+
};
|
|
45
|
+
utils_1.assertIs(context, 'context', [[core_1.PDFContext, 'PDFContext']]);
|
|
46
|
+
utils_1.assertIs(ignoreEncryption, 'ignoreEncryption', ['boolean']);
|
|
47
|
+
this.context = context;
|
|
48
|
+
this.catalog = context.lookup(context.trailerInfo.Root);
|
|
49
|
+
this.isEncrypted = !!context.lookup(context.trailerInfo.Encrypt);
|
|
50
|
+
this.pageCache = utils_1.Cache.populatedBy(this.computePages);
|
|
51
|
+
this.pageMap = new Map();
|
|
52
|
+
this.formCache = utils_1.Cache.populatedBy(this.getOrCreateForm);
|
|
53
|
+
this.fonts = [];
|
|
54
|
+
this.images = [];
|
|
55
|
+
this.embeddedPages = [];
|
|
56
|
+
this.embeddedFiles = [];
|
|
57
|
+
this.javaScripts = [];
|
|
58
|
+
if (!ignoreEncryption && this.isEncrypted)
|
|
59
|
+
throw new errors_1.EncryptedPDFError();
|
|
60
|
+
if (updateMetadata)
|
|
61
|
+
this.updateInfoDict();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Load an existing [[PDFDocument]]. The input data can be provided in
|
|
65
|
+
* multiple formats:
|
|
66
|
+
*
|
|
67
|
+
* | Type | Contents |
|
|
68
|
+
* | ------------- | ------------------------------------------------------ |
|
|
69
|
+
* | `string` | A base64 encoded string (or data URI) containing a PDF |
|
|
70
|
+
* | `Uint8Array` | The raw bytes of a PDF |
|
|
71
|
+
* | `ArrayBuffer` | The raw bytes of a PDF |
|
|
72
|
+
*
|
|
73
|
+
* For example:
|
|
74
|
+
* ```js
|
|
75
|
+
* import { PDFDocument } from 'pdf-lib'
|
|
76
|
+
*
|
|
77
|
+
* // pdf=string
|
|
78
|
+
* const base64 =
|
|
79
|
+
* 'JVBERi0xLjcKJYGBgYEKCjUgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbm' +
|
|
80
|
+
* 'd0aCAxMDQKPj4Kc3RyZWFtCniccwrhMlAAwaJ0Ln2P1Jyy1JLM5ERdc0MjCwUjE4WQNC4Q' +
|
|
81
|
+
* '6cNlCFZkqGCqYGSqEJLLZWNuYGZiZmbkYuZsZmlmZGRgZmluDCQNzc3NTM2NzdzMXMxMjQ' +
|
|
82
|
+
* 'ztFEKyuEK0uFxDuAAOERdVCmVuZHN0cmVhbQplbmRvYmoKCjYgMCBvYmoKPDwKL0ZpbHRl' +
|
|
83
|
+
* 'ciAvRmxhdGVEZWNvZGUKL1R5cGUgL09ialN0bQovTiA0Ci9GaXJzdCAyMAovTGVuZ3RoID' +
|
|
84
|
+
* 'IxNQo+PgpzdHJlYW0KeJxVj9GqwjAMhu/zFHkBzTo3nCCCiiKIHPEICuJF3cKoSCu2E8/b' +
|
|
85
|
+
* '20wPIr1p8v9/8kVhgilmGfawX2CGaVrgcAi0/bsy0lrX7IGWpvJ4iJYEN3gEmrrGBlQwGs' +
|
|
86
|
+
* 'HHO9VBX1wNrxAqMX87RBD5xpJuddqwd82tjAHxzV1U5LPgy52DKXWnr1Lheg+j/c/pzGVr' +
|
|
87
|
+
* 'iqV0VlwZPXGPCJjElw/ybkwUmeoWgxesDXGhHJC/D/iikp1Av80ptKU0FdBEe25pPihAM1' +
|
|
88
|
+
* 'u6ytgaaWfs2Hrz35CJT1+EWmAKZW5kc3RyZWFtCmVuZG9iagoKNyAwIG9iago8PAovU2l6' +
|
|
89
|
+
* 'ZSA4Ci9Sb290IDIgMCBSCi9GaWx0ZXIgL0ZsYXRlRGVjb2RlCi9UeXBlIC9YUmVmCi9MZW' +
|
|
90
|
+
* '5ndGggMzgKL1cgWyAxIDIgMiBdCi9JbmRleCBbIDAgOCBdCj4+CnN0cmVhbQp4nBXEwREA' +
|
|
91
|
+
* 'EBAEsCwz3vrvRmOOyyOoGhZdutHN2MT55fIAVocD+AplbmRzdHJlYW0KZW5kb2JqCgpzdG' +
|
|
92
|
+
* 'FydHhyZWYKNTEwCiUlRU9G'
|
|
93
|
+
*
|
|
94
|
+
* const dataUri = 'data:application/pdf;base64,' + base64
|
|
95
|
+
*
|
|
96
|
+
* const pdfDoc1 = await PDFDocument.load(base64)
|
|
97
|
+
* const pdfDoc2 = await PDFDocument.load(dataUri)
|
|
98
|
+
*
|
|
99
|
+
* // pdf=Uint8Array
|
|
100
|
+
* import fs from 'fs'
|
|
101
|
+
* const uint8Array = fs.readFileSync('with_update_sections.pdf')
|
|
102
|
+
* const pdfDoc3 = await PDFDocument.load(uint8Array)
|
|
103
|
+
*
|
|
104
|
+
* // pdf=ArrayBuffer
|
|
105
|
+
* const url = 'https://pdf-lib.js.org/assets/with_update_sections.pdf'
|
|
106
|
+
* const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())
|
|
107
|
+
* const pdfDoc4 = await PDFDocument.load(arrayBuffer)
|
|
108
|
+
*
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @param pdf The input data containing a PDF document.
|
|
112
|
+
* @param options The options to be used when loading the document.
|
|
113
|
+
* @returns Resolves with a document loaded from the input.
|
|
114
|
+
*/
|
|
115
|
+
PDFDocument.load = function (pdf, options) {
|
|
116
|
+
if (options === void 0) { options = {}; }
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var _a, ignoreEncryption, _b, parseSpeed, _c, throwOnInvalidObject, _d, updateMetadata, _e, capNumbers, _f, forIncrementalUpdate, bytes, context, pdfDoc;
|
|
119
|
+
return tslib_1.__generator(this, function (_g) {
|
|
120
|
+
switch (_g.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
_a = options.ignoreEncryption, ignoreEncryption = _a === void 0 ? false : _a, _b = options.parseSpeed, parseSpeed = _b === void 0 ? PDFDocumentOptions_1.ParseSpeeds.Slow : _b, _c = options.throwOnInvalidObject, throwOnInvalidObject = _c === void 0 ? false : _c, _d = options.updateMetadata, updateMetadata = _d === void 0 ? true : _d, _e = options.capNumbers, capNumbers = _e === void 0 ? false : _e, _f = options.forIncrementalUpdate, forIncrementalUpdate = _f === void 0 ? false : _f;
|
|
123
|
+
utils_1.assertIs(pdf, 'pdf', ['string', Uint8Array, ArrayBuffer]);
|
|
124
|
+
utils_1.assertIs(ignoreEncryption, 'ignoreEncryption', ['boolean']);
|
|
125
|
+
utils_1.assertIs(parseSpeed, 'parseSpeed', ['number']);
|
|
126
|
+
utils_1.assertIs(throwOnInvalidObject, 'throwOnInvalidObject', ['boolean']);
|
|
127
|
+
utils_1.assertIs(forIncrementalUpdate, 'forIncrementalUpdate', ['boolean']);
|
|
128
|
+
bytes = utils_1.toUint8Array(pdf);
|
|
129
|
+
return [4 /*yield*/, core_1.PDFParser.forBytesWithOptions(bytes, parseSpeed, throwOnInvalidObject, capNumbers, forIncrementalUpdate).parseDocument()];
|
|
130
|
+
case 1:
|
|
131
|
+
context = _g.sent();
|
|
132
|
+
pdfDoc = new PDFDocument(context, ignoreEncryption, updateMetadata);
|
|
133
|
+
if (forIncrementalUpdate)
|
|
134
|
+
pdfDoc.takeSnapshot();
|
|
135
|
+
return [2 /*return*/, pdfDoc];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Create a new [[PDFDocument]].
|
|
142
|
+
* @returns Resolves with the newly created document.
|
|
143
|
+
*/
|
|
144
|
+
PDFDocument.create = function (options) {
|
|
145
|
+
if (options === void 0) { options = {}; }
|
|
146
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
147
|
+
var _a, updateMetadata, context, pageTree, pageTreeRef, catalog;
|
|
148
|
+
return tslib_1.__generator(this, function (_b) {
|
|
149
|
+
_a = options.updateMetadata, updateMetadata = _a === void 0 ? true : _a;
|
|
150
|
+
context = core_1.PDFContext.create();
|
|
151
|
+
pageTree = core_1.PDFPageTree.withContext(context);
|
|
152
|
+
pageTreeRef = context.register(pageTree);
|
|
153
|
+
catalog = core_1.PDFCatalog.withContextAndPages(context, pageTreeRef);
|
|
154
|
+
context.trailerInfo.Root = context.register(catalog);
|
|
155
|
+
return [2 /*return*/, new PDFDocument(context, false, updateMetadata)];
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Register a fontkit instance. This must be done before custom fonts can
|
|
161
|
+
* be embedded. See [here](https://github.com/Hopding/pdf-lib/tree/master#fontkit-installation)
|
|
162
|
+
* for instructions on how to install and register a fontkit instance.
|
|
163
|
+
*
|
|
164
|
+
* > You do **not** need to call this method to embed standard fonts.
|
|
165
|
+
*
|
|
166
|
+
* For example:
|
|
167
|
+
* ```js
|
|
168
|
+
* import { PDFDocument } from 'pdf-lib'
|
|
169
|
+
* import fontkit from '@pdf-lib/fontkit'
|
|
170
|
+
*
|
|
171
|
+
* const pdfDoc = await PDFDocument.create()
|
|
172
|
+
* pdfDoc.registerFontkit(fontkit)
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* @param fontkit The fontkit instance to be registered.
|
|
176
|
+
*/
|
|
177
|
+
PDFDocument.prototype.registerFontkit = function (fontkit) {
|
|
178
|
+
this.fontkit = fontkit;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Get the [[PDFForm]] containing all interactive fields for this document.
|
|
182
|
+
* For example:
|
|
183
|
+
* ```js
|
|
184
|
+
* const form = pdfDoc.getForm()
|
|
185
|
+
* const fields = form.getFields()
|
|
186
|
+
* fields.forEach(field => {
|
|
187
|
+
* const type = field.constructor.name
|
|
188
|
+
* const name = field.getName()
|
|
189
|
+
* console.log(`${type}: ${name}`)
|
|
190
|
+
* })
|
|
191
|
+
* ```
|
|
192
|
+
* @returns The form for this document.
|
|
193
|
+
*/
|
|
194
|
+
PDFDocument.prototype.getForm = function () {
|
|
195
|
+
var form = this.formCache.access();
|
|
196
|
+
if (form.hasXFA()) {
|
|
197
|
+
console.warn('Removing XFA form data as pdf-lib does not support reading or writing XFA');
|
|
198
|
+
form.deleteXFA();
|
|
199
|
+
}
|
|
200
|
+
return form;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Get this document's title metadata. The title appears in the
|
|
204
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
205
|
+
* ```js
|
|
206
|
+
* const title = pdfDoc.getTitle()
|
|
207
|
+
* ```
|
|
208
|
+
* @returns A string containing the title of this document, if it has one.
|
|
209
|
+
*/
|
|
210
|
+
PDFDocument.prototype.getTitle = function () {
|
|
211
|
+
var title = this.getInfoDict().lookup(core_1.PDFName.Title);
|
|
212
|
+
if (!title)
|
|
213
|
+
return undefined;
|
|
214
|
+
assertIsLiteralOrHexString(title);
|
|
215
|
+
return title.decodeText();
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Get this document's author metadata. The author appears in the
|
|
219
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
220
|
+
* ```js
|
|
221
|
+
* const author = pdfDoc.getAuthor()
|
|
222
|
+
* ```
|
|
223
|
+
* @returns A string containing the author of this document, if it has one.
|
|
224
|
+
*/
|
|
225
|
+
PDFDocument.prototype.getAuthor = function () {
|
|
226
|
+
var author = this.getInfoDict().lookup(core_1.PDFName.Author);
|
|
227
|
+
if (!author)
|
|
228
|
+
return undefined;
|
|
229
|
+
assertIsLiteralOrHexString(author);
|
|
230
|
+
return author.decodeText();
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Get this document's subject metadata. The subject appears in the
|
|
234
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
235
|
+
* ```js
|
|
236
|
+
* const subject = pdfDoc.getSubject()
|
|
237
|
+
* ```
|
|
238
|
+
* @returns A string containing the subject of this document, if it has one.
|
|
239
|
+
*/
|
|
240
|
+
PDFDocument.prototype.getSubject = function () {
|
|
241
|
+
var subject = this.getInfoDict().lookup(core_1.PDFName.Subject);
|
|
242
|
+
if (!subject)
|
|
243
|
+
return undefined;
|
|
244
|
+
assertIsLiteralOrHexString(subject);
|
|
245
|
+
return subject.decodeText();
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Get this document's keywords metadata. The keywords appear in the
|
|
249
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
250
|
+
* ```js
|
|
251
|
+
* const keywords = pdfDoc.getKeywords()
|
|
252
|
+
* ```
|
|
253
|
+
* @returns A string containing the keywords of this document, if it has any.
|
|
254
|
+
*/
|
|
255
|
+
PDFDocument.prototype.getKeywords = function () {
|
|
256
|
+
var keywords = this.getInfoDict().lookup(core_1.PDFName.Keywords);
|
|
257
|
+
if (!keywords)
|
|
258
|
+
return undefined;
|
|
259
|
+
assertIsLiteralOrHexString(keywords);
|
|
260
|
+
return keywords.decodeText();
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Get this document's creator metadata. The creator appears in the
|
|
264
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
265
|
+
* ```js
|
|
266
|
+
* const creator = pdfDoc.getCreator()
|
|
267
|
+
* ```
|
|
268
|
+
* @returns A string containing the creator of this document, if it has one.
|
|
269
|
+
*/
|
|
270
|
+
PDFDocument.prototype.getCreator = function () {
|
|
271
|
+
var creator = this.getInfoDict().lookup(core_1.PDFName.Creator);
|
|
272
|
+
if (!creator)
|
|
273
|
+
return undefined;
|
|
274
|
+
assertIsLiteralOrHexString(creator);
|
|
275
|
+
return creator.decodeText();
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Get this document's producer metadata. The producer appears in the
|
|
279
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
280
|
+
* ```js
|
|
281
|
+
* const producer = pdfDoc.getProducer()
|
|
282
|
+
* ```
|
|
283
|
+
* @returns A string containing the producer of this document, if it has one.
|
|
284
|
+
*/
|
|
285
|
+
PDFDocument.prototype.getProducer = function () {
|
|
286
|
+
var producer = this.getInfoDict().lookup(core_1.PDFName.Producer);
|
|
287
|
+
if (!producer)
|
|
288
|
+
return undefined;
|
|
289
|
+
assertIsLiteralOrHexString(producer);
|
|
290
|
+
return producer.decodeText();
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Get this document's creation date metadata. The creation date appears in
|
|
294
|
+
* the "Document Properties" section of most PDF readers. For example:
|
|
295
|
+
* ```js
|
|
296
|
+
* const creationDate = pdfDoc.getCreationDate()
|
|
297
|
+
* ```
|
|
298
|
+
* @returns A Date containing the creation date of this document,
|
|
299
|
+
* if it has one.
|
|
300
|
+
*/
|
|
301
|
+
PDFDocument.prototype.getCreationDate = function () {
|
|
302
|
+
var creationDate = this.getInfoDict().lookup(core_1.PDFName.CreationDate);
|
|
303
|
+
if (!creationDate)
|
|
304
|
+
return undefined;
|
|
305
|
+
assertIsLiteralOrHexString(creationDate);
|
|
306
|
+
return creationDate.decodeDate();
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Get this document's modification date metadata. The modification date
|
|
310
|
+
* appears in the "Document Properties" section of most PDF readers.
|
|
311
|
+
* For example:
|
|
312
|
+
* ```js
|
|
313
|
+
* const modification = pdfDoc.getModificationDate()
|
|
314
|
+
* ```
|
|
315
|
+
* @returns A Date containing the modification date of this document,
|
|
316
|
+
* if it has one.
|
|
317
|
+
*/
|
|
318
|
+
PDFDocument.prototype.getModificationDate = function () {
|
|
319
|
+
var modificationDate = this.getInfoDict().lookup(core_1.PDFName.ModDate);
|
|
320
|
+
if (!modificationDate)
|
|
321
|
+
return undefined;
|
|
322
|
+
assertIsLiteralOrHexString(modificationDate);
|
|
323
|
+
return modificationDate.decodeDate();
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Set this document's title metadata. The title will appear in the
|
|
327
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
328
|
+
* ```js
|
|
329
|
+
* pdfDoc.setTitle('🥚 The Life of an Egg 🍳')
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* To display the title in the window's title bar, set the
|
|
333
|
+
* `showInWindowTitleBar` option to `true` (works for _most_ PDF readers).
|
|
334
|
+
* For example:
|
|
335
|
+
* ```js
|
|
336
|
+
* pdfDoc.setTitle('🥚 The Life of an Egg 🍳', { showInWindowTitleBar: true })
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* @param title The title of this document.
|
|
340
|
+
* @param options The options to be used when setting the title.
|
|
341
|
+
*/
|
|
342
|
+
PDFDocument.prototype.setTitle = function (title, options) {
|
|
343
|
+
utils_1.assertIs(title, 'title', ['string']);
|
|
344
|
+
var key = core_1.PDFName.of('Title');
|
|
345
|
+
this.getInfoDict().set(key, core_1.PDFHexString.fromText(title));
|
|
346
|
+
// Indicate that readers should display the title rather than the filename
|
|
347
|
+
if (options === null || options === void 0 ? void 0 : options.showInWindowTitleBar) {
|
|
348
|
+
var prefs = this.catalog.getOrCreateViewerPreferences();
|
|
349
|
+
prefs.setDisplayDocTitle(true);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* Set this document's author metadata. The author will appear in the
|
|
354
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
355
|
+
* ```js
|
|
356
|
+
* pdfDoc.setAuthor('Humpty Dumpty')
|
|
357
|
+
* ```
|
|
358
|
+
* @param author The author of this document.
|
|
359
|
+
*/
|
|
360
|
+
PDFDocument.prototype.setAuthor = function (author) {
|
|
361
|
+
utils_1.assertIs(author, 'author', ['string']);
|
|
362
|
+
var key = core_1.PDFName.of('Author');
|
|
363
|
+
this.getInfoDict().set(key, core_1.PDFHexString.fromText(author));
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Set this document's subject metadata. The subject will appear in the
|
|
367
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
368
|
+
* ```js
|
|
369
|
+
* pdfDoc.setSubject('📘 An Epic Tale of Woe 📖')
|
|
370
|
+
* ```
|
|
371
|
+
* @param subject The subject of this document.
|
|
372
|
+
*/
|
|
373
|
+
PDFDocument.prototype.setSubject = function (subject) {
|
|
374
|
+
utils_1.assertIs(subject, 'author', ['string']);
|
|
375
|
+
var key = core_1.PDFName.of('Subject');
|
|
376
|
+
this.getInfoDict().set(key, core_1.PDFHexString.fromText(subject));
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Set this document's keyword metadata. These keywords will appear in the
|
|
380
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
381
|
+
* ```js
|
|
382
|
+
* pdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men'])
|
|
383
|
+
* ```
|
|
384
|
+
* @param keywords An array of keywords associated with this document.
|
|
385
|
+
*/
|
|
386
|
+
PDFDocument.prototype.setKeywords = function (keywords) {
|
|
387
|
+
utils_1.assertIs(keywords, 'keywords', [Array]);
|
|
388
|
+
var key = core_1.PDFName.of('Keywords');
|
|
389
|
+
this.getInfoDict().set(key, core_1.PDFHexString.fromText(keywords.join(' ')));
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Set this document's creator metadata. The creator will appear in the
|
|
393
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
394
|
+
* ```js
|
|
395
|
+
* pdfDoc.setCreator('PDF App 9000 🤖')
|
|
396
|
+
* ```
|
|
397
|
+
* @param creator The creator of this document.
|
|
398
|
+
*/
|
|
399
|
+
PDFDocument.prototype.setCreator = function (creator) {
|
|
400
|
+
utils_1.assertIs(creator, 'creator', ['string']);
|
|
401
|
+
var key = core_1.PDFName.of('Creator');
|
|
402
|
+
this.getInfoDict().set(key, core_1.PDFHexString.fromText(creator));
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Set this document's producer metadata. The producer will appear in the
|
|
406
|
+
* "Document Properties" section of most PDF readers. For example:
|
|
407
|
+
* ```js
|
|
408
|
+
* pdfDoc.setProducer('PDF App 9000 🤖')
|
|
409
|
+
* ```
|
|
410
|
+
* @param producer The producer of this document.
|
|
411
|
+
*/
|
|
412
|
+
PDFDocument.prototype.setProducer = function (producer) {
|
|
413
|
+
utils_1.assertIs(producer, 'creator', ['string']);
|
|
414
|
+
var key = core_1.PDFName.of('Producer');
|
|
415
|
+
this.getInfoDict().set(key, core_1.PDFHexString.fromText(producer));
|
|
416
|
+
};
|
|
417
|
+
/**
|
|
418
|
+
* Set this document's language metadata. The language will appear in the
|
|
419
|
+
* "Document Properties" section of some PDF readers. For example:
|
|
420
|
+
* ```js
|
|
421
|
+
* pdfDoc.setLanguage('en-us')
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* @param language An RFC 3066 _Language-Tag_ denoting the language of this
|
|
425
|
+
* document, or an empty string if the language is unknown.
|
|
426
|
+
*/
|
|
427
|
+
PDFDocument.prototype.setLanguage = function (language) {
|
|
428
|
+
utils_1.assertIs(language, 'language', ['string']);
|
|
429
|
+
var key = core_1.PDFName.of('Lang');
|
|
430
|
+
this.catalog.set(key, core_1.PDFString.of(language));
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Set this document's creation date metadata. The creation date will appear
|
|
434
|
+
* in the "Document Properties" section of most PDF readers. For example:
|
|
435
|
+
* ```js
|
|
436
|
+
* pdfDoc.setCreationDate(new Date())
|
|
437
|
+
* ```
|
|
438
|
+
* @param creationDate The date this document was created.
|
|
439
|
+
*/
|
|
440
|
+
PDFDocument.prototype.setCreationDate = function (creationDate) {
|
|
441
|
+
utils_1.assertIs(creationDate, 'creationDate', [[Date, 'Date']]);
|
|
442
|
+
var key = core_1.PDFName.of('CreationDate');
|
|
443
|
+
this.getInfoDict().set(key, core_1.PDFString.fromDate(creationDate));
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Set this document's modification date metadata. The modification date will
|
|
447
|
+
* appear in the "Document Properties" section of most PDF readers. For
|
|
448
|
+
* example:
|
|
449
|
+
* ```js
|
|
450
|
+
* pdfDoc.setModificationDate(new Date())
|
|
451
|
+
* ```
|
|
452
|
+
* @param modificationDate The date this document was last modified.
|
|
453
|
+
*/
|
|
454
|
+
PDFDocument.prototype.setModificationDate = function (modificationDate) {
|
|
455
|
+
utils_1.assertIs(modificationDate, 'modificationDate', [[Date, 'Date']]);
|
|
456
|
+
var key = core_1.PDFName.of('ModDate');
|
|
457
|
+
this.getInfoDict().set(key, core_1.PDFString.fromDate(modificationDate));
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Get the number of pages contained in this document. For example:
|
|
461
|
+
* ```js
|
|
462
|
+
* const totalPages = pdfDoc.getPageCount()
|
|
463
|
+
* ```
|
|
464
|
+
* @returns The number of pages in this document.
|
|
465
|
+
*/
|
|
466
|
+
PDFDocument.prototype.getPageCount = function () {
|
|
467
|
+
if (this.pageCount === undefined)
|
|
468
|
+
this.pageCount = this.getPages().length;
|
|
469
|
+
return this.pageCount;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Get an array of all the pages contained in this document. The pages are
|
|
473
|
+
* stored in the array in the same order that they are rendered in the
|
|
474
|
+
* document. For example:
|
|
475
|
+
* ```js
|
|
476
|
+
* const pages = pdfDoc.getPages()
|
|
477
|
+
* pages[0] // The first page of the document
|
|
478
|
+
* pages[2] // The third page of the document
|
|
479
|
+
* pages[197] // The 198th page of the document
|
|
480
|
+
* ```
|
|
481
|
+
* @returns An array of all the pages contained in this document.
|
|
482
|
+
*/
|
|
483
|
+
PDFDocument.prototype.getPages = function () {
|
|
484
|
+
return this.pageCache.access();
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Get the page rendered at a particular `index` of the document. For example:
|
|
488
|
+
* ```js
|
|
489
|
+
* pdfDoc.getPage(0) // The first page of the document
|
|
490
|
+
* pdfDoc.getPage(2) // The third page of the document
|
|
491
|
+
* pdfDoc.getPage(197) // The 198th page of the document
|
|
492
|
+
* ```
|
|
493
|
+
* @returns The [[PDFPage]] rendered at the given `index` of the document.
|
|
494
|
+
*/
|
|
495
|
+
PDFDocument.prototype.getPage = function (index) {
|
|
496
|
+
var pages = this.getPages();
|
|
497
|
+
utils_1.assertRange(index, 'index', 0, pages.length - 1);
|
|
498
|
+
return pages[index];
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Get an array of indices for all the pages contained in this document. The
|
|
502
|
+
* array will contain a range of integers from
|
|
503
|
+
* `0..pdfDoc.getPageCount() - 1`. For example:
|
|
504
|
+
* ```js
|
|
505
|
+
* const pdfDoc = await PDFDocument.create()
|
|
506
|
+
* pdfDoc.addPage()
|
|
507
|
+
* pdfDoc.addPage()
|
|
508
|
+
* pdfDoc.addPage()
|
|
509
|
+
*
|
|
510
|
+
* const indices = pdfDoc.getPageIndices()
|
|
511
|
+
* indices // => [0, 1, 2]
|
|
512
|
+
* ```
|
|
513
|
+
* @returns An array of indices for all pages contained in this document.
|
|
514
|
+
*/
|
|
515
|
+
PDFDocument.prototype.getPageIndices = function () {
|
|
516
|
+
return utils_1.range(0, this.getPageCount());
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Remove the page at a given index from this document. For example:
|
|
520
|
+
* ```js
|
|
521
|
+
* pdfDoc.removePage(0) // Remove the first page of the document
|
|
522
|
+
* pdfDoc.removePage(2) // Remove the third page of the document
|
|
523
|
+
* pdfDoc.removePage(197) // Remove the 198th page of the document
|
|
524
|
+
* ```
|
|
525
|
+
* Once a page has been removed, it will no longer be rendered at that index
|
|
526
|
+
* in the document.
|
|
527
|
+
* @param index The index of the page to be removed.
|
|
528
|
+
*/
|
|
529
|
+
PDFDocument.prototype.removePage = function (index) {
|
|
530
|
+
var pageCount = this.getPageCount();
|
|
531
|
+
if (this.pageCount === 0)
|
|
532
|
+
throw new errors_1.RemovePageFromEmptyDocumentError();
|
|
533
|
+
utils_1.assertRange(index, 'index', 0, pageCount - 1);
|
|
534
|
+
this.catalog.removeLeafNode(index);
|
|
535
|
+
this.pageCount = pageCount - 1;
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* Add a page to the end of this document. This method accepts three
|
|
539
|
+
* different value types for the `page` parameter:
|
|
540
|
+
*
|
|
541
|
+
* | Type | Behavior |
|
|
542
|
+
* | ------------------ | ----------------------------------------------------------------------------------- |
|
|
543
|
+
* | `undefined` | Create a new page and add it to the end of this document |
|
|
544
|
+
* | `[number, number]` | Create a new page with the given dimensions and add it to the end of this document |
|
|
545
|
+
* | `PDFPage` | Add the existing page to the end of this document |
|
|
546
|
+
*
|
|
547
|
+
* For example:
|
|
548
|
+
* ```js
|
|
549
|
+
* // page=undefined
|
|
550
|
+
* const newPage = pdfDoc.addPage()
|
|
551
|
+
*
|
|
552
|
+
* // page=[number, number]
|
|
553
|
+
* import { PageSizes } from 'pdf-lib'
|
|
554
|
+
* const newPage1 = pdfDoc.addPage(PageSizes.A7)
|
|
555
|
+
* const newPage2 = pdfDoc.addPage(PageSizes.Letter)
|
|
556
|
+
* const newPage3 = pdfDoc.addPage([500, 750])
|
|
557
|
+
*
|
|
558
|
+
* // page=PDFPage
|
|
559
|
+
* const pdfDoc1 = await PDFDocument.create()
|
|
560
|
+
* const pdfDoc2 = await PDFDocument.load(...)
|
|
561
|
+
* const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0])
|
|
562
|
+
* pdfDoc1.addPage(existingPage)
|
|
563
|
+
* ```
|
|
564
|
+
*
|
|
565
|
+
* @param page Optionally, the desired dimensions or existing page.
|
|
566
|
+
* @returns The newly created (or existing) page.
|
|
567
|
+
*/
|
|
568
|
+
PDFDocument.prototype.addPage = function (page) {
|
|
569
|
+
utils_1.assertIs(page, 'page', ['undefined', [PDFPage_1.default, 'PDFPage'], Array]);
|
|
570
|
+
return this.insertPage(this.getPageCount(), page);
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* Insert a page at a given index within this document. This method accepts
|
|
574
|
+
* three different value types for the `page` parameter:
|
|
575
|
+
*
|
|
576
|
+
* | Type | Behavior |
|
|
577
|
+
* | ------------------ | ------------------------------------------------------------------------------ |
|
|
578
|
+
* | `undefined` | Create a new page and insert it into this document |
|
|
579
|
+
* | `[number, number]` | Create a new page with the given dimensions and insert it into this document |
|
|
580
|
+
* | `PDFPage` | Insert the existing page into this document |
|
|
581
|
+
*
|
|
582
|
+
* For example:
|
|
583
|
+
* ```js
|
|
584
|
+
* // page=undefined
|
|
585
|
+
* const newPage = pdfDoc.insertPage(2)
|
|
586
|
+
*
|
|
587
|
+
* // page=[number, number]
|
|
588
|
+
* import { PageSizes } from 'pdf-lib'
|
|
589
|
+
* const newPage1 = pdfDoc.insertPage(2, PageSizes.A7)
|
|
590
|
+
* const newPage2 = pdfDoc.insertPage(0, PageSizes.Letter)
|
|
591
|
+
* const newPage3 = pdfDoc.insertPage(198, [500, 750])
|
|
592
|
+
*
|
|
593
|
+
* // page=PDFPage
|
|
594
|
+
* const pdfDoc1 = await PDFDocument.create()
|
|
595
|
+
* const pdfDoc2 = await PDFDocument.load(...)
|
|
596
|
+
* const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0])
|
|
597
|
+
* pdfDoc1.insertPage(0, existingPage)
|
|
598
|
+
* ```
|
|
599
|
+
*
|
|
600
|
+
* @param index The index at which the page should be inserted (zero-based).
|
|
601
|
+
* @param page Optionally, the desired dimensions or existing page.
|
|
602
|
+
* @returns The newly created (or existing) page.
|
|
603
|
+
*/
|
|
604
|
+
PDFDocument.prototype.insertPage = function (index, page) {
|
|
605
|
+
var pageCount = this.getPageCount();
|
|
606
|
+
utils_1.assertRange(index, 'index', 0, pageCount);
|
|
607
|
+
utils_1.assertIs(page, 'page', ['undefined', [PDFPage_1.default, 'PDFPage'], Array]);
|
|
608
|
+
if (!page || Array.isArray(page)) {
|
|
609
|
+
var dims = Array.isArray(page) ? page : sizes_1.PageSizes.A4;
|
|
610
|
+
page = PDFPage_1.default.create(this);
|
|
611
|
+
page.setSize.apply(page, dims);
|
|
612
|
+
}
|
|
613
|
+
else if (page.doc !== this) {
|
|
614
|
+
throw new errors_1.ForeignPageError();
|
|
615
|
+
}
|
|
616
|
+
var parentRef = this.catalog.insertLeafNode(page.ref, index);
|
|
617
|
+
page.node.setParent(parentRef);
|
|
618
|
+
this.pageMap.set(page.node, page);
|
|
619
|
+
this.pageCache.invalidate();
|
|
620
|
+
this.pageCount = pageCount + 1;
|
|
621
|
+
return page;
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* Copy pages from a source document into this document. Allows pages to be
|
|
625
|
+
* copied between different [[PDFDocument]] instances. For example:
|
|
626
|
+
* ```js
|
|
627
|
+
* const pdfDoc = await PDFDocument.create()
|
|
628
|
+
* const srcDoc = await PDFDocument.load(...)
|
|
629
|
+
*
|
|
630
|
+
* const copiedPages = await pdfDoc.copyPages(srcDoc, [0, 3, 89])
|
|
631
|
+
* const [firstPage, fourthPage, ninetiethPage] = copiedPages;
|
|
632
|
+
*
|
|
633
|
+
* pdfDoc.addPage(fourthPage)
|
|
634
|
+
* pdfDoc.insertPage(0, ninetiethPage)
|
|
635
|
+
* pdfDoc.addPage(firstPage)
|
|
636
|
+
* ```
|
|
637
|
+
* @param srcDoc The document from which pages should be copied.
|
|
638
|
+
* @param indices The indices of the pages that should be copied.
|
|
639
|
+
* @returns Resolves with an array of pages copied into this document.
|
|
640
|
+
*/
|
|
641
|
+
PDFDocument.prototype.copyPages = function (srcDoc, indices) {
|
|
642
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
643
|
+
var copier, srcPages, copiedPages, idx, len, srcPage, copiedPage, ref;
|
|
644
|
+
return tslib_1.__generator(this, function (_a) {
|
|
645
|
+
switch (_a.label) {
|
|
646
|
+
case 0:
|
|
647
|
+
utils_1.assertIs(srcDoc, 'srcDoc', [[PDFDocument, 'PDFDocument']]);
|
|
648
|
+
utils_1.assertIs(indices, 'indices', [Array]);
|
|
649
|
+
return [4 /*yield*/, srcDoc.flush()];
|
|
650
|
+
case 1:
|
|
651
|
+
_a.sent();
|
|
652
|
+
copier = core_1.PDFObjectCopier.for(srcDoc.context, this.context);
|
|
653
|
+
srcPages = srcDoc.getPages();
|
|
654
|
+
copiedPages = new Array(indices.length);
|
|
655
|
+
for (idx = 0, len = indices.length; idx < len; idx++) {
|
|
656
|
+
srcPage = srcPages[indices[idx]];
|
|
657
|
+
copiedPage = copier.copy(srcPage.node);
|
|
658
|
+
ref = this.context.register(copiedPage);
|
|
659
|
+
copiedPages[idx] = PDFPage_1.default.of(copiedPage, ref, this);
|
|
660
|
+
}
|
|
661
|
+
return [2 /*return*/, copiedPages];
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
};
|
|
666
|
+
/**
|
|
667
|
+
* Get a copy of this document.
|
|
668
|
+
*
|
|
669
|
+
* For example:
|
|
670
|
+
* ```js
|
|
671
|
+
* const srcDoc = await PDFDocument.load(...)
|
|
672
|
+
* const pdfDoc = await srcDoc.copy()
|
|
673
|
+
* ```
|
|
674
|
+
*
|
|
675
|
+
* > **NOTE:** This method won't copy all information over to the new
|
|
676
|
+
* > document (acroforms, outlines, etc...).
|
|
677
|
+
*
|
|
678
|
+
* @returns Resolves with a copy this document.
|
|
679
|
+
*/
|
|
680
|
+
PDFDocument.prototype.copy = function () {
|
|
681
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
682
|
+
var pdfCopy, contentPages, idx, len;
|
|
683
|
+
return tslib_1.__generator(this, function (_a) {
|
|
684
|
+
switch (_a.label) {
|
|
685
|
+
case 0: return [4 /*yield*/, PDFDocument.create()];
|
|
686
|
+
case 1:
|
|
687
|
+
pdfCopy = _a.sent();
|
|
688
|
+
return [4 /*yield*/, pdfCopy.copyPages(this, this.getPageIndices())];
|
|
689
|
+
case 2:
|
|
690
|
+
contentPages = _a.sent();
|
|
691
|
+
for (idx = 0, len = contentPages.length; idx < len; idx++) {
|
|
692
|
+
pdfCopy.addPage(contentPages[idx]);
|
|
693
|
+
}
|
|
694
|
+
if (this.getAuthor() !== undefined) {
|
|
695
|
+
pdfCopy.setAuthor(this.getAuthor());
|
|
696
|
+
}
|
|
697
|
+
if (this.getCreationDate() !== undefined) {
|
|
698
|
+
pdfCopy.setCreationDate(this.getCreationDate());
|
|
699
|
+
}
|
|
700
|
+
if (this.getCreator() !== undefined) {
|
|
701
|
+
pdfCopy.setCreator(this.getCreator());
|
|
702
|
+
}
|
|
703
|
+
if (this.getModificationDate() !== undefined) {
|
|
704
|
+
pdfCopy.setModificationDate(this.getModificationDate());
|
|
705
|
+
}
|
|
706
|
+
if (this.getProducer() !== undefined) {
|
|
707
|
+
pdfCopy.setProducer(this.getProducer());
|
|
708
|
+
}
|
|
709
|
+
if (this.getSubject() !== undefined) {
|
|
710
|
+
pdfCopy.setSubject(this.getSubject());
|
|
711
|
+
}
|
|
712
|
+
if (this.getTitle() !== undefined) {
|
|
713
|
+
pdfCopy.setTitle(this.getTitle());
|
|
714
|
+
}
|
|
715
|
+
pdfCopy.defaultWordBreaks = this.defaultWordBreaks;
|
|
716
|
+
return [2 /*return*/, pdfCopy];
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
});
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
* Add JavaScript to this document. The supplied `script` is executed when the
|
|
723
|
+
* document is opened. The `script` can be used to perform some operation
|
|
724
|
+
* when the document is opened (e.g. logging to the console), or it can be
|
|
725
|
+
* used to define a function that can be referenced later in a JavaScript
|
|
726
|
+
* action. For example:
|
|
727
|
+
* ```js
|
|
728
|
+
* // Show "Hello World!" in the console when the PDF is opened
|
|
729
|
+
* pdfDoc.addJavaScript(
|
|
730
|
+
* 'main',
|
|
731
|
+
* 'console.show(); console.println("Hello World!");'
|
|
732
|
+
* );
|
|
733
|
+
*
|
|
734
|
+
* // Define a function named "foo" that can be called in JavaScript Actions
|
|
735
|
+
* pdfDoc.addJavaScript(
|
|
736
|
+
* 'foo',
|
|
737
|
+
* 'function foo() { return "foo"; }'
|
|
738
|
+
* );
|
|
739
|
+
* ```
|
|
740
|
+
* See the [JavaScript for Acrobat API Reference](https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf)
|
|
741
|
+
* for details.
|
|
742
|
+
* @param name The name of the script. Must be unique per document.
|
|
743
|
+
* @param script The JavaScript to execute.
|
|
744
|
+
*/
|
|
745
|
+
PDFDocument.prototype.addJavaScript = function (name, script) {
|
|
746
|
+
utils_1.assertIs(name, 'name', ['string']);
|
|
747
|
+
utils_1.assertIs(script, 'script', ['string']);
|
|
748
|
+
var embedder = JavaScriptEmbedder_1.default.for(script, name);
|
|
749
|
+
var ref = this.context.nextRef();
|
|
750
|
+
var javaScript = PDFJavaScript_1.default.of(ref, this, embedder);
|
|
751
|
+
this.javaScripts.push(javaScript);
|
|
752
|
+
};
|
|
753
|
+
/**
|
|
754
|
+
* Add an attachment to this document. Attachments are visible in the
|
|
755
|
+
* "Attachments" panel of Adobe Acrobat and some other PDF readers. Any
|
|
756
|
+
* type of file can be added as an attachment. This includes, but is not
|
|
757
|
+
* limited to, `.png`, `.jpg`, `.pdf`, `.csv`, `.docx`, and `.xlsx` files.
|
|
758
|
+
*
|
|
759
|
+
* The input data can be provided in multiple formats:
|
|
760
|
+
*
|
|
761
|
+
* | Type | Contents |
|
|
762
|
+
* | ------------- | -------------------------------------------------------------- |
|
|
763
|
+
* | `string` | A base64 encoded string (or data URI) containing an attachment |
|
|
764
|
+
* | `Uint8Array` | The raw bytes of an attachment |
|
|
765
|
+
* | `ArrayBuffer` | The raw bytes of an attachment |
|
|
766
|
+
*
|
|
767
|
+
* For example:
|
|
768
|
+
* ```js
|
|
769
|
+
* // attachment=string
|
|
770
|
+
* await pdfDoc.attach('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...', 'cat_riding_unicorn.jpg', {
|
|
771
|
+
* mimeType: 'image/jpeg',
|
|
772
|
+
* description: 'Cool cat riding a unicorn! 🦄🐈🕶️',
|
|
773
|
+
* creationDate: new Date('2019/12/01'),
|
|
774
|
+
* modificationDate: new Date('2020/04/19'),
|
|
775
|
+
* })
|
|
776
|
+
* await pdfDoc.attach('data:image/jpeg;base64,/9j/4AAQ...', 'cat_riding_unicorn.jpg', {
|
|
777
|
+
* mimeType: 'image/jpeg',
|
|
778
|
+
* description: 'Cool cat riding a unicorn! 🦄🐈🕶️',
|
|
779
|
+
* creationDate: new Date('2019/12/01'),
|
|
780
|
+
* modificationDate: new Date('2020/04/19'),
|
|
781
|
+
* })
|
|
782
|
+
*
|
|
783
|
+
* // attachment=Uint8Array
|
|
784
|
+
* import fs from 'fs'
|
|
785
|
+
* const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg')
|
|
786
|
+
* await pdfDoc.attach(uint8Array, 'cat_riding_unicorn.jpg', {
|
|
787
|
+
* mimeType: 'image/jpeg',
|
|
788
|
+
* description: 'Cool cat riding a unicorn! 🦄🐈🕶️',
|
|
789
|
+
* creationDate: new Date('2019/12/01'),
|
|
790
|
+
* modificationDate: new Date('2020/04/19'),
|
|
791
|
+
* })
|
|
792
|
+
*
|
|
793
|
+
* // attachment=ArrayBuffer
|
|
794
|
+
* const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'
|
|
795
|
+
* const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())
|
|
796
|
+
* await pdfDoc.attach(arrayBuffer, 'cat_riding_unicorn.jpg', {
|
|
797
|
+
* mimeType: 'image/jpeg',
|
|
798
|
+
* description: 'Cool cat riding a unicorn! 🦄🐈🕶️',
|
|
799
|
+
* creationDate: new Date('2019/12/01'),
|
|
800
|
+
* modificationDate: new Date('2020/04/19'),
|
|
801
|
+
* })
|
|
802
|
+
* ```
|
|
803
|
+
*
|
|
804
|
+
* @param attachment The input data containing the file to be attached.
|
|
805
|
+
* @param name The name of the file to be attached.
|
|
806
|
+
* @returns Resolves when the attachment is complete.
|
|
807
|
+
*/
|
|
808
|
+
PDFDocument.prototype.attach = function (attachment, name, options) {
|
|
809
|
+
if (options === void 0) { options = {}; }
|
|
810
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
811
|
+
var bytes, embedder, ref, embeddedFile;
|
|
812
|
+
return tslib_1.__generator(this, function (_a) {
|
|
813
|
+
utils_1.assertIs(attachment, 'attachment', ['string', Uint8Array, ArrayBuffer]);
|
|
814
|
+
utils_1.assertIs(name, 'name', ['string']);
|
|
815
|
+
utils_1.assertOrUndefined(options.mimeType, 'mimeType', ['string']);
|
|
816
|
+
utils_1.assertOrUndefined(options.description, 'description', ['string']);
|
|
817
|
+
utils_1.assertOrUndefined(options.creationDate, 'options.creationDate', [Date]);
|
|
818
|
+
utils_1.assertOrUndefined(options.modificationDate, 'options.modificationDate', [
|
|
819
|
+
Date,
|
|
820
|
+
]);
|
|
821
|
+
utils_1.assertIsOneOfOrUndefined(options.afRelationship, 'options.afRelationship', FileEmbedder_1.AFRelationship);
|
|
822
|
+
bytes = utils_1.toUint8Array(attachment);
|
|
823
|
+
embedder = FileEmbedder_1.default.for(bytes, name, options);
|
|
824
|
+
ref = this.context.nextRef();
|
|
825
|
+
embeddedFile = PDFEmbeddedFile_1.default.of(ref, this, embedder);
|
|
826
|
+
this.embeddedFiles.push(embeddedFile);
|
|
827
|
+
return [2 /*return*/];
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* Embed a font into this document. The input data can be provided in multiple
|
|
833
|
+
* formats:
|
|
834
|
+
*
|
|
835
|
+
* | Type | Contents |
|
|
836
|
+
* | --------------- | ------------------------------------------------------- |
|
|
837
|
+
* | `StandardFonts` | One of the standard 14 fonts |
|
|
838
|
+
* | `string` | A base64 encoded string (or data URI) containing a font |
|
|
839
|
+
* | `Uint8Array` | The raw bytes of a font |
|
|
840
|
+
* | `ArrayBuffer` | The raw bytes of a font |
|
|
841
|
+
*
|
|
842
|
+
* For example:
|
|
843
|
+
* ```js
|
|
844
|
+
* // font=StandardFonts
|
|
845
|
+
* import { StandardFonts } from 'pdf-lib'
|
|
846
|
+
* const font1 = await pdfDoc.embedFont(StandardFonts.Helvetica)
|
|
847
|
+
*
|
|
848
|
+
* // font=string
|
|
849
|
+
* const font2 = await pdfDoc.embedFont('AAEAAAAVAQAABABQRFNJRx/upe...')
|
|
850
|
+
* const font3 = await pdfDoc.embedFont('data:font/opentype;base64,AAEAAA...')
|
|
851
|
+
*
|
|
852
|
+
* // font=Uint8Array
|
|
853
|
+
* import fs from 'fs'
|
|
854
|
+
* const font4 = await pdfDoc.embedFont(fs.readFileSync('Ubuntu-R.ttf'))
|
|
855
|
+
*
|
|
856
|
+
* // font=ArrayBuffer
|
|
857
|
+
* const url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf'
|
|
858
|
+
* const ubuntuBytes = await fetch(url).then(res => res.arrayBuffer())
|
|
859
|
+
* const font5 = await pdfDoc.embedFont(ubuntuBytes)
|
|
860
|
+
* ```
|
|
861
|
+
* See also: [[registerFontkit]]
|
|
862
|
+
* @param font The input data for a font.
|
|
863
|
+
* @param options The options to be used when embedding the font.
|
|
864
|
+
* @returns Resolves with the embedded font.
|
|
865
|
+
*/
|
|
866
|
+
PDFDocument.prototype.embedFont = function (font, options) {
|
|
867
|
+
if (options === void 0) { options = {}; }
|
|
868
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
869
|
+
var _a, subset, customName, features, embedder, bytes, fontkit, _b, ref, pdfFont;
|
|
870
|
+
return tslib_1.__generator(this, function (_c) {
|
|
871
|
+
switch (_c.label) {
|
|
872
|
+
case 0:
|
|
873
|
+
_a = options.subset, subset = _a === void 0 ? false : _a, customName = options.customName, features = options.features;
|
|
874
|
+
utils_1.assertIs(font, 'font', ['string', Uint8Array, ArrayBuffer]);
|
|
875
|
+
utils_1.assertIs(subset, 'subset', ['boolean']);
|
|
876
|
+
if (!utils_1.isStandardFont(font)) return [3 /*break*/, 1];
|
|
877
|
+
embedder = core_1.StandardFontEmbedder.for(font, customName);
|
|
878
|
+
return [3 /*break*/, 7];
|
|
879
|
+
case 1:
|
|
880
|
+
if (!utils_1.canBeConvertedToUint8Array(font)) return [3 /*break*/, 6];
|
|
881
|
+
bytes = utils_1.toUint8Array(font);
|
|
882
|
+
fontkit = this.assertFontkit();
|
|
883
|
+
if (!subset) return [3 /*break*/, 3];
|
|
884
|
+
return [4 /*yield*/, core_1.CustomFontSubsetEmbedder.for(fontkit, bytes, customName, features)];
|
|
885
|
+
case 2:
|
|
886
|
+
_b = _c.sent();
|
|
887
|
+
return [3 /*break*/, 5];
|
|
888
|
+
case 3: return [4 /*yield*/, core_1.CustomFontEmbedder.for(fontkit, bytes, customName, features)];
|
|
889
|
+
case 4:
|
|
890
|
+
_b = _c.sent();
|
|
891
|
+
_c.label = 5;
|
|
892
|
+
case 5:
|
|
893
|
+
embedder = _b;
|
|
894
|
+
return [3 /*break*/, 7];
|
|
895
|
+
case 6: throw new TypeError('`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`');
|
|
896
|
+
case 7:
|
|
897
|
+
ref = this.context.nextRef();
|
|
898
|
+
pdfFont = PDFFont_1.default.of(ref, this, embedder);
|
|
899
|
+
this.fonts.push(pdfFont);
|
|
900
|
+
return [2 /*return*/, pdfFont];
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
};
|
|
905
|
+
/**
|
|
906
|
+
* Embed a standard font into this document.
|
|
907
|
+
* For example:
|
|
908
|
+
* ```js
|
|
909
|
+
* import { StandardFonts } from 'pdf-lib'
|
|
910
|
+
* const helveticaFont = pdfDoc.embedFont(StandardFonts.Helvetica)
|
|
911
|
+
* ```
|
|
912
|
+
* @param font The standard font to be embedded.
|
|
913
|
+
* @param customName The name to be used when embedding the font.
|
|
914
|
+
* @returns The embedded font.
|
|
915
|
+
*/
|
|
916
|
+
PDFDocument.prototype.embedStandardFont = function (font, customName) {
|
|
917
|
+
utils_1.assertIs(font, 'font', ['string']);
|
|
918
|
+
if (!utils_1.isStandardFont(font)) {
|
|
919
|
+
throw new TypeError('`font` must be one of type `StandardFonts`');
|
|
920
|
+
}
|
|
921
|
+
var embedder = core_1.StandardFontEmbedder.for(font, customName);
|
|
922
|
+
var ref = this.context.nextRef();
|
|
923
|
+
var pdfFont = PDFFont_1.default.of(ref, this, embedder);
|
|
924
|
+
this.fonts.push(pdfFont);
|
|
925
|
+
return pdfFont;
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Embed a JPEG image into this document. The input data can be provided in
|
|
929
|
+
* multiple formats:
|
|
930
|
+
*
|
|
931
|
+
* | Type | Contents |
|
|
932
|
+
* | ------------- | ------------------------------------------------------------- |
|
|
933
|
+
* | `string` | A base64 encoded string (or data URI) containing a JPEG image |
|
|
934
|
+
* | `Uint8Array` | The raw bytes of a JPEG image |
|
|
935
|
+
* | `ArrayBuffer` | The raw bytes of a JPEG image |
|
|
936
|
+
*
|
|
937
|
+
* For example:
|
|
938
|
+
* ```js
|
|
939
|
+
* // jpg=string
|
|
940
|
+
* const image1 = await pdfDoc.embedJpg('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...')
|
|
941
|
+
* const image2 = await pdfDoc.embedJpg('data:image/jpeg;base64,/9j/4AAQ...')
|
|
942
|
+
*
|
|
943
|
+
* // jpg=Uint8Array
|
|
944
|
+
* import fs from 'fs'
|
|
945
|
+
* const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg')
|
|
946
|
+
* const image3 = await pdfDoc.embedJpg(uint8Array)
|
|
947
|
+
*
|
|
948
|
+
* // jpg=ArrayBuffer
|
|
949
|
+
* const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'
|
|
950
|
+
* const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())
|
|
951
|
+
* const image4 = await pdfDoc.embedJpg(arrayBuffer)
|
|
952
|
+
* ```
|
|
953
|
+
*
|
|
954
|
+
* @param jpg The input data for a JPEG image.
|
|
955
|
+
* @returns Resolves with the embedded image.
|
|
956
|
+
*/
|
|
957
|
+
PDFDocument.prototype.embedJpg = function (jpg) {
|
|
958
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
959
|
+
var bytes, embedder, ref, pdfImage;
|
|
960
|
+
return tslib_1.__generator(this, function (_a) {
|
|
961
|
+
switch (_a.label) {
|
|
962
|
+
case 0:
|
|
963
|
+
utils_1.assertIs(jpg, 'jpg', ['string', Uint8Array, ArrayBuffer]);
|
|
964
|
+
bytes = utils_1.toUint8Array(jpg);
|
|
965
|
+
return [4 /*yield*/, core_1.JpegEmbedder.for(bytes)];
|
|
966
|
+
case 1:
|
|
967
|
+
embedder = _a.sent();
|
|
968
|
+
ref = this.context.nextRef();
|
|
969
|
+
pdfImage = PDFImage_1.default.of(ref, this, embedder);
|
|
970
|
+
this.images.push(pdfImage);
|
|
971
|
+
return [2 /*return*/, pdfImage];
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
});
|
|
975
|
+
};
|
|
976
|
+
/**
|
|
977
|
+
* Embed a PNG image into this document. The input data can be provided in
|
|
978
|
+
* multiple formats:
|
|
979
|
+
*
|
|
980
|
+
* | Type | Contents |
|
|
981
|
+
* | ------------- | ------------------------------------------------------------ |
|
|
982
|
+
* | `string` | A base64 encoded string (or data URI) containing a PNG image |
|
|
983
|
+
* | `Uint8Array` | The raw bytes of a PNG image |
|
|
984
|
+
* | `ArrayBuffer` | The raw bytes of a PNG image |
|
|
985
|
+
*
|
|
986
|
+
* For example:
|
|
987
|
+
* ```js
|
|
988
|
+
* // png=string
|
|
989
|
+
* const image1 = await pdfDoc.embedPng('iVBORw0KGgoAAAANSUhEUgAAAlgAAAF3...')
|
|
990
|
+
* const image2 = await pdfDoc.embedPng('data:image/png;base64,iVBORw0KGg...')
|
|
991
|
+
*
|
|
992
|
+
* // png=Uint8Array
|
|
993
|
+
* import fs from 'fs'
|
|
994
|
+
* const uint8Array = fs.readFileSync('small_mario.png')
|
|
995
|
+
* const image3 = await pdfDoc.embedPng(uint8Array)
|
|
996
|
+
*
|
|
997
|
+
* // png=ArrayBuffer
|
|
998
|
+
* const url = 'https://pdf-lib.js.org/assets/small_mario.png'
|
|
999
|
+
* const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())
|
|
1000
|
+
* const image4 = await pdfDoc.embedPng(arrayBuffer)
|
|
1001
|
+
* ```
|
|
1002
|
+
*
|
|
1003
|
+
* @param png The input data for a PNG image.
|
|
1004
|
+
* @returns Resolves with the embedded image.
|
|
1005
|
+
*/
|
|
1006
|
+
PDFDocument.prototype.embedPng = function (png) {
|
|
1007
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1008
|
+
var bytes, embedder, ref, pdfImage;
|
|
1009
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1010
|
+
switch (_a.label) {
|
|
1011
|
+
case 0:
|
|
1012
|
+
utils_1.assertIs(png, 'png', ['string', Uint8Array, ArrayBuffer]);
|
|
1013
|
+
bytes = utils_1.toUint8Array(png);
|
|
1014
|
+
return [4 /*yield*/, core_1.PngEmbedder.for(bytes)];
|
|
1015
|
+
case 1:
|
|
1016
|
+
embedder = _a.sent();
|
|
1017
|
+
ref = this.context.nextRef();
|
|
1018
|
+
pdfImage = PDFImage_1.default.of(ref, this, embedder);
|
|
1019
|
+
this.images.push(pdfImage);
|
|
1020
|
+
return [2 /*return*/, pdfImage];
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
};
|
|
1025
|
+
/**
|
|
1026
|
+
* Embed one or more PDF pages into this document.
|
|
1027
|
+
*
|
|
1028
|
+
* For example:
|
|
1029
|
+
* ```js
|
|
1030
|
+
* const pdfDoc = await PDFDocument.create()
|
|
1031
|
+
*
|
|
1032
|
+
* const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'
|
|
1033
|
+
* const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())
|
|
1034
|
+
*
|
|
1035
|
+
* // Embed page 74 of `sourcePdf` into `pdfDoc`
|
|
1036
|
+
* const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, [73])
|
|
1037
|
+
* ```
|
|
1038
|
+
*
|
|
1039
|
+
* See [[PDFDocument.load]] for examples of the allowed input data formats.
|
|
1040
|
+
*
|
|
1041
|
+
* @param pdf The input data containing a PDF document.
|
|
1042
|
+
* @param indices The indices of the pages that should be embedded.
|
|
1043
|
+
* @returns Resolves with an array of the embedded pages.
|
|
1044
|
+
*/
|
|
1045
|
+
PDFDocument.prototype.embedPdf = function (pdf, indices) {
|
|
1046
|
+
if (indices === void 0) { indices = [0]; }
|
|
1047
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1048
|
+
var srcDoc, _a, srcPages;
|
|
1049
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1050
|
+
switch (_b.label) {
|
|
1051
|
+
case 0:
|
|
1052
|
+
utils_1.assertIs(pdf, 'pdf', [
|
|
1053
|
+
'string',
|
|
1054
|
+
Uint8Array,
|
|
1055
|
+
ArrayBuffer,
|
|
1056
|
+
[PDFDocument, 'PDFDocument'],
|
|
1057
|
+
]);
|
|
1058
|
+
utils_1.assertIs(indices, 'indices', [Array]);
|
|
1059
|
+
if (!(pdf instanceof PDFDocument)) return [3 /*break*/, 1];
|
|
1060
|
+
_a = pdf;
|
|
1061
|
+
return [3 /*break*/, 3];
|
|
1062
|
+
case 1: return [4 /*yield*/, PDFDocument.load(pdf)];
|
|
1063
|
+
case 2:
|
|
1064
|
+
_a = _b.sent();
|
|
1065
|
+
_b.label = 3;
|
|
1066
|
+
case 3:
|
|
1067
|
+
srcDoc = _a;
|
|
1068
|
+
srcPages = utils_1.pluckIndices(srcDoc.getPages(), indices);
|
|
1069
|
+
return [2 /*return*/, this.embedPages(srcPages)];
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
/**
|
|
1075
|
+
* Embed a single PDF page into this document.
|
|
1076
|
+
*
|
|
1077
|
+
* For example:
|
|
1078
|
+
* ```js
|
|
1079
|
+
* const pdfDoc = await PDFDocument.create()
|
|
1080
|
+
*
|
|
1081
|
+
* const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'
|
|
1082
|
+
* const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())
|
|
1083
|
+
* const sourcePdfDoc = await PDFDocument.load(sourceBuffer)
|
|
1084
|
+
* const sourcePdfPage = sourcePdfDoc.getPages()[73]
|
|
1085
|
+
*
|
|
1086
|
+
* const embeddedPage = await pdfDoc.embedPage(
|
|
1087
|
+
* sourcePdfPage,
|
|
1088
|
+
*
|
|
1089
|
+
* // Clip a section of the source page so that we only embed part of it
|
|
1090
|
+
* { left: 100, right: 450, bottom: 330, top: 570 },
|
|
1091
|
+
*
|
|
1092
|
+
* // Translate all drawings of the embedded page by (10, 200) units
|
|
1093
|
+
* [1, 0, 0, 1, 10, 200],
|
|
1094
|
+
* )
|
|
1095
|
+
* ```
|
|
1096
|
+
*
|
|
1097
|
+
* @param page The page to be embedded.
|
|
1098
|
+
* @param boundingBox
|
|
1099
|
+
* Optionally, an area of the source page that should be embedded
|
|
1100
|
+
* (defaults to entire page).
|
|
1101
|
+
* @param transformationMatrix
|
|
1102
|
+
* Optionally, a transformation matrix that is always applied to the embedded
|
|
1103
|
+
* page anywhere it is drawn.
|
|
1104
|
+
* @returns Resolves with the embedded pdf page.
|
|
1105
|
+
*/
|
|
1106
|
+
PDFDocument.prototype.embedPage = function (page, boundingBox, transformationMatrix) {
|
|
1107
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1108
|
+
var embeddedPage;
|
|
1109
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1110
|
+
switch (_a.label) {
|
|
1111
|
+
case 0:
|
|
1112
|
+
utils_1.assertIs(page, 'page', [[PDFPage_1.default, 'PDFPage']]);
|
|
1113
|
+
return [4 /*yield*/, this.embedPages([page], [boundingBox], [transformationMatrix])];
|
|
1114
|
+
case 1:
|
|
1115
|
+
embeddedPage = (_a.sent())[0];
|
|
1116
|
+
return [2 /*return*/, embeddedPage];
|
|
1117
|
+
}
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
};
|
|
1121
|
+
/**
|
|
1122
|
+
* Embed one or more PDF pages into this document.
|
|
1123
|
+
*
|
|
1124
|
+
* For example:
|
|
1125
|
+
* ```js
|
|
1126
|
+
* const pdfDoc = await PDFDocument.create()
|
|
1127
|
+
*
|
|
1128
|
+
* const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'
|
|
1129
|
+
* const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())
|
|
1130
|
+
* const sourcePdfDoc = await PDFDocument.load(sourceBuffer)
|
|
1131
|
+
*
|
|
1132
|
+
* const page1 = sourcePdfDoc.getPages()[0]
|
|
1133
|
+
* const page2 = sourcePdfDoc.getPages()[52]
|
|
1134
|
+
* const page3 = sourcePdfDoc.getPages()[73]
|
|
1135
|
+
*
|
|
1136
|
+
* const embeddedPages = await pdfDoc.embedPages([page1, page2, page3])
|
|
1137
|
+
* ```
|
|
1138
|
+
*
|
|
1139
|
+
* @param page
|
|
1140
|
+
* The pages to be embedded (they must all share the same context).
|
|
1141
|
+
* @param boundingBoxes
|
|
1142
|
+
* Optionally, an array of clipping boundaries - one for each page
|
|
1143
|
+
* (defaults to entirety of each page).
|
|
1144
|
+
* @param transformationMatrices
|
|
1145
|
+
* Optionally, an array of transformation matrices - one for each page
|
|
1146
|
+
* (each page's transformation will apply anywhere it is drawn).
|
|
1147
|
+
* @returns Resolves with an array of the embedded pdf pages.
|
|
1148
|
+
*/
|
|
1149
|
+
PDFDocument.prototype.embedPages = function (pages, boundingBoxes, transformationMatrices) {
|
|
1150
|
+
if (boundingBoxes === void 0) { boundingBoxes = []; }
|
|
1151
|
+
if (transformationMatrices === void 0) { transformationMatrices = []; }
|
|
1152
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1153
|
+
var idx, len, currPage, nextPage, context, maybeCopyPage, embeddedPages, idx, len, page, box, matrix, embedder, ref;
|
|
1154
|
+
var _a;
|
|
1155
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1156
|
+
switch (_b.label) {
|
|
1157
|
+
case 0:
|
|
1158
|
+
if (pages.length === 0)
|
|
1159
|
+
return [2 /*return*/, []];
|
|
1160
|
+
// Assert all pages have the same context
|
|
1161
|
+
for (idx = 0, len = pages.length - 1; idx < len; idx++) {
|
|
1162
|
+
currPage = pages[idx];
|
|
1163
|
+
nextPage = pages[idx + 1];
|
|
1164
|
+
if (currPage.node.context !== nextPage.node.context) {
|
|
1165
|
+
throw new core_1.PageEmbeddingMismatchedContextError();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
context = pages[0].node.context;
|
|
1169
|
+
maybeCopyPage = context === this.context
|
|
1170
|
+
? function (p) { return p; }
|
|
1171
|
+
: core_1.PDFObjectCopier.for(context, this.context).copy;
|
|
1172
|
+
embeddedPages = new Array(pages.length);
|
|
1173
|
+
idx = 0, len = pages.length;
|
|
1174
|
+
_b.label = 1;
|
|
1175
|
+
case 1:
|
|
1176
|
+
if (!(idx < len)) return [3 /*break*/, 4];
|
|
1177
|
+
page = maybeCopyPage(pages[idx].node);
|
|
1178
|
+
box = boundingBoxes[idx];
|
|
1179
|
+
matrix = transformationMatrices[idx];
|
|
1180
|
+
return [4 /*yield*/, core_1.PDFPageEmbedder.for(page, box, matrix)];
|
|
1181
|
+
case 2:
|
|
1182
|
+
embedder = _b.sent();
|
|
1183
|
+
ref = this.context.nextRef();
|
|
1184
|
+
embeddedPages[idx] = PDFEmbeddedPage_1.default.of(ref, this, embedder);
|
|
1185
|
+
_b.label = 3;
|
|
1186
|
+
case 3:
|
|
1187
|
+
idx++;
|
|
1188
|
+
return [3 /*break*/, 1];
|
|
1189
|
+
case 4:
|
|
1190
|
+
(_a = this.embeddedPages).push.apply(_a, embeddedPages);
|
|
1191
|
+
return [2 /*return*/, embeddedPages];
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
/**
|
|
1197
|
+
* > **NOTE:** You shouldn't need to call this method directly. The [[save]]
|
|
1198
|
+
* > and [[saveAsBase64]] methods will automatically ensure that all embedded
|
|
1199
|
+
* > assets are flushed before serializing the document.
|
|
1200
|
+
*
|
|
1201
|
+
* Flush all embedded fonts, PDF pages, and images to this document's
|
|
1202
|
+
* [[context]].
|
|
1203
|
+
*
|
|
1204
|
+
* @returns Resolves when the flush is complete.
|
|
1205
|
+
*/
|
|
1206
|
+
PDFDocument.prototype.flush = function () {
|
|
1207
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1208
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1209
|
+
switch (_a.label) {
|
|
1210
|
+
case 0: return [4 /*yield*/, this.embedAll(this.fonts)];
|
|
1211
|
+
case 1:
|
|
1212
|
+
_a.sent();
|
|
1213
|
+
return [4 /*yield*/, this.embedAll(this.images)];
|
|
1214
|
+
case 2:
|
|
1215
|
+
_a.sent();
|
|
1216
|
+
return [4 /*yield*/, this.embedAll(this.embeddedPages)];
|
|
1217
|
+
case 3:
|
|
1218
|
+
_a.sent();
|
|
1219
|
+
return [4 /*yield*/, this.embedAll(this.embeddedFiles)];
|
|
1220
|
+
case 4:
|
|
1221
|
+
_a.sent();
|
|
1222
|
+
return [4 /*yield*/, this.embedAll(this.javaScripts)];
|
|
1223
|
+
case 5:
|
|
1224
|
+
_a.sent();
|
|
1225
|
+
return [2 /*return*/];
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
});
|
|
1229
|
+
};
|
|
1230
|
+
/**
|
|
1231
|
+
* Serialize this document to an array of bytes making up a PDF file.
|
|
1232
|
+
* For example:
|
|
1233
|
+
* ```js
|
|
1234
|
+
* const pdfBytes = await pdfDoc.save()
|
|
1235
|
+
* ```
|
|
1236
|
+
*
|
|
1237
|
+
* There are a number of things you can do with the serialized document,
|
|
1238
|
+
* depending on the JavaScript environment you're running in:
|
|
1239
|
+
* * Write it to a file in Node or React Native
|
|
1240
|
+
* * Download it as a Blob in the browser
|
|
1241
|
+
* * Render it in an `iframe`
|
|
1242
|
+
*
|
|
1243
|
+
* @param options The options to be used when saving the document.
|
|
1244
|
+
* @returns Resolves with the bytes of the serialized document.
|
|
1245
|
+
*/
|
|
1246
|
+
PDFDocument.prototype.save = function (options) {
|
|
1247
|
+
if (options === void 0) { options = {}; }
|
|
1248
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1249
|
+
var _a, useObjectStreams, _b, objectsPerTick, _c, rewrite, incrementalUpdate, Writer, increment, result;
|
|
1250
|
+
return tslib_1.__generator(this, function (_d) {
|
|
1251
|
+
switch (_d.label) {
|
|
1252
|
+
case 0:
|
|
1253
|
+
_a = options.useObjectStreams, useObjectStreams = _a === void 0 ? true : _a, _b = options.objectsPerTick, objectsPerTick = _b === void 0 ? 50 : _b, _c = options.rewrite, rewrite = _c === void 0 ? false : _c;
|
|
1254
|
+
utils_1.assertIs(useObjectStreams, 'useObjectStreams', ['boolean']);
|
|
1255
|
+
utils_1.assertIs(objectsPerTick, 'objectsPerTick', ['number']);
|
|
1256
|
+
utils_1.assertIs(rewrite, 'rewrite', ['boolean']);
|
|
1257
|
+
incrementalUpdate = !rewrite &&
|
|
1258
|
+
this.context.pdfFileDetails.originalBytes &&
|
|
1259
|
+
this.context.snapshot;
|
|
1260
|
+
if (incrementalUpdate) {
|
|
1261
|
+
options.addDefaultPage = false;
|
|
1262
|
+
options.updateFieldAppearances = false;
|
|
1263
|
+
}
|
|
1264
|
+
return [4 /*yield*/, this.prepareForSave(options)];
|
|
1265
|
+
case 1:
|
|
1266
|
+
_d.sent();
|
|
1267
|
+
Writer = useObjectStreams ? core_1.PDFStreamWriter : core_1.PDFWriter;
|
|
1268
|
+
if (!incrementalUpdate) return [3 /*break*/, 3];
|
|
1269
|
+
return [4 /*yield*/, Writer.forContextWithSnapshot(this.context, objectsPerTick, this.context.snapshot).serializeToBuffer()];
|
|
1270
|
+
case 2:
|
|
1271
|
+
increment = _d.sent();
|
|
1272
|
+
result = new Uint8Array(this.context.pdfFileDetails.originalBytes.byteLength +
|
|
1273
|
+
increment.byteLength);
|
|
1274
|
+
result.set(this.context.pdfFileDetails.originalBytes);
|
|
1275
|
+
result.set(increment, this.context.pdfFileDetails.originalBytes.byteLength);
|
|
1276
|
+
return [2 /*return*/, result];
|
|
1277
|
+
case 3: return [2 /*return*/, Writer.forContext(this.context, objectsPerTick).serializeToBuffer()];
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
});
|
|
1281
|
+
};
|
|
1282
|
+
/**
|
|
1283
|
+
* Serialize only the changes to this document to an array of bytes making up a PDF file.
|
|
1284
|
+
* For example:
|
|
1285
|
+
* ```js
|
|
1286
|
+
* const snapshot = pdfDoc.takeSnapshot();
|
|
1287
|
+
* ...
|
|
1288
|
+
* const pdfBytes = await pdfDoc.saveIncremental(snapshot);
|
|
1289
|
+
* ```
|
|
1290
|
+
*
|
|
1291
|
+
* Similar to [[save]] function.
|
|
1292
|
+
* The changes are saved in an incremental way, the result buffer
|
|
1293
|
+
* will contain only the differences
|
|
1294
|
+
*
|
|
1295
|
+
* @param snapshot The snapshot to be used when saving the document.
|
|
1296
|
+
* @param options The options to be used when saving the document.
|
|
1297
|
+
* @returns Resolves with the bytes of the serialized document.
|
|
1298
|
+
*/
|
|
1299
|
+
PDFDocument.prototype.saveIncremental = function (snapshot, options) {
|
|
1300
|
+
if (options === void 0) { options = {}; }
|
|
1301
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1302
|
+
var _a, objectsPerTick, saveOptions, Writer;
|
|
1303
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1304
|
+
switch (_b.label) {
|
|
1305
|
+
case 0:
|
|
1306
|
+
_a = options.objectsPerTick, objectsPerTick = _a === void 0 ? 50 : _a;
|
|
1307
|
+
utils_1.assertIs(objectsPerTick, 'objectsPerTick', ['number']);
|
|
1308
|
+
saveOptions = tslib_1.__assign(tslib_1.__assign({}, options), { addDefaultPage: false, updateFieldAppearances: false });
|
|
1309
|
+
return [4 /*yield*/, this.prepareForSave(saveOptions)];
|
|
1310
|
+
case 1:
|
|
1311
|
+
_b.sent();
|
|
1312
|
+
Writer = this.context.pdfFileDetails.useObjectStreams
|
|
1313
|
+
? core_1.PDFStreamWriter
|
|
1314
|
+
: core_1.PDFWriter;
|
|
1315
|
+
return [2 /*return*/, Writer.forContextWithSnapshot(this.context, objectsPerTick, snapshot).serializeToBuffer()];
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
});
|
|
1319
|
+
};
|
|
1320
|
+
/**
|
|
1321
|
+
* Serialize this document to a base64 encoded string or data URI making up a
|
|
1322
|
+
* PDF file. For example:
|
|
1323
|
+
* ```js
|
|
1324
|
+
* const base64String = await pdfDoc.saveAsBase64()
|
|
1325
|
+
* base64String // => 'JVBERi0xLjcKJYGBgYEKC...'
|
|
1326
|
+
*
|
|
1327
|
+
* const base64DataUri = await pdfDoc.saveAsBase64({ dataUri: true })
|
|
1328
|
+
* base64DataUri // => 'data:application/pdf;base64,JVBERi0xLjcKJYGBgYEKC...'
|
|
1329
|
+
* ```
|
|
1330
|
+
*
|
|
1331
|
+
* @param options The options to be used when saving the document.
|
|
1332
|
+
* @returns Resolves with a base64 encoded string or data URI of the
|
|
1333
|
+
* serialized document.
|
|
1334
|
+
*/
|
|
1335
|
+
PDFDocument.prototype.saveAsBase64 = function (options) {
|
|
1336
|
+
if (options === void 0) { options = {}; }
|
|
1337
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1338
|
+
var _a, dataUri, otherOptions, bytes, base64;
|
|
1339
|
+
return tslib_1.__generator(this, function (_b) {
|
|
1340
|
+
switch (_b.label) {
|
|
1341
|
+
case 0:
|
|
1342
|
+
_a = options.dataUri, dataUri = _a === void 0 ? false : _a, otherOptions = tslib_1.__rest(options, ["dataUri"]);
|
|
1343
|
+
utils_1.assertIs(dataUri, 'dataUri', ['boolean']);
|
|
1344
|
+
return [4 /*yield*/, this.save(otherOptions)];
|
|
1345
|
+
case 1:
|
|
1346
|
+
bytes = _b.sent();
|
|
1347
|
+
base64 = utils_1.encodeToBase64(bytes);
|
|
1348
|
+
return [2 /*return*/, dataUri ? "data:application/pdf;base64," + base64 : base64];
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
PDFDocument.prototype.findPageForAnnotationRef = function (ref) {
|
|
1354
|
+
var pages = this.getPages();
|
|
1355
|
+
for (var idx = 0, len = pages.length; idx < len; idx++) {
|
|
1356
|
+
var page = pages[idx];
|
|
1357
|
+
var annotations = page.node.Annots();
|
|
1358
|
+
if ((annotations === null || annotations === void 0 ? void 0 : annotations.indexOf(ref)) !== undefined) {
|
|
1359
|
+
return page;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
return undefined;
|
|
1363
|
+
};
|
|
1364
|
+
PDFDocument.prototype.takeSnapshot = function () {
|
|
1365
|
+
var indirectObjects = [];
|
|
1366
|
+
var snapshot = new snapshot_1.IncrementalDocumentSnapshot(this.context.largestObjectNumber, indirectObjects, this.context.pdfFileDetails.pdfSize, this.context.pdfFileDetails.prevStartXRef, this.context);
|
|
1367
|
+
if (!this.context.snapshot && this.context.pdfFileDetails.originalBytes) {
|
|
1368
|
+
this.context.snapshot = snapshot;
|
|
1369
|
+
this.catalog.registerChange();
|
|
1370
|
+
}
|
|
1371
|
+
return snapshot;
|
|
1372
|
+
};
|
|
1373
|
+
PDFDocument.prototype.prepareForSave = function (options) {
|
|
1374
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1375
|
+
var _a, addDefaultPage, _b, updateFieldAppearances, form;
|
|
1376
|
+
return tslib_1.__generator(this, function (_c) {
|
|
1377
|
+
switch (_c.label) {
|
|
1378
|
+
case 0:
|
|
1379
|
+
_a = options.addDefaultPage, addDefaultPage = _a === void 0 ? true : _a, _b = options.updateFieldAppearances, updateFieldAppearances = _b === void 0 ? true : _b;
|
|
1380
|
+
utils_1.assertIs(addDefaultPage, 'addDefaultPage', ['boolean']);
|
|
1381
|
+
utils_1.assertIs(updateFieldAppearances, 'updateFieldAppearances', ['boolean']);
|
|
1382
|
+
if (addDefaultPage && this.getPageCount() === 0)
|
|
1383
|
+
this.addPage();
|
|
1384
|
+
if (updateFieldAppearances) {
|
|
1385
|
+
form = this.formCache.getValue();
|
|
1386
|
+
if (form)
|
|
1387
|
+
form.updateFieldAppearances();
|
|
1388
|
+
}
|
|
1389
|
+
return [4 /*yield*/, this.flush()];
|
|
1390
|
+
case 1:
|
|
1391
|
+
_c.sent();
|
|
1392
|
+
return [2 /*return*/];
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
});
|
|
1396
|
+
};
|
|
1397
|
+
PDFDocument.prototype.embedAll = function (embeddables) {
|
|
1398
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1399
|
+
var idx, len;
|
|
1400
|
+
return tslib_1.__generator(this, function (_a) {
|
|
1401
|
+
switch (_a.label) {
|
|
1402
|
+
case 0:
|
|
1403
|
+
idx = 0, len = embeddables.length;
|
|
1404
|
+
_a.label = 1;
|
|
1405
|
+
case 1:
|
|
1406
|
+
if (!(idx < len)) return [3 /*break*/, 4];
|
|
1407
|
+
return [4 /*yield*/, embeddables[idx].embed()];
|
|
1408
|
+
case 2:
|
|
1409
|
+
_a.sent();
|
|
1410
|
+
_a.label = 3;
|
|
1411
|
+
case 3:
|
|
1412
|
+
idx++;
|
|
1413
|
+
return [3 /*break*/, 1];
|
|
1414
|
+
case 4: return [2 /*return*/];
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
});
|
|
1418
|
+
};
|
|
1419
|
+
PDFDocument.prototype.updateInfoDict = function () {
|
|
1420
|
+
var pdfLib = "pdf-lib (https://github.com/Hopding/pdf-lib)";
|
|
1421
|
+
var now = new Date();
|
|
1422
|
+
var info = this.getInfoDict();
|
|
1423
|
+
this.setProducer(pdfLib);
|
|
1424
|
+
this.setModificationDate(now);
|
|
1425
|
+
if (!info.get(core_1.PDFName.of('Creator')))
|
|
1426
|
+
this.setCreator(pdfLib);
|
|
1427
|
+
if (!info.get(core_1.PDFName.of('CreationDate')))
|
|
1428
|
+
this.setCreationDate(now);
|
|
1429
|
+
};
|
|
1430
|
+
PDFDocument.prototype.getInfoDict = function () {
|
|
1431
|
+
var existingInfo = this.context.lookup(this.context.trailerInfo.Info);
|
|
1432
|
+
if (existingInfo instanceof core_1.PDFDict) {
|
|
1433
|
+
return existingInfo;
|
|
1434
|
+
}
|
|
1435
|
+
var newInfo = this.context.obj({});
|
|
1436
|
+
this.context.trailerInfo.Info = this.context.register(newInfo);
|
|
1437
|
+
return newInfo;
|
|
1438
|
+
};
|
|
1439
|
+
PDFDocument.prototype.assertFontkit = function () {
|
|
1440
|
+
if (!this.fontkit)
|
|
1441
|
+
throw new errors_1.FontkitNotRegisteredError();
|
|
1442
|
+
return this.fontkit;
|
|
1443
|
+
};
|
|
1444
|
+
return PDFDocument;
|
|
1445
|
+
}());
|
|
1446
|
+
exports.default = PDFDocument;
|
|
1447
|
+
/* tslint:disable-next-line only-arrow-functions */
|
|
1448
|
+
function assertIsLiteralOrHexString(pdfObject) {
|
|
1449
|
+
if (!(pdfObject instanceof core_1.PDFHexString) &&
|
|
1450
|
+
!(pdfObject instanceof core_1.PDFString)) {
|
|
1451
|
+
throw new core_1.UnexpectedObjectTypeError([core_1.PDFHexString, core_1.PDFString], pdfObject);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
//# sourceMappingURL=PDFDocument.js.map
|