You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/NET/Working-with-Text.md
+34-26Lines changed: 34 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -386,12 +386,33 @@ document.Close(True)
386
386
387
387
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Text/Draw-text-in-PDF-document-using-standard-fonts/).
388
388
389
-
### Draw text using TrueType fonts
389
+
### Draw Text using TrueType fonts
390
390
391
-
You can add text using the TrueType fonts installed in the system, by initializing [PdfFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfFont.html) class as [PdfTrueTypeFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfTrueTypeFont.html) class. The following code snippet illustrates this.
391
+
You can add text using TrueType fonts either installed on the system or provided as a font stream by initializing the [PdfFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfFont.html) class as a [PdfTrueTypeFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfTrueTypeFont.html). The following code Example demonstrates this approach.
392
392
393
393
{% tabs %}
394
394
395
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
396
+
397
+
//Create a new PDF document.
398
+
PdfDocument document = new PdfDocument();
399
+
//Add a page to the document.
400
+
PdfPage page = document.Pages.Add();
401
+
402
+
//Create PDF graphics for the page.
403
+
PdfGraphics graphics = page.Graphics;
404
+
//Provide the path of the local *.ttf file
405
+
PdfFont font = new PdfTrueTypeFont("Arial.ttf", 14);
406
+
//Draw the text.
407
+
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
0 commit comments