removeAllSignatures method
Contents
[
Hide
]removeAllSignatures(srcStream, dstStream)
removeAllSignatures(srcStream: Buffer, dstStream)
Parameter | Type | Description |
---|---|---|
srcStream | Buffer | |
dstStream |
removeAllSignatures(srcFileName, dstFileName)
Removes all digital signatures from source file and writes unsigned file to destination file. The following formats are compatible for digital signature removal: LoadFormat.Doc, LoadFormat.Dot, LoadFormat.Docx, LoadFormat.Dotx, LoadFormat.Docm, LoadFormat.Dotm, LoadFormat.Odt, LoadFormat.Ott.
removeAllSignatures(srcFileName: string, dstFileName: string)
Parameter | Type | Description |
---|---|---|
srcFileName | string | |
dstFileName | string |
Examples
Shows how to remove digital signatures from a digitally signed document.
// There are two ways of using the DigitalSignatureUtil class to remove digital signatures
// from a signed document by saving an unsigned copy of it somewhere else in the local file system.
// 1 - Determine the locations of both the signed document and the unsigned copy by filename strings:
aw.DigitalSignatures.DigitalSignatureUtil.removeAllSignatures(base.myDir + "Digitally signed.docx",
base.artifactsDir + "DigitalSignatureUtil.LoadAndRemove.FromString.docx");
// 2 - Determine the locations of both the signed document and the unsigned copy by file streams:
let streamIn = base.loadFileToBuffer(base.myDir + "Digitally signed.docx");
let streamOut = fs.createWriteStream(base.artifactsDir + "DigitalSignatureUtil.LoadAndRemove.FromStream.docx");
aw.DigitalSignatures.DigitalSignatureUtil.removeAllSignatures(streamIn, streamOut);
await new Promise(resolve => streamOut.on("finish", resolve));
// Verify that both our output documents have no digital signatures.
expect(aw.DigitalSignatures.DigitalSignatureUtil.loadSignatures(base.artifactsDir + "DigitalSignatureUtil.LoadAndRemove.FromString.docx").count).toEqual(0);
expect(aw.DigitalSignatures.DigitalSignatureUtil.loadSignatures(base.artifactsDir + "DigitalSignatureUtil.LoadAndRemove.FromStream.docx").count).toEqual(0);
See Also
- module Aspose.Words.DigitalSignatures
- class DigitalSignatureUtil