// Prepare a path to a source HTML file string documentPath = Path.Combine(DataDir, "file.html"); // Create an instance of Configuration using var configuration = new Configuration(); // Get the IUserAgentService var service = configuration.GetService<IUserAgentService>(); // Set a custom font folder path service.FontsSettings.SetFontsLookupFolder(Path.Combine(DataDir + "fonts")); // Initialize the HTML document with specified configuration using (var document = new HTMLDocument(documentPath, configuration)) { // Convert HTML to PDF Converter.ConvertHTML(document, new PdfSaveOptions(), Path.Combine(OutputDir, "file-fontsetting.pdf")); }