Load custom fonts

On this page

GroupDocs.Comparison allows you to compare documents that contains non-standard fonts.

To connect custom fonts and compare documents, follow these steps:

  1. Instantiate the LoadOptions object. Speicfy a list of directories with custom fonts.
  2. Instantiate the Comparer object with source document path or stream and the LoadOptions object created in the previous step.
  3. Call the add() method. Specify the target document path or stream.
  4. Call the Comparer method.

The following code snippet shows how to connect custom fonts and compare documents:

import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.options.load.LoadOptions;
import java.nio.file.Path;
// ...

// Instantiate the LoadOptions object and create a list of custom font directories.
LoadOptions loadOptions = new LoadOptions();
loadOptions.getFontDirectories().add("./fontPath/");
 
try (Comparer comparer = new Comparer(sourceDocument, loadOptions)) {
    comparer.add(targetDocument);
    final Path resultPath = comparer.compare(resultDocument);
}

On this page