pdf-lite 1.0.0 → 1.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docs.yaml +2 -0
- package/EXAMPLES.md +1 -4
- package/docs/README.md +127 -0
- package/docs/core/README.md +43 -0
- package/docs/core/decoder/README.md +11 -0
- package/docs/core/decoder/classes/PdfDecoder.md +362 -0
- package/docs/core/generators/README.md +14 -0
- package/docs/core/generators/functions/bytesToPdfObjects.md +26 -0
- package/docs/core/generators/functions/pdfDecoder.md +36 -0
- package/docs/core/generators/functions/pdfDecoderAsync.md +26 -0
- package/docs/core/generators/functions/stringToPdfObjects.md +25 -0
- package/docs/core/incremental-parser/README.md +13 -0
- package/docs/core/incremental-parser/classes/EofReachedError.md +55 -0
- package/docs/core/incremental-parser/classes/IncrementalParser.md +299 -0
- package/docs/core/incremental-parser/classes/NoMoreTokensError.md +55 -0
- package/docs/core/objects/pdf-array/README.md +11 -0
- package/docs/core/objects/pdf-array/classes/PdfArray.md +305 -0
- package/docs/core/objects/pdf-boolean/README.md +11 -0
- package/docs/core/objects/pdf-boolean/classes/PdfBoolean.md +265 -0
- package/docs/core/objects/pdf-comment/README.md +11 -0
- package/docs/core/objects/pdf-comment/classes/PdfComment.md +329 -0
- package/docs/core/objects/pdf-date/README.md +11 -0
- package/docs/core/objects/pdf-date/classes/PdfDate.md +317 -0
- package/docs/core/objects/pdf-dictionary/README.md +17 -0
- package/docs/core/objects/pdf-dictionary/classes/PdfDictionary.md +396 -0
- package/docs/core/objects/pdf-dictionary/type-aliases/PdfDictionaryEntries.md +9 -0
- package/docs/core/objects/pdf-dictionary/type-aliases/PdfDictionaryEntry.md +9 -0
- package/docs/core/objects/pdf-dictionary/type-aliases/PdfDictionaryMap.md +9 -0
- package/docs/core/objects/pdf-hexadecimal/README.md +11 -0
- package/docs/core/objects/pdf-hexadecimal/classes/PdfHexadecimal.md +320 -0
- package/docs/core/objects/pdf-indirect-object/README.md +11 -0
- package/docs/core/objects/pdf-indirect-object/classes/PdfIndirectObject.md +411 -0
- package/docs/core/objects/pdf-name/README.md +11 -0
- package/docs/core/objects/pdf-name/classes/PdfName.md +271 -0
- package/docs/core/objects/pdf-null/README.md +11 -0
- package/docs/core/objects/pdf-null/classes/PdfNull.md +259 -0
- package/docs/core/objects/pdf-number/README.md +12 -0
- package/docs/core/objects/pdf-number/classes/PdfByteOffsetNumber.md +369 -0
- package/docs/core/objects/pdf-number/classes/PdfNumber.md +345 -0
- package/docs/core/objects/pdf-object/README.md +11 -0
- package/docs/core/objects/pdf-object/classes/PdfObject.md +214 -0
- package/docs/core/objects/pdf-object-reference/README.md +11 -0
- package/docs/core/objects/pdf-object-reference/classes/PdfObjectReference.md +279 -0
- package/docs/core/objects/pdf-start-xref/README.md +11 -0
- package/docs/core/objects/pdf-start-xref/classes/PdfStartXRef.md +265 -0
- package/docs/core/objects/pdf-stream/README.md +23 -0
- package/docs/core/objects/pdf-stream/classes/PdfObjStream.md +699 -0
- package/docs/core/objects/pdf-stream/classes/PdfStream.md +570 -0
- package/docs/core/objects/pdf-stream/classes/PdfXRefStream.md +723 -0
- package/docs/core/objects/pdf-stream/classes/PdfXRefStreamCompressedEntry.md +51 -0
- package/docs/core/objects/pdf-stream/type-aliases/PdfXRefStreamEntry.md +9 -0
- package/docs/core/objects/pdf-stream/type-aliases/PdfXRefStreamStandardEntry.md +9 -0
- package/docs/core/objects/pdf-stream/variables/PdfXRefStreamStandardEntry.md +9 -0
- package/docs/core/objects/pdf-string/README.md +11 -0
- package/docs/core/objects/pdf-string/classes/PdfString.md +301 -0
- package/docs/core/objects/pdf-trailer/README.md +16 -0
- package/docs/core/objects/pdf-trailer/classes/PdfTrailer.md +271 -0
- package/docs/core/objects/pdf-trailer/type-aliases/PdfTrailerDictionary.md +9 -0
- package/docs/core/objects/pdf-trailer/type-aliases/PdfTrailerEntries.md +51 -0
- package/docs/core/objects/pdf-xref-table/README.md +13 -0
- package/docs/core/objects/pdf-xref-table/classes/PdfXRefTable.md +331 -0
- package/docs/core/objects/pdf-xref-table/classes/PdfXRefTableEntry.md +297 -0
- package/docs/core/objects/pdf-xref-table/classes/PdfXRefTableSectionHeader.md +277 -0
- package/docs/core/parser/README.md +11 -0
- package/docs/core/parser/classes/Parser.md +74 -0
- package/docs/core/ref/README.md +15 -0
- package/docs/core/ref/classes/Ref.md +149 -0
- package/docs/core/ref/type-aliases/RefUpdateCallback.md +33 -0
- package/docs/core/serializer/README.md +11 -0
- package/docs/core/serializer/classes/PdfTokenSerializer.md +106 -0
- package/docs/core/streams/object-stream/README.md +11 -0
- package/docs/core/streams/object-stream/classes/PdfObjectStream.md +69 -0
- package/docs/core/tokeniser/README.md +21 -0
- package/docs/core/tokeniser/classes/PdfByteStreamTokeniser.md +366 -0
- package/docs/core/tokeniser/classes/PdfObjectTokeniser.md +69 -0
- package/docs/core/tokeniser/functions/objectToTokens.md +25 -0
- package/docs/core/tokeniser/functions/pdfObjectStreamTokeniser.md +27 -0
- package/docs/core/tokeniser/type-aliases/PdfTokeniser.md +11 -0
- package/docs/core/tokens/boolean-token/README.md +11 -0
- package/docs/core/tokens/boolean-token/classes/PdfBooleanToken.md +139 -0
- package/docs/core/tokens/byte-offset-token/README.md +11 -0
- package/docs/core/tokens/byte-offset-token/classes/PdfByteOffsetToken.md +153 -0
- package/docs/core/tokens/comment-token/README.md +11 -0
- package/docs/core/tokens/comment-token/classes/PdfCommentToken.md +161 -0
- package/docs/core/tokens/end-array-token/README.md +11 -0
- package/docs/core/tokens/end-array-token/classes/PdfEndArrayToken.md +115 -0
- package/docs/core/tokens/end-dictionary-token/README.md +11 -0
- package/docs/core/tokens/end-dictionary-token/classes/PdfEndDictionaryToken.md +115 -0
- package/docs/core/tokens/end-object-token/README.md +11 -0
- package/docs/core/tokens/end-object-token/classes/PdfEndObjectToken.md +115 -0
- package/docs/core/tokens/end-stream-token/README.md +11 -0
- package/docs/core/tokens/end-stream-token/classes/PdfEndStreamToken.md +121 -0
- package/docs/core/tokens/hexadecimal-token/README.md +11 -0
- package/docs/core/tokens/hexadecimal-token/classes/PdfHexadecimalToken.md +127 -0
- package/docs/core/tokens/name-token/README.md +11 -0
- package/docs/core/tokens/name-token/classes/PdfNameToken.md +127 -0
- package/docs/core/tokens/null-token/README.md +11 -0
- package/docs/core/tokens/null-token/classes/PdfNullToken.md +115 -0
- package/docs/core/tokens/number-token/README.md +11 -0
- package/docs/core/tokens/number-token/classes/PdfNumberToken.md +271 -0
- package/docs/core/tokens/object-reference-token/README.md +11 -0
- package/docs/core/tokens/object-reference-token/classes/PdfObjectReferenceToken.md +137 -0
- package/docs/core/tokens/start-array-token/README.md +11 -0
- package/docs/core/tokens/start-array-token/classes/PdfStartArrayToken.md +115 -0
- package/docs/core/tokens/start-dictionary-token/README.md +11 -0
- package/docs/core/tokens/start-dictionary-token/classes/PdfStartDictionaryToken.md +115 -0
- package/docs/core/tokens/start-object-token/README.md +11 -0
- package/docs/core/tokens/start-object-token/classes/PdfStartObjectToken.md +147 -0
- package/docs/core/tokens/start-stream-token/README.md +11 -0
- package/docs/core/tokens/start-stream-token/classes/PdfStartStreamToken.md +147 -0
- package/docs/core/tokens/start-xref-token/README.md +11 -0
- package/docs/core/tokens/start-xref-token/classes/PdfStartXRefToken.md +115 -0
- package/docs/core/tokens/stream-chunk-token/README.md +11 -0
- package/docs/core/tokens/stream-chunk-token/classes/PdfStreamChunkToken.md +121 -0
- package/docs/core/tokens/string-token/README.md +11 -0
- package/docs/core/tokens/string-token/classes/PdfStringToken.md +127 -0
- package/docs/core/tokens/token/README.md +11 -0
- package/docs/core/tokens/token/classes/PdfToken.md +116 -0
- package/docs/core/tokens/trailer-token/README.md +11 -0
- package/docs/core/tokens/trailer-token/classes/PdfTrailerToken.md +127 -0
- package/docs/core/tokens/whitespace-token/README.md +11 -0
- package/docs/core/tokens/whitespace-token/classes/PdfWhitespaceToken.md +161 -0
- package/docs/core/tokens/xref-table-entry-token/README.md +11 -0
- package/docs/core/tokens/xref-table-entry-token/classes/PdfXRefTableEntryToken.md +157 -0
- package/docs/core/tokens/xref-table-section-start-token/README.md +11 -0
- package/docs/core/tokens/xref-table-section-start-token/classes/PdfXRefTableSectionStartToken.md +137 -0
- package/docs/core/tokens/xref-table-start-token/README.md +11 -0
- package/docs/core/tokens/xref-table-start-token/classes/PdfXRefTableStartToken.md +127 -0
- package/docs/crypto/ciphers/aes128/README.md +11 -0
- package/docs/crypto/ciphers/aes128/functions/aes128.md +39 -0
- package/docs/crypto/ciphers/aes256/README.md +11 -0
- package/docs/crypto/ciphers/aes256/functions/aes256.md +35 -0
- package/docs/crypto/ciphers/rc4/README.md +11 -0
- package/docs/crypto/ciphers/rc4/functions/rc4.md +35 -0
- package/docs/crypto/constants/README.md +11 -0
- package/docs/crypto/constants/variables/DEFAULT_PADDING.md +13 -0
- package/docs/crypto/key-derivation/key-derivation/README.md +13 -0
- package/docs/crypto/key-derivation/key-derivation/functions/computeMasterKey.md +57 -0
- package/docs/crypto/key-derivation/key-derivation/functions/deriveObjectKey.md +50 -0
- package/docs/crypto/key-derivation/key-derivation/functions/padPassword.md +33 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/README.md +13 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/functions/computeAlgorithm2bHash.md +45 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/functions/getFileKey.md +66 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/functions/validatePasswordHash.md +52 -0
- package/docs/crypto/key-gen/key-gen-aes256/README.md +12 -0
- package/docs/crypto/key-gen/key-gen-aes256/functions/generateOandOe.md +44 -0
- package/docs/crypto/key-gen/key-gen-aes256/functions/generateUandUe.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/README.md +13 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/functions/computeOValueRc4_128.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/functions/computeUValueRc4_128.md +62 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/functions/decryptUserPasswordRc4_128.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/README.md +14 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/computeEncryptionKeyRc4_40.md +49 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/computeORc4_40.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/computeURc4_40.md +50 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/decryptUserPasswordRc4_40.md +38 -0
- package/docs/crypto/types/README.md +11 -0
- package/docs/crypto/types/interfaces/Cipher.md +39 -0
- package/docs/crypto/utils/README.md +13 -0
- package/docs/crypto/utils/functions/int32ToLittleEndianBytes.md +31 -0
- package/docs/crypto/utils/functions/padPassword.md +33 -0
- package/docs/crypto/utils/functions/removePdfPasswordPadding.md +32 -0
- package/docs/filters/ascii85/README.md +11 -0
- package/docs/filters/ascii85/functions/ascii85.md +27 -0
- package/docs/filters/asciihex/README.md +11 -0
- package/docs/filters/asciihex/functions/asciiHex.md +27 -0
- package/docs/filters/flate/README.md +11 -0
- package/docs/filters/flate/functions/flate.md +26 -0
- package/docs/filters/lzw/README.md +11 -0
- package/docs/filters/lzw/functions/lzw.md +27 -0
- package/docs/filters/pass-through/README.md +11 -0
- package/docs/filters/pass-through/functions/passthroughFilter.md +25 -0
- package/docs/filters/runlength/README.md +11 -0
- package/docs/filters/runlength/functions/runLength.md +27 -0
- package/docs/filters/types/README.md +19 -0
- package/docs/filters/types/interfaces/PdfFilter.md +39 -0
- package/docs/filters/types/type-aliases/PdfStreamFilterType.md +9 -0
- package/docs/filters/types/variables/PDF_FILTER_TYPES.md +51 -0
- package/docs/index/README.md +235 -0
- package/docs/pdf/README.md +31 -0
- package/docs/pdf/errors/README.md +11 -0
- package/docs/pdf/errors/classes/FoundCompressedObjectError.md +56 -0
- package/docs/pdf/pdf-document/README.md +11 -0
- package/docs/pdf/pdf-document/classes/PdfDocument.md +876 -0
- package/docs/pdf/pdf-reader/README.md +11 -0
- package/docs/pdf/pdf-reader/classes/PdfReader.md +82 -0
- package/docs/pdf/pdf-revision/README.md +11 -0
- package/docs/pdf/pdf-revision/classes/PdfRevision.md +508 -0
- package/docs/pdf/pdf-xref-lookup/README.md +11 -0
- package/docs/pdf/pdf-xref-lookup/classes/PdfXrefLookup.md +421 -0
- package/docs/security/crypt-filters/aesv2/README.md +11 -0
- package/docs/security/crypt-filters/aesv2/classes/AesV2CryptFilter.md +274 -0
- package/docs/security/crypt-filters/aesv3/README.md +11 -0
- package/docs/security/crypt-filters/aesv3/classes/AesV3CryptFilter.md +275 -0
- package/docs/security/crypt-filters/base/README.md +15 -0
- package/docs/security/crypt-filters/base/classes/PdfCryptFilter.md +221 -0
- package/docs/security/crypt-filters/base/type-aliases/CryptFilterOptions.md +43 -0
- package/docs/security/crypt-filters/identity/README.md +11 -0
- package/docs/security/crypt-filters/identity/classes/IdentityCryptFilter.md +249 -0
- package/docs/security/crypt-filters/v2/README.md +11 -0
- package/docs/security/crypt-filters/v2/classes/V2CryptFilter.md +279 -0
- package/docs/security/handlers/base/README.md +17 -0
- package/docs/security/handlers/base/classes/PdfSecurityHandler.md +384 -0
- package/docs/security/handlers/base/classes/PdfStandardSecurityHandler.md +694 -0
- package/docs/security/handlers/base/type-aliases/PdfSecurityHandlerOptions.md +27 -0
- package/docs/security/handlers/base/type-aliases/PdfStandardSecurityHandlerOptions.md +43 -0
- package/docs/security/handlers/pubSec/README.md +11 -0
- package/docs/security/handlers/pubSec/classes/PdfPublicKeySecurityHandler.md +503 -0
- package/docs/security/handlers/utils/README.md +14 -0
- package/docs/security/handlers/utils/functions/createFromDictionary.md +56 -0
- package/docs/security/handlers/utils/functions/createFromEncryptionOptions.md +40 -0
- package/docs/security/handlers/utils/functions/createStandardSecurityHandlerFromDictionary.md +55 -0
- package/docs/security/handlers/utils/functions/getCryptFilter.md +35 -0
- package/docs/security/handlers/v1/README.md +11 -0
- package/docs/security/handlers/v1/classes/PdfV1SecurityHandler.md +779 -0
- package/docs/security/handlers/v2/README.md +11 -0
- package/docs/security/handlers/v2/classes/PdfV2SecurityHandler.md +783 -0
- package/docs/security/handlers/v4/README.md +11 -0
- package/docs/security/handlers/v4/classes/PdfV4SecurityHandler.md +907 -0
- package/docs/security/handlers/v5/README.md +11 -0
- package/docs/security/handlers/v5/classes/PdfV5SecurityHandler.md +926 -0
- package/docs/security/types/README.md +19 -0
- package/docs/security/types/type-aliases/CryptFilterType.md +15 -0
- package/docs/security/types/type-aliases/PdfCryptFilterDictionary.md +12 -0
- package/docs/security/types/type-aliases/PdfEncryptionAlgorithmOptions.md +11 -0
- package/docs/security/types/type-aliases/PdfEncryptionAlgorithmType.md +17 -0
- package/docs/security/types/type-aliases/PdfEncryptionDictionary.md +13 -0
- package/docs/security/types/type-aliases/PdfEncryptionDictionaryObject.md +11 -0
- package/docs/security/types/type-aliases/PdfEncryptionOptions.md +90 -0
- package/docs/security/types/type-aliases/PdfEncryptionRecipient.md +24 -0
- package/docs/security/types/type-aliases/PdfId.md +13 -0
- package/docs/signing/README.md +127 -0
- package/docs/signing/document-security-store/README.md +19 -0
- package/docs/signing/document-security-store/classes/PdfCertObject.md +443 -0
- package/docs/signing/document-security-store/classes/PdfCrlObject.md +443 -0
- package/docs/signing/document-security-store/classes/PdfDocumentSecurityStoreDictionary.md +416 -0
- package/docs/signing/document-security-store/classes/PdfDocumentSecurityStoreObject.md +563 -0
- package/docs/signing/document-security-store/classes/PdfOcspObject.md +443 -0
- package/docs/signing/document-security-store/type-aliases/PdfVriObject.md +12 -0
- package/docs/signing/signatures/README.md +55 -0
- package/docs/signing/signatures/adbe-pkcs7-detached/README.md +11 -0
- package/docs/signing/signatures/adbe-pkcs7-detached/classes/PdfAdbePkcs7DetachedSignatureObject.md +669 -0
- package/docs/signing/signatures/adbe-pkcs7-sha1/README.md +11 -0
- package/docs/signing/signatures/adbe-pkcs7-sha1/classes/PdfAdbePkcs7Sha1SignatureObject.md +667 -0
- package/docs/signing/signatures/adbe-x509-rsa-sha1/README.md +11 -0
- package/docs/signing/signatures/adbe-x509-rsa-sha1/classes/PdfAdbePkcsX509RsaSha1SignatureObject.md +651 -0
- package/docs/signing/signatures/base/README.md +16 -0
- package/docs/signing/signatures/base/classes/PdfSignatureDictionary.md +420 -0
- package/docs/signing/signatures/base/classes/PdfSignatureObject.md +584 -0
- package/docs/signing/signatures/base/type-aliases/PdfSignatureSignOptions.md +51 -0
- package/docs/signing/signatures/etsi-cades-detached/README.md +11 -0
- package/docs/signing/signatures/etsi-cades-detached/classes/PdfEtsiCadesDetachedSignatureObject.md +693 -0
- package/docs/signing/signatures/etsi-rfc3161/README.md +11 -0
- package/docs/signing/signatures/etsi-rfc3161/classes/PdfEtsiRfc3161SignatureObject.md +614 -0
- package/docs/signing/signer/README.md +11 -0
- package/docs/signing/signer/classes/PdfSigner.md +58 -0
- package/docs/signing/types/README.md +16 -0
- package/docs/signing/types/type-aliases/PdfSignatureDictionaryEntries.md +95 -0
- package/docs/signing/types/type-aliases/PdfSignatureSubType.md +17 -0
- package/docs/signing/types/type-aliases/PdfSignatureType.md +14 -0
- package/docs/signing/types/type-aliases/RevocationInfo.md +43 -0
- package/docs/signing/types/type-aliases/SignaturePolicyDocument.md +35 -0
- package/docs/signing/types/type-aliases/TimeStampAuthority.md +35 -0
- package/docs/signing/utils/README.md +11 -0
- package/docs/signing/utils/functions/fetchRevocationInfo.md +70 -0
- package/docs/types/README.md +21 -0
- package/docs/types/type-aliases/ByteArray.md +9 -0
- package/docs/types/type-aliases/ChangeType.md +9 -0
- package/docs/types/type-aliases/DecodeParms.md +33 -0
- package/docs/types/type-aliases/HashAlgorithm.md +9 -0
- package/docs/types/type-aliases/PdfEncryptionAlgorithm.md +9 -0
- package/docs/types/type-aliases/PdfPermissions.md +63 -0
- package/docs/types/type-aliases/PdfVersion.md +9 -0
- package/docs/types/variables/PERMISSION_FLAGS.md +9 -0
- package/docs/utils/IterableReadableStream/README.md +11 -0
- package/docs/utils/IterableReadableStream/classes/IterableReadableStream.md +103 -0
- package/docs/utils/algos/README.md +28 -0
- package/docs/utils/algos/functions/aes128CbcNoPaddingEncrypt.md +43 -0
- package/docs/utils/algos/functions/aes128cbcDecrypt.md +47 -0
- package/docs/utils/algos/functions/aes128cbcEncrypt.md +47 -0
- package/docs/utils/algos/functions/aes256CbcNoPaddingDecrypt.md +43 -0
- package/docs/utils/algos/functions/aes256CbcNoPaddingEncrypt.md +43 -0
- package/docs/utils/algos/functions/aes256cbcDecrypt.md +43 -0
- package/docs/utils/algos/functions/aes256cbcEncrypt.md +43 -0
- package/docs/utils/algos/functions/aes256ecbDecrypt.md +41 -0
- package/docs/utils/algos/functions/aes256ecbEncrypt.md +41 -0
- package/docs/utils/algos/functions/deflateData.md +31 -0
- package/docs/utils/algos/functions/getRandomBytes.md +35 -0
- package/docs/utils/algos/functions/hash.md +41 -0
- package/docs/utils/algos/functions/inflateData.md +35 -0
- package/docs/utils/algos/functions/md5.md +31 -0
- package/docs/utils/algos/functions/sha1.md +31 -0
- package/docs/utils/algos/functions/sha256.md +31 -0
- package/docs/utils/algos/functions/sha384.md +31 -0
- package/docs/utils/algos/functions/sha512.md +31 -0
- package/docs/utils/assert/README.md +12 -0
- package/docs/utils/assert/functions/assert.md +39 -0
- package/docs/utils/assert/functions/assertIfDefined.md +46 -0
- package/docs/utils/bytesToHex/README.md +11 -0
- package/docs/utils/bytesToHex/functions/bytesToHex.md +31 -0
- package/docs/utils/bytesToHexBytes/README.md +11 -0
- package/docs/utils/bytesToHexBytes/functions/bytesToHexBytes.md +32 -0
- package/docs/utils/bytesToString/README.md +11 -0
- package/docs/utils/bytesToString/functions/bytesToString.md +31 -0
- package/docs/utils/concatUint8Arrays/README.md +11 -0
- package/docs/utils/concatUint8Arrays/functions/concatUint8Arrays.md +31 -0
- package/docs/utils/escapeString/README.md +11 -0
- package/docs/utils/escapeString/functions/escapeString.md +32 -0
- package/docs/utils/hexBytesToBytes/README.md +11 -0
- package/docs/utils/hexBytesToBytes/functions/hexBytesToBytes.md +33 -0
- package/docs/utils/hexBytesToString/README.md +11 -0
- package/docs/utils/hexBytesToString/functions/hexBytesToString.md +31 -0
- package/docs/utils/hexToBytes/README.md +11 -0
- package/docs/utils/hexToBytes/functions/hexToBytes.md +31 -0
- package/docs/utils/padBytes/README.md +11 -0
- package/docs/utils/padBytes/functions/padBytes.md +41 -0
- package/docs/utils/predictors/README.md +11 -0
- package/docs/utils/predictors/classes/Predictor.md +306 -0
- package/docs/utils/replaceInBuffer/README.md +11 -0
- package/docs/utils/replaceInBuffer/functions/replaceInBuffer.md +65 -0
- package/docs/utils/stringToBytes/README.md +11 -0
- package/docs/utils/stringToBytes/functions/stringToBytes.md +32 -0
- package/docs/utils/stringToHexBytes/README.md +11 -0
- package/docs/utils/stringToHexBytes/functions/stringToHexBytes.md +33 -0
- package/docs/utils/unescapeString/README.md +11 -0
- package/docs/utils/unescapeString/functions/unescapeString.md +34 -0
- package/package.json +63 -71
- package/packages/pdf-lite/node_modules/.bin/playwright +16 -0
- package/packages/pdf-lite/node_modules/.bin/tsc +16 -0
- package/packages/pdf-lite/node_modules/.bin/tsserver +16 -0
- package/packages/pdf-lite/node_modules/.bin/vitest +16 -0
- package/packages/pdf-lite/package.json +2 -2
- package/packages/pdf-lite/scripts/create-encryption-tests.sh +0 -0
- package/packages/pdf-lite/scripts/gen-signing-keys.sh +0 -0
- package/packages/pdf-lite/scripts/generate-all-signing-keys.sh +0 -0
- package/scripts/bump-version.sh +0 -0
- package/scripts/gen-html-docs.sh +0 -0
- package/scripts/gen-md-docs.sh +0 -0
- package/scripts/prepare-release.sh +0 -0
|
@@ -0,0 +1,876 @@
|
|
|
1
|
+
[**pdf-lite**](../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../README.md) / [pdf/pdf-document](../README.md) / PdfDocument
|
|
6
|
+
|
|
7
|
+
# Class: PdfDocument
|
|
8
|
+
|
|
9
|
+
Represents a PDF document with support for reading, writing, and modifying PDF files.
|
|
10
|
+
Handles document structure, revisions, encryption, and digital signatures.
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
// Create a new document
|
|
16
|
+
const document = new PdfDocument()
|
|
17
|
+
|
|
18
|
+
// Read from bytes
|
|
19
|
+
const document = await PdfDocument.fromBytes(fileBytes)
|
|
20
|
+
|
|
21
|
+
// Add objects and commit
|
|
22
|
+
document.add(pdfObject)
|
|
23
|
+
await document.commit()
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Extends
|
|
27
|
+
|
|
28
|
+
- [`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)
|
|
29
|
+
|
|
30
|
+
## Constructors
|
|
31
|
+
|
|
32
|
+
### Constructor
|
|
33
|
+
|
|
34
|
+
> **new PdfDocument**(`options?`): `PdfDocument`
|
|
35
|
+
|
|
36
|
+
Creates a new PDF document instance.
|
|
37
|
+
|
|
38
|
+
#### Parameters
|
|
39
|
+
|
|
40
|
+
##### options?
|
|
41
|
+
|
|
42
|
+
Configuration options for the document
|
|
43
|
+
|
|
44
|
+
###### ownerPassword?
|
|
45
|
+
|
|
46
|
+
`string`
|
|
47
|
+
|
|
48
|
+
Owner password for encryption
|
|
49
|
+
|
|
50
|
+
###### password?
|
|
51
|
+
|
|
52
|
+
`string`
|
|
53
|
+
|
|
54
|
+
User password for encryption
|
|
55
|
+
|
|
56
|
+
###### revisions?
|
|
57
|
+
|
|
58
|
+
[`PdfRevision`](../../pdf-revision/classes/PdfRevision.md)[]
|
|
59
|
+
|
|
60
|
+
Pre-existing revisions for the document
|
|
61
|
+
|
|
62
|
+
###### securityHandler?
|
|
63
|
+
|
|
64
|
+
[`PdfSecurityHandler`](../../../security/handlers/base/classes/PdfSecurityHandler.md)
|
|
65
|
+
|
|
66
|
+
Custom security handler for encryption
|
|
67
|
+
|
|
68
|
+
###### signer?
|
|
69
|
+
|
|
70
|
+
[`PdfSigner`](../../../signing/signer/classes/PdfSigner.md)
|
|
71
|
+
|
|
72
|
+
Custom signer for digital signatures
|
|
73
|
+
|
|
74
|
+
###### version?
|
|
75
|
+
|
|
76
|
+
`string` \| [`PdfComment`](../../../core/objects/pdf-comment/classes/PdfComment.md)
|
|
77
|
+
|
|
78
|
+
PDF version string (e.g., '1.7', '2.0') or version comment
|
|
79
|
+
|
|
80
|
+
#### Returns
|
|
81
|
+
|
|
82
|
+
`PdfDocument`
|
|
83
|
+
|
|
84
|
+
#### Overrides
|
|
85
|
+
|
|
86
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`constructor`](../../../core/objects/pdf-object/classes/PdfObject.md#constructor)
|
|
87
|
+
|
|
88
|
+
## Properties
|
|
89
|
+
|
|
90
|
+
### header
|
|
91
|
+
|
|
92
|
+
> **header**: [`PdfComment`](../../../core/objects/pdf-comment/classes/PdfComment.md)
|
|
93
|
+
|
|
94
|
+
PDF version comment header
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### modified
|
|
99
|
+
|
|
100
|
+
> `protected` **modified**: `boolean` = `true`
|
|
101
|
+
|
|
102
|
+
Indicates whether the object has been modified. By default, assume it has been modified because it's a new object
|
|
103
|
+
|
|
104
|
+
#### Inherited from
|
|
105
|
+
|
|
106
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`modified`](../../../core/objects/pdf-object/classes/PdfObject.md#modified)
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### postTokens?
|
|
111
|
+
|
|
112
|
+
> `optional` **postTokens**: [`PdfToken`](../../../core/tokens/token/classes/PdfToken.md)[]
|
|
113
|
+
|
|
114
|
+
Optional tokens to prepend or append during serialization
|
|
115
|
+
|
|
116
|
+
#### Inherited from
|
|
117
|
+
|
|
118
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`postTokens`](../../../core/objects/pdf-object/classes/PdfObject.md#posttokens)
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### preTokens?
|
|
123
|
+
|
|
124
|
+
> `optional` **preTokens**: [`PdfToken`](../../../core/tokens/token/classes/PdfToken.md)[]
|
|
125
|
+
|
|
126
|
+
Optional tokens to prepend or append during serialization
|
|
127
|
+
|
|
128
|
+
#### Inherited from
|
|
129
|
+
|
|
130
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`preTokens`](../../../core/objects/pdf-object/classes/PdfObject.md#pretokens)
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### revisions
|
|
135
|
+
|
|
136
|
+
> **revisions**: [`PdfRevision`](../../pdf-revision/classes/PdfRevision.md)[]
|
|
137
|
+
|
|
138
|
+
List of document revisions for incremental updates
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### securityHandler?
|
|
143
|
+
|
|
144
|
+
> `optional` **securityHandler**: [`PdfSecurityHandler`](../../../security/handlers/base/classes/PdfSecurityHandler.md)
|
|
145
|
+
|
|
146
|
+
Security handler for encryption/decryption operations
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### signer
|
|
151
|
+
|
|
152
|
+
> **signer**: [`PdfSigner`](../../../signing/signer/classes/PdfSigner.md)
|
|
153
|
+
|
|
154
|
+
Signer instance for digital signature operations
|
|
155
|
+
|
|
156
|
+
## Accessors
|
|
157
|
+
|
|
158
|
+
### encryptionDictionary
|
|
159
|
+
|
|
160
|
+
#### Get Signature
|
|
161
|
+
|
|
162
|
+
> **get** **encryptionDictionary**(): [`PdfEncryptionDictionaryObject`](../../../security/types/type-aliases/PdfEncryptionDictionaryObject.md) \| `undefined`
|
|
163
|
+
|
|
164
|
+
Gets the encryption dictionary from the document if present.
|
|
165
|
+
|
|
166
|
+
##### Throws
|
|
167
|
+
|
|
168
|
+
Error if the encryption dictionary reference points to a non-dictionary object
|
|
169
|
+
|
|
170
|
+
##### Returns
|
|
171
|
+
|
|
172
|
+
[`PdfEncryptionDictionaryObject`](../../../security/types/type-aliases/PdfEncryptionDictionaryObject.md) \| `undefined`
|
|
173
|
+
|
|
174
|
+
The encryption dictionary object or undefined if not encrypted
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### latestRevision
|
|
179
|
+
|
|
180
|
+
#### Get Signature
|
|
181
|
+
|
|
182
|
+
> **get** **latestRevision**(): [`PdfRevision`](../../pdf-revision/classes/PdfRevision.md)
|
|
183
|
+
|
|
184
|
+
Gets the latest (most recent) revision of the document.
|
|
185
|
+
|
|
186
|
+
##### Throws
|
|
187
|
+
|
|
188
|
+
Error if the revision for the last StartXRef cannot be found
|
|
189
|
+
|
|
190
|
+
##### Returns
|
|
191
|
+
|
|
192
|
+
[`PdfRevision`](../../pdf-revision/classes/PdfRevision.md)
|
|
193
|
+
|
|
194
|
+
The latest PdfRevision
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### metadataStreamReference
|
|
199
|
+
|
|
200
|
+
#### Get Signature
|
|
201
|
+
|
|
202
|
+
> **get** **metadataStreamReference**(): [`PdfObjectReference`](../../../core/objects/pdf-object-reference/classes/PdfObjectReference.md) \| `undefined`
|
|
203
|
+
|
|
204
|
+
Gets the reference to the metadata stream from the document catalog.
|
|
205
|
+
|
|
206
|
+
##### Returns
|
|
207
|
+
|
|
208
|
+
[`PdfObjectReference`](../../../core/objects/pdf-object-reference/classes/PdfObjectReference.md) \| `undefined`
|
|
209
|
+
|
|
210
|
+
The metadata stream reference or undefined if not present
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### objects
|
|
215
|
+
|
|
216
|
+
#### Get Signature
|
|
217
|
+
|
|
218
|
+
> **get** **objects**(): readonly [`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)[]
|
|
219
|
+
|
|
220
|
+
Gets all objects across all revisions in the document.
|
|
221
|
+
|
|
222
|
+
##### Returns
|
|
223
|
+
|
|
224
|
+
readonly [`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)[]
|
|
225
|
+
|
|
226
|
+
A readonly array of all PDF objects
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### objectType
|
|
231
|
+
|
|
232
|
+
#### Get Signature
|
|
233
|
+
|
|
234
|
+
> **get** **objectType**(): `string`
|
|
235
|
+
|
|
236
|
+
The type of this PDF object
|
|
237
|
+
|
|
238
|
+
##### Returns
|
|
239
|
+
|
|
240
|
+
`string`
|
|
241
|
+
|
|
242
|
+
#### Inherited from
|
|
243
|
+
|
|
244
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`objectType`](../../../core/objects/pdf-object/classes/PdfObject.md#objecttype)
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### rootDictionary
|
|
249
|
+
|
|
250
|
+
#### Get Signature
|
|
251
|
+
|
|
252
|
+
> **get** **rootDictionary**(): [`PdfDictionary`](../../../core/objects/pdf-dictionary/classes/PdfDictionary.md)\<[`PdfDictionaryEntries`](../../../core/objects/pdf-dictionary/type-aliases/PdfDictionaryEntries.md)\> \| `undefined`
|
|
253
|
+
|
|
254
|
+
Gets the document catalog (root) dictionary.
|
|
255
|
+
|
|
256
|
+
##### Throws
|
|
257
|
+
|
|
258
|
+
Error if the Root reference points to a non-dictionary object
|
|
259
|
+
|
|
260
|
+
##### Returns
|
|
261
|
+
|
|
262
|
+
[`PdfDictionary`](../../../core/objects/pdf-dictionary/classes/PdfDictionary.md)\<[`PdfDictionaryEntries`](../../../core/objects/pdf-dictionary/type-aliases/PdfDictionaryEntries.md)\> \| `undefined`
|
|
263
|
+
|
|
264
|
+
The root dictionary or undefined if not found
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### trailerDict
|
|
269
|
+
|
|
270
|
+
#### Get Signature
|
|
271
|
+
|
|
272
|
+
> **get** **trailerDict**(): [`PdfDictionary`](../../../core/objects/pdf-dictionary/classes/PdfDictionary.md)\<[`PdfTrailerEntries`](../../../core/objects/pdf-trailer/type-aliases/PdfTrailerEntries.md)\>
|
|
273
|
+
|
|
274
|
+
Gets the trailer dictionary from the cross-reference lookup.
|
|
275
|
+
|
|
276
|
+
##### Returns
|
|
277
|
+
|
|
278
|
+
[`PdfDictionary`](../../../core/objects/pdf-dictionary/classes/PdfDictionary.md)\<[`PdfTrailerEntries`](../../../core/objects/pdf-trailer/type-aliases/PdfTrailerEntries.md)\>
|
|
279
|
+
|
|
280
|
+
The trailer dictionary containing document metadata references
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### xrefLookup
|
|
285
|
+
|
|
286
|
+
#### Get Signature
|
|
287
|
+
|
|
288
|
+
> **get** **xrefLookup**(): [`PdfXrefLookup`](../../pdf-xref-lookup/classes/PdfXrefLookup.md)
|
|
289
|
+
|
|
290
|
+
Gets the cross-reference lookup table for the latest revision.
|
|
291
|
+
|
|
292
|
+
##### Returns
|
|
293
|
+
|
|
294
|
+
[`PdfXrefLookup`](../../pdf-xref-lookup/classes/PdfXrefLookup.md)
|
|
295
|
+
|
|
296
|
+
The PdfXrefLookup for the latest revision
|
|
297
|
+
|
|
298
|
+
## Methods
|
|
299
|
+
|
|
300
|
+
### add()
|
|
301
|
+
|
|
302
|
+
> **add**(...`objects`): `void`
|
|
303
|
+
|
|
304
|
+
Adds objects to the document's latest revision.
|
|
305
|
+
Automatically starts a new revision if the current one is locked.
|
|
306
|
+
|
|
307
|
+
#### Parameters
|
|
308
|
+
|
|
309
|
+
##### objects
|
|
310
|
+
|
|
311
|
+
...[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)[]
|
|
312
|
+
|
|
313
|
+
PDF objects to add to the document
|
|
314
|
+
|
|
315
|
+
#### Returns
|
|
316
|
+
|
|
317
|
+
`void`
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### as()
|
|
322
|
+
|
|
323
|
+
> **as**\<`T`\>(`ctor`): `T`
|
|
324
|
+
|
|
325
|
+
Attempts to cast the object to a specific PdfObject subclass
|
|
326
|
+
|
|
327
|
+
#### Type Parameters
|
|
328
|
+
|
|
329
|
+
##### T
|
|
330
|
+
|
|
331
|
+
`T` _extends_ [`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)
|
|
332
|
+
|
|
333
|
+
#### Parameters
|
|
334
|
+
|
|
335
|
+
##### ctor
|
|
336
|
+
|
|
337
|
+
(...`args`) => `T`
|
|
338
|
+
|
|
339
|
+
#### Returns
|
|
340
|
+
|
|
341
|
+
`T`
|
|
342
|
+
|
|
343
|
+
#### Inherited from
|
|
344
|
+
|
|
345
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`as`](../../../core/objects/pdf-object/classes/PdfObject.md#as)
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### clone()
|
|
350
|
+
|
|
351
|
+
> **clone**(): `this`
|
|
352
|
+
|
|
353
|
+
Creates a deep copy of the document.
|
|
354
|
+
|
|
355
|
+
#### Returns
|
|
356
|
+
|
|
357
|
+
`this`
|
|
358
|
+
|
|
359
|
+
A cloned PdfDocument instance
|
|
360
|
+
|
|
361
|
+
#### Overrides
|
|
362
|
+
|
|
363
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`clone`](../../../core/objects/pdf-object/classes/PdfObject.md#clone)
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
### commit()
|
|
368
|
+
|
|
369
|
+
> **commit**(...`newObjects`): `Promise`\<`void`\>
|
|
370
|
+
|
|
371
|
+
Commits pending objects to the document.
|
|
372
|
+
Adds objects, applies encryption if configured, and updates the document structure.
|
|
373
|
+
|
|
374
|
+
#### Parameters
|
|
375
|
+
|
|
376
|
+
##### newObjects
|
|
377
|
+
|
|
378
|
+
...[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)[]
|
|
379
|
+
|
|
380
|
+
Additional objects to add before committing
|
|
381
|
+
|
|
382
|
+
#### Returns
|
|
383
|
+
|
|
384
|
+
`Promise`\<`void`\>
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### decrypt()
|
|
389
|
+
|
|
390
|
+
> **decrypt**(): `Promise`\<`void`\>
|
|
391
|
+
|
|
392
|
+
Decrypts all encrypted objects in the document.
|
|
393
|
+
Removes the security handler and encryption dictionary after decryption.
|
|
394
|
+
|
|
395
|
+
#### Returns
|
|
396
|
+
|
|
397
|
+
`Promise`\<`void`\>
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### deleteObject()
|
|
402
|
+
|
|
403
|
+
> **deleteObject**(`obj`): `Promise`\<`void`\>
|
|
404
|
+
|
|
405
|
+
Deletes an object from all revisions in the document.
|
|
406
|
+
|
|
407
|
+
#### Parameters
|
|
408
|
+
|
|
409
|
+
##### obj
|
|
410
|
+
|
|
411
|
+
The PDF object to delete
|
|
412
|
+
|
|
413
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md) | `undefined`
|
|
414
|
+
|
|
415
|
+
#### Returns
|
|
416
|
+
|
|
417
|
+
`Promise`\<`void`\>
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
### encrypt()
|
|
422
|
+
|
|
423
|
+
> **encrypt**(): `Promise`\<`void`\>
|
|
424
|
+
|
|
425
|
+
Encrypts all objects in the document using the security handler.
|
|
426
|
+
Creates and adds an encryption dictionary to all revisions.
|
|
427
|
+
|
|
428
|
+
#### Returns
|
|
429
|
+
|
|
430
|
+
`Promise`\<`void`\>
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
### equals()
|
|
435
|
+
|
|
436
|
+
> **equals**(`other?`): `boolean`
|
|
437
|
+
|
|
438
|
+
Compares this object to another for equality based on their token representations
|
|
439
|
+
|
|
440
|
+
#### Parameters
|
|
441
|
+
|
|
442
|
+
##### other?
|
|
443
|
+
|
|
444
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)
|
|
445
|
+
|
|
446
|
+
#### Returns
|
|
447
|
+
|
|
448
|
+
`boolean`
|
|
449
|
+
|
|
450
|
+
#### Inherited from
|
|
451
|
+
|
|
452
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`equals`](../../../core/objects/pdf-object/classes/PdfObject.md#equals)
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
### findCompressedObject()
|
|
457
|
+
|
|
458
|
+
> **findCompressedObject**(`options`): `Promise`\<[`PdfIndirectObject`](../../../core/objects/pdf-indirect-object/classes/PdfIndirectObject.md)\<[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)\> \| `undefined`\>
|
|
459
|
+
|
|
460
|
+
Finds a compressed object by its object number within an object stream.
|
|
461
|
+
|
|
462
|
+
#### Parameters
|
|
463
|
+
|
|
464
|
+
##### options
|
|
465
|
+
|
|
466
|
+
Object identifier with objectNumber and optional generationNumber
|
|
467
|
+
|
|
468
|
+
[`PdfObjectReference`](../../../core/objects/pdf-object-reference/classes/PdfObjectReference.md) | \{ `generationNumber?`: `number`; `objectNumber`: `number`; \}
|
|
469
|
+
|
|
470
|
+
#### Returns
|
|
471
|
+
|
|
472
|
+
`Promise`\<[`PdfIndirectObject`](../../../core/objects/pdf-indirect-object/classes/PdfIndirectObject.md)\<[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)\> \| `undefined`\>
|
|
473
|
+
|
|
474
|
+
The found indirect object or undefined if not found
|
|
475
|
+
|
|
476
|
+
#### Throws
|
|
477
|
+
|
|
478
|
+
Error if the object cannot be found in the expected object stream
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
### findUncompressedObject()
|
|
483
|
+
|
|
484
|
+
> **findUncompressedObject**(`options`): [`PdfIndirectObject`](../../../core/objects/pdf-indirect-object/classes/PdfIndirectObject.md)\<[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)\> \| `undefined`
|
|
485
|
+
|
|
486
|
+
Finds an uncompressed indirect object by its object number.
|
|
487
|
+
|
|
488
|
+
#### Parameters
|
|
489
|
+
|
|
490
|
+
##### options
|
|
491
|
+
|
|
492
|
+
Object identifier with objectNumber and optional generationNumber
|
|
493
|
+
|
|
494
|
+
[`PdfObjectReference`](../../../core/objects/pdf-object-reference/classes/PdfObjectReference.md) | \{ `generationNumber?`: `number`; `objectNumber`: `number`; \}
|
|
495
|
+
|
|
496
|
+
#### Returns
|
|
497
|
+
|
|
498
|
+
[`PdfIndirectObject`](../../../core/objects/pdf-indirect-object/classes/PdfIndirectObject.md)\<[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)\> \| `undefined`
|
|
499
|
+
|
|
500
|
+
The found indirect object or undefined if not found
|
|
501
|
+
|
|
502
|
+
#### Throws
|
|
503
|
+
|
|
504
|
+
FoundCompressedObjectError if the object is compressed (in an object stream)
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
### hasObject()
|
|
509
|
+
|
|
510
|
+
> **hasObject**(`obj`): `boolean`
|
|
511
|
+
|
|
512
|
+
Checks if a PDF object exists in the document.
|
|
513
|
+
|
|
514
|
+
#### Parameters
|
|
515
|
+
|
|
516
|
+
##### obj
|
|
517
|
+
|
|
518
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)
|
|
519
|
+
|
|
520
|
+
The PDF object to check
|
|
521
|
+
|
|
522
|
+
#### Returns
|
|
523
|
+
|
|
524
|
+
`boolean`
|
|
525
|
+
|
|
526
|
+
True if the object exists in the document
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
### isIncremental()
|
|
531
|
+
|
|
532
|
+
> **isIncremental**(): `boolean`
|
|
533
|
+
|
|
534
|
+
Checks if the document is in incremental mode.
|
|
535
|
+
|
|
536
|
+
#### Returns
|
|
537
|
+
|
|
538
|
+
`boolean`
|
|
539
|
+
|
|
540
|
+
True if all revisions are locked for incremental updates
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
### isModified()
|
|
545
|
+
|
|
546
|
+
> **isModified**(): `boolean`
|
|
547
|
+
|
|
548
|
+
Indicates whether the object has been modified. Override this method if the modified state is determined differently
|
|
549
|
+
|
|
550
|
+
#### Returns
|
|
551
|
+
|
|
552
|
+
`boolean`
|
|
553
|
+
|
|
554
|
+
#### Overrides
|
|
555
|
+
|
|
556
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`isModified`](../../../core/objects/pdf-object/classes/PdfObject.md#ismodified)
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
### readObject()
|
|
561
|
+
|
|
562
|
+
> **readObject**(`options`): `Promise`\<[`PdfIndirectObject`](../../../core/objects/pdf-indirect-object/classes/PdfIndirectObject.md)\<[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)\> \| `undefined`\>
|
|
563
|
+
|
|
564
|
+
Reads and optionally decrypts an object by its object number.
|
|
565
|
+
Handles both compressed and uncompressed objects.
|
|
566
|
+
|
|
567
|
+
#### Parameters
|
|
568
|
+
|
|
569
|
+
##### options
|
|
570
|
+
|
|
571
|
+
Object lookup options
|
|
572
|
+
|
|
573
|
+
###### allowUnindexed?
|
|
574
|
+
|
|
575
|
+
`boolean`
|
|
576
|
+
|
|
577
|
+
If true, searches unindexed objects as fallback
|
|
578
|
+
|
|
579
|
+
###### generationNumber?
|
|
580
|
+
|
|
581
|
+
`number`
|
|
582
|
+
|
|
583
|
+
Optional generation number filter
|
|
584
|
+
|
|
585
|
+
###### objectNumber
|
|
586
|
+
|
|
587
|
+
`number`
|
|
588
|
+
|
|
589
|
+
The object number to find
|
|
590
|
+
|
|
591
|
+
#### Returns
|
|
592
|
+
|
|
593
|
+
`Promise`\<[`PdfIndirectObject`](../../../core/objects/pdf-indirect-object/classes/PdfIndirectObject.md)\<[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)\> \| `undefined`\>
|
|
594
|
+
|
|
595
|
+
A cloned and decrypted copy of the object, or undefined if not found
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
### setDocumentSecurityStore()
|
|
600
|
+
|
|
601
|
+
> **setDocumentSecurityStore**(`dss`): `Promise`\<`void`\>
|
|
602
|
+
|
|
603
|
+
Sets the Document Security Store (DSS) for the document.
|
|
604
|
+
Used for long-term validation of digital signatures.
|
|
605
|
+
|
|
606
|
+
#### Parameters
|
|
607
|
+
|
|
608
|
+
##### dss
|
|
609
|
+
|
|
610
|
+
[`PdfDocumentSecurityStoreObject`](../../../signing/document-security-store/classes/PdfDocumentSecurityStoreObject.md)
|
|
611
|
+
|
|
612
|
+
The Document Security Store object to set
|
|
613
|
+
|
|
614
|
+
#### Returns
|
|
615
|
+
|
|
616
|
+
`Promise`\<`void`\>
|
|
617
|
+
|
|
618
|
+
#### Throws
|
|
619
|
+
|
|
620
|
+
Error if the document has no root dictionary
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
|
|
624
|
+
### setIncremental()
|
|
625
|
+
|
|
626
|
+
> **setIncremental**(`value`): `void`
|
|
627
|
+
|
|
628
|
+
Sets whether the document should use incremental updates.
|
|
629
|
+
When true, locks all existing revisions to preserve original content.
|
|
630
|
+
|
|
631
|
+
#### Parameters
|
|
632
|
+
|
|
633
|
+
##### value
|
|
634
|
+
|
|
635
|
+
`boolean`
|
|
636
|
+
|
|
637
|
+
True to enable incremental mode, false to disable
|
|
638
|
+
|
|
639
|
+
#### Returns
|
|
640
|
+
|
|
641
|
+
`void`
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
### setModified()
|
|
646
|
+
|
|
647
|
+
> **setModified**(`modified`): `void`
|
|
648
|
+
|
|
649
|
+
Sets the modified state of the object. Override this method if the modified state is determined differently
|
|
650
|
+
|
|
651
|
+
#### Parameters
|
|
652
|
+
|
|
653
|
+
##### modified
|
|
654
|
+
|
|
655
|
+
`boolean` = `true`
|
|
656
|
+
|
|
657
|
+
#### Returns
|
|
658
|
+
|
|
659
|
+
`void`
|
|
660
|
+
|
|
661
|
+
#### Inherited from
|
|
662
|
+
|
|
663
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`setModified`](../../../core/objects/pdf-object/classes/PdfObject.md#setmodified)
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
### setOwnerPassword()
|
|
668
|
+
|
|
669
|
+
> **setOwnerPassword**(`ownerPassword`): `void`
|
|
670
|
+
|
|
671
|
+
Sets the owner password for document encryption.
|
|
672
|
+
|
|
673
|
+
#### Parameters
|
|
674
|
+
|
|
675
|
+
##### ownerPassword
|
|
676
|
+
|
|
677
|
+
`string`
|
|
678
|
+
|
|
679
|
+
The owner password to set
|
|
680
|
+
|
|
681
|
+
#### Returns
|
|
682
|
+
|
|
683
|
+
`void`
|
|
684
|
+
|
|
685
|
+
#### Throws
|
|
686
|
+
|
|
687
|
+
Error if the security handler doesn't support password setting
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
### setPassword()
|
|
692
|
+
|
|
693
|
+
> **setPassword**(`password`): `void`
|
|
694
|
+
|
|
695
|
+
Sets the user password for document encryption.
|
|
696
|
+
|
|
697
|
+
#### Parameters
|
|
698
|
+
|
|
699
|
+
##### password
|
|
700
|
+
|
|
701
|
+
`string`
|
|
702
|
+
|
|
703
|
+
The user password to set
|
|
704
|
+
|
|
705
|
+
#### Returns
|
|
706
|
+
|
|
707
|
+
`void`
|
|
708
|
+
|
|
709
|
+
#### Throws
|
|
710
|
+
|
|
711
|
+
Error if the security handler doesn't support password setting
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
### setVersion()
|
|
716
|
+
|
|
717
|
+
> **setVersion**(`version`): `void`
|
|
718
|
+
|
|
719
|
+
Sets the PDF version for the document.
|
|
720
|
+
|
|
721
|
+
#### Parameters
|
|
722
|
+
|
|
723
|
+
##### version
|
|
724
|
+
|
|
725
|
+
`string`
|
|
726
|
+
|
|
727
|
+
The PDF version string (e.g., '1.7', '2.0')
|
|
728
|
+
|
|
729
|
+
#### Returns
|
|
730
|
+
|
|
731
|
+
`void`
|
|
732
|
+
|
|
733
|
+
#### Throws
|
|
734
|
+
|
|
735
|
+
Error if attempting to change version after objects have been added in incremental mode
|
|
736
|
+
|
|
737
|
+
---
|
|
738
|
+
|
|
739
|
+
### startNewRevision()
|
|
740
|
+
|
|
741
|
+
> **startNewRevision**(): `PdfDocument`
|
|
742
|
+
|
|
743
|
+
Starts a new revision for incremental updates.
|
|
744
|
+
Creates a new revision linked to the previous one.
|
|
745
|
+
|
|
746
|
+
#### Returns
|
|
747
|
+
|
|
748
|
+
`PdfDocument`
|
|
749
|
+
|
|
750
|
+
The document instance for method chaining
|
|
751
|
+
|
|
752
|
+
---
|
|
753
|
+
|
|
754
|
+
### toBytes()
|
|
755
|
+
|
|
756
|
+
> **toBytes**(): [`ByteArray`](../../../types/type-aliases/ByteArray.md)
|
|
757
|
+
|
|
758
|
+
Serializes the document to a byte array.
|
|
759
|
+
|
|
760
|
+
#### Returns
|
|
761
|
+
|
|
762
|
+
[`ByteArray`](../../../types/type-aliases/ByteArray.md)
|
|
763
|
+
|
|
764
|
+
The PDF document as a Uint8Array
|
|
765
|
+
|
|
766
|
+
#### Overrides
|
|
767
|
+
|
|
768
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`toBytes`](../../../core/objects/pdf-object/classes/PdfObject.md#tobytes)
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|
|
772
|
+
### tokenize()
|
|
773
|
+
|
|
774
|
+
> `protected` **tokenize**(): [`PdfToken`](../../../core/tokens/token/classes/PdfToken.md)[]
|
|
775
|
+
|
|
776
|
+
Tokenizes the object into an array of PdfTokens
|
|
777
|
+
|
|
778
|
+
#### Returns
|
|
779
|
+
|
|
780
|
+
[`PdfToken`](../../../core/tokens/token/classes/PdfToken.md)[]
|
|
781
|
+
|
|
782
|
+
#### Overrides
|
|
783
|
+
|
|
784
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`tokenize`](../../../core/objects/pdf-object/classes/PdfObject.md#tokenize)
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
### tokensWithObjects()
|
|
789
|
+
|
|
790
|
+
> **tokensWithObjects**(): `object`[]
|
|
791
|
+
|
|
792
|
+
Returns tokens paired with their source objects.
|
|
793
|
+
Useful for debugging and analysis of document structure.
|
|
794
|
+
|
|
795
|
+
#### Returns
|
|
796
|
+
|
|
797
|
+
`object`[]
|
|
798
|
+
|
|
799
|
+
Array of token-object pairs
|
|
800
|
+
|
|
801
|
+
---
|
|
802
|
+
|
|
803
|
+
### toString()
|
|
804
|
+
|
|
805
|
+
> **toString**(): `string`
|
|
806
|
+
|
|
807
|
+
Converts the object to a string representation
|
|
808
|
+
|
|
809
|
+
#### Returns
|
|
810
|
+
|
|
811
|
+
`string`
|
|
812
|
+
|
|
813
|
+
#### Inherited from
|
|
814
|
+
|
|
815
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`toString`](../../../core/objects/pdf-object/classes/PdfObject.md#tostring)
|
|
816
|
+
|
|
817
|
+
---
|
|
818
|
+
|
|
819
|
+
### toTokens()
|
|
820
|
+
|
|
821
|
+
> **toTokens**(): [`PdfToken`](../../../core/tokens/token/classes/PdfToken.md)[]
|
|
822
|
+
|
|
823
|
+
Converts the object to an array of PdfTokens, including any pre or post tokens
|
|
824
|
+
|
|
825
|
+
#### Returns
|
|
826
|
+
|
|
827
|
+
[`PdfToken`](../../../core/tokens/token/classes/PdfToken.md)[]
|
|
828
|
+
|
|
829
|
+
#### Inherited from
|
|
830
|
+
|
|
831
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md).[`toTokens`](../../../core/objects/pdf-object/classes/PdfObject.md#totokens)
|
|
832
|
+
|
|
833
|
+
---
|
|
834
|
+
|
|
835
|
+
### fromBytes()
|
|
836
|
+
|
|
837
|
+
> `static` **fromBytes**(`input`): `Promise`\<`PdfDocument`\>
|
|
838
|
+
|
|
839
|
+
Creates a PdfDocument from a byte stream.
|
|
840
|
+
|
|
841
|
+
#### Parameters
|
|
842
|
+
|
|
843
|
+
##### input
|
|
844
|
+
|
|
845
|
+
Async or sync iterable of byte arrays
|
|
846
|
+
|
|
847
|
+
`Iterable`\<[`ByteArray`](../../../types/type-aliases/ByteArray.md), `any`, `any`\> | `AsyncIterable`\<[`ByteArray`](../../../types/type-aliases/ByteArray.md), `any`, `any`\>
|
|
848
|
+
|
|
849
|
+
#### Returns
|
|
850
|
+
|
|
851
|
+
`Promise`\<`PdfDocument`\>
|
|
852
|
+
|
|
853
|
+
A promise that resolves to the parsed PdfDocument
|
|
854
|
+
|
|
855
|
+
---
|
|
856
|
+
|
|
857
|
+
### fromObjects()
|
|
858
|
+
|
|
859
|
+
> `static` **fromObjects**(`objects`): `PdfDocument`
|
|
860
|
+
|
|
861
|
+
Creates a PdfDocument from an array of PDF objects.
|
|
862
|
+
Parses objects into revisions based on EOF comments.
|
|
863
|
+
|
|
864
|
+
#### Parameters
|
|
865
|
+
|
|
866
|
+
##### objects
|
|
867
|
+
|
|
868
|
+
[`PdfObject`](../../../core/objects/pdf-object/classes/PdfObject.md)[]
|
|
869
|
+
|
|
870
|
+
Array of PDF objects to construct the document from
|
|
871
|
+
|
|
872
|
+
#### Returns
|
|
873
|
+
|
|
874
|
+
`PdfDocument`
|
|
875
|
+
|
|
876
|
+
A new PdfDocument instance
|