FontRepositoryFindFont Method (String)
Searches and returns font with specified font name.

Namespace: Aspose.Pdf.Text
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 20.1
Syntax
public static Font FindFont(
	string fontName
)

Parameters

fontName
Type: SystemString
Font name.

Return Value

Type: Font
Font object.
Examples
The example demonstrates how to find font and replace the font of text of first page.
C#
// Find font
Font font = FontRepository.FindFont("Arial");

// Open document
Document doc = new Document(@"D:\Tests\input.pdf");

// Create TextFragmentAbsorber object to find all "hello world" text occurrences
TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");

// Accept the absorber for first page
doc.Pages[1].Accept(absorber);

// Change font of the first text occurrence
absorber.TextFragments[1].TextState.Font = font;

// Save document
doc.Save(@"D:\Tests\output.pdf");
See Also