FontRepository.FindFont

FindFont(string)

Belirtilen font adıyla font arar ve döndürür.

public static Font FindFont(string fontName)
ParametreTürAçıklama
fontNameStringFont adı.

Dönüş Değeri

Font nesnesi.

Örnekler

Örnek, font bulmayı ve ilk sayfadaki metnin fontunu değiştirmeyi gösterir.

// 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"); 

Ayrıca Bakınız


FindFont(string, bool)

Belirtilen font adıyla font arar ve büyük/küçük harf duyarlılığını göz ardı eder veya dikkate alır.

public static Font FindFont(string fontName, bool ignoreCase)
ParametreTürAçıklama
fontNameStringFont adı.
ignoreCaseBooleanbüyük/küçük harf duyarlılığı

Dönüş Değeri

Font nesnesi.

Örnekler

Örnek, font bulmayı ve ilk sayfadaki metnin fontunu değiştirmeyi gösterir.

// 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"); 

Ayrıca Bakınız


FindFont(string, FontStyles)

Belirtilen font adı ve font stiliyle font arar ve döndürür.

public static Font FindFont(string fontFamilyName, FontStyles stl)
ParametreTürAçıklama
fontFamilyNameStringFont aile adı.
stlFontStylesFont stil değeri.

Dönüş Değeri

Arama isteği parametrelerine karşılık gelen font nesnesi.

Örnekler

Örnek, font bulmayı ve ilk sayfadaki metnin fontunu değiştirmeyi gösterir.

// Find font
Font font = FontRepository.FindFont("Arial", FontStyle.Italic);

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

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

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

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

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

Ayrıca Bakınız


FindFont(string, FontStyles, bool)

Belirtilen font adı ve font stiliyle font arar ve büyük/küçük harf duyarlılığını göz ardı eder veya dikkate alır.

public static Font FindFont(string fontFamilyName, FontStyles stl, bool ignoreCase)
ParametreTürAçıklama
fontFamilyNameStringFont aile adı.
stlFontStylesFont stil değeri.
ignoreCaseBooleanbüyük/küçük harf duyarlılığı

Dönüş Değeri

Arama isteği parametrelerine karşılık gelen font nesnesi.

Örnekler

Örnek, font bulmayı ve ilk sayfadaki metnin fontunu değiştirmeyi gösterir.

// Find font
Font font = FontRepository.FindFont("Arial", FontStyle.Italic);

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

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

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

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

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

Ayrıca Bakınız