GroupDocs.Comparison allows you to compare documents that contain non-standard fonts.
The following code snippet shows how to connect custom fonts and compare documents:
'use strict';// Import the GroupDocs Comparison Node.js SDK
constgroupdocs=require('@groupdocs/groupdocs.comparison');// Enable strict mode for safer JavaScript
// Create LoadOptions and add a custom font directory
constloadOptions=newgroupdocs.LoadOptions();loadOptions.getFontDirectories().add('sample-files/font.otf');// Register custom font for accurate rendering
// Define the path to the source document
constsourcePath='sample-files/source.docx';// Initialize the Comparer with the source file and the load options
constcomparer=newgroupdocs.Comparer(sourcePath,loadOptions);// Add the target document to the comparison set
comparer.add('sample-files/target.docx');// Perform the comparison and save the result document
comparer.compare('result.docx');// Terminate the process with a success exit code
process.exit(0);
This example creates a LoadOptions instance and adds a custom font directory using getFontDirectories().add(). It then initializes the Comparer with the source document path and the LoadOptions object, which ensures that custom fonts are available during comparison. The target document is added, and the comparison is performed. This allows documents with non-standard fonts to be compared accurately, as the custom fonts are registered and used for rendering.
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.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.