GroupDocs.Comparison allows you to compare documents that are protected with a password.
To compare password-protected documents, follow these steps:
Instantiate the LoadOptions object. Specify source document password;
Instantiate the Comparer object. Specify the source document path or stream and LoadOptions object created in the previous step.
Instantiate another LoadOptions object. Specify the target document password.
Call the add() method. Specify the target document path or stream and the LoadOptions object created in the previous step.
Call the compare() method.
The following code snippet shows how to compare password-protected documents:
defcompare_multiple_documents_protected_path(output_file_name,source_path,target_paths,source_password,target_passwords,result_path):try:# Initialize the comparer with the source file path and load optionsload_options_source=gc.options.LoadOptions()load_options_source.password=source_passwordcomparer=gc.Comparer(source_path,load_options_source)# Add target files and load optionsfortarget_path,target_passwordinzip(target_paths,target_passwords):load_options_target=gc.options.LoadOptions()load_options_target.password=target_passwordcomparer.add(target_path,load_options_target)# Perform the compare operation and save the resultcomparer.compare(output_file_name)print(f"\nDocuments compared successfully.\nCheck output in {output_file_name}.")exceptExceptionaserror:# Handle errorsprint('An error occurred during the document comparison:',error)
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.