Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.25 KB

load-fonts-with-net-standard.md

File metadata and controls

40 lines (26 loc) · 1.25 KB
title description type page_title slug position tags res_type
RadPdfProcessing manually register font
This topic shows you how to manually register a font and use it in a PDF document with PdfProcessing.
how-to
RadPdfProcessing manually register font
load-fonts-with-net-standard
0
pdf, register, fonts
kb
Product Version Product Author
2020.1.114 RadPdfProcessing for Net Standard Dimitar Karamfilov

Problem

The RadPdfProcessing version for .NET standard does not look for the fonts on the operating system and falls back to the standard fonts.

Solution

Manually register the fonts in your application.

C#

{{region kb-load-fonts-with-net-standard1}} var fontData = File.ReadAllBytes(@"......\Roboto-Bold.TTF"); FontsRepository.RegisterFont(new FontFamily("Roboto"), FontStyles.Normal, FontWeights.Bold, fontData);

Block block = new Block();

block.InsertText(new FontFamily("Roboto"), FontStyles.Normal, FontWeights.Bold, "Text");
editor.Position.Translate(100, 100);
editor.DrawBlock(block);

{{endregion}}