When the source file is located on the local disk, GroupDocs.Comparison allows you to load it using the Comparer class constructor by specifying an absolute or relative path. To load the target file located on the local disk, use the add() method. Specify an absolute or relative path as the parameter.
The following code snippet shows how to load files from a local disk:
importgroupdocs.comparisonasgcdefload_file_from_local_disk(output_file_path,source_file_path,target_file_path):# Initialize comparer with the source documentwithgc.Comparer(source_file_path)ascomparer:# Add the target document for comparisoncomparer.add(target_file_path)# Compare the documents and save the resultcomparer.compare(output_file_path)# Log the success message with the output file pathprint(f"\nDocuments compared successfully.\nCheck output in {output_file_path}.")
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.