alexa
menu

Document Processing

    Show / Hide Table of Contents

    FontManager Class

    Provides centralized management of shared font resources used across document conversion libraries (e.g., Word-to-PDF/Image, Excel-to-PDF/Image, PPTX-to-PDF/Image) and PDF processing.

    Inheritance
    System.Object
    FontManager
    Namespace: Syncfusion.Drawing.Fonts
    Assembly: Syncfusion.Compression.Base.dll
    Syntax
    public class FontManager : Object
    Remarks

    FontManager maintains common font caches to optimize performance and reduce duplication. Font instances are cached to reuse during batch conversions and long-running services. Automatic cleanup is coordinated via a System.Timers.Timer controlled by Delay. When the delay elapses, unused or idle font objects are disposed and removed from caches. For deterministic cleanup, call ClearCache() to immediately purge all managed caches.

    Properties

    Delay

    Gets or sets the delay (in milliseconds) used to schedule disposal of font objects managed by FontManager.

    Declaration
    public static double Delay { get; set; }
    Property Value
    Type
    System.Double
    Remarks

    When fonts are no longer referenced or marked as unused, an internal System.Timers.Timer is configured with the specified Delay value to trigger disposal and removal of those fonts from the caches.

    The default delay is 30000 milliseconds, and the value must be between 1 and 2,147,483,647 milliseconds.

    RegisteredFontNames

    Gets the names of all fonts currently registered with the FontManager.

    Declaration
    public static List<string> RegisteredFontNames { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    A list containing the names of all registered fonts. Each entry includes the font family name and style information,
    for example: Arial_Regular, Arial_Bold, Arial_Italic, and Arial_BoldItalic.

    Methods

    ClearCache()

    Immediately clears all font caches managed by FontManager.

    Declaration
    public static void ClearCache()
    Remarks

    This method forcefully removes and disposes all font instances maintained in the shared caches. Use this to reclaim memory deterministically, instead of waiting for timeout defined in the Delay property.

    This method can be called when shutting down an application domain or after completing a batch conversion. Even if this method is not called, the unused fonts in cache will be disposed one by one automatically after the timeout defined in the Delay property.

    ClearRegisteredFonts(Boolean)

    Declaration
    public static void ClearRegisteredFonts(bool disposeFonts = false)
    Parameters
    Type Name Description
    System.Boolean disposeFonts

    RegisterFonts(List<Stream>)

    Registers multiple fonts from the specified font streams for use across Syncfusion document conversion libraries, including Word-to-PDF/Image, Excel-to-PDF/Image, and PowerPoint-to-PDF/Image conversions.

    Declaration
    public static void RegisterFonts(List<Stream> fontStreams)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.IO.Stream> fontStreams

    A collection of streams containing the fonts to register.

    Remarks

    Supported font formats are TrueType (.ttf) and OpenType (.otf).

    RegisterFonts(String)

    Registers multiple fonts from the specified folder for use across Syncfusion document conversion libraries, including Word-to-PDF/Image, Excel-to-PDF/Image, and PowerPoint-to-PDF/Image conversions.

    Declaration
    public static void RegisterFonts(string folderPath)
    Parameters
    Type Name Description
    System.String folderPath

    A folder path containing the fonts to register.

    Remarks

    Supported font formats are TrueType (.ttf) and OpenType (.otf).

    Exceptions
    Type Condition
    System.IO.DirectoryNotFoundException

    Thrown when the specified font directory does not exist.

    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved