Set password for output document
Leave feedback
On this page
GroupDocs.Comparison allows you to protect the output document with a password.
To protect the output document, follow these steps:
- Instantiate the
Comparer
object. Specify the source document path or stream. - Call the
add()
method. Specify the target document path or stream. - Instantiate the
CompareOptions
object. Call thesetPasswordSaveOption()
method and specify thePasswordSaveOption.USER
value. - Instantiate the
SaveOptions
object. Call thesetPassword()
property to specify a password string. - Call the
compare()
method. Specify theSaveOptions
andCompareOptions
objects as parameters.
The following code snippet shows how to compare documents and protect the output document with a password:
const comparer = new groupdocs.comparison.Comparer(sourceFile);
comparer.add(targetFile);
const compareOptions = new groupdocs.comparison.CompareOptions();
compareOptions.setPasswordSaveOption(groupdocs.comparison.PasswordSaveOption.USER);
SaveOptions saveOptions = new groupdocs.comparison.SaveOptions();
saveOptions.setPassword("3333");
const resultPath = comparer.compare(outputFile, saveOptions, compareOptions);
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.