Load Custom Fonts

GroupDocs.Comparison for Python via .NET can compare documents that use non-standard fonts. Register the custom font directory through a LoadOptions instance before opening the documents.

Example: Connect custom fonts and compare documents

from groupdocs.comparison import Comparer
from groupdocs.comparison.options import LoadOptions

def load_custom_fonts():
    load_options = LoadOptions()
    load_options.font_directories.append("./fonts/")

    with Comparer("./source.docx", load_options) as comparer:
        comparer.add("./target.docx", load_options)
        comparer.compare("./result.docx")

if __name__ == "__main__":
    load_custom_fonts()

source.docx is the source file used in this example. Click here to download it.

target.docx is the target file used in this example. Click here to download it.

Binary file (DOCX, 11 KB)

Download full output

The ./fonts/ directory in the example should contain the .otf or .ttf files needed to render the document accurately.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.