Reputation: 46
I want to get the font of a textbox into itextsharp basefont in winform c#. I also want to align the text in a PDF according to alignment of the textbox in winform.
Upvotes: 0
Views: 2083
Reputation: 22409
You can use iTextSharp.text.Font
instead as the following:
Font font = FontFactory.GetFont("Segoe UI", 18.0f, BaseColor.Black);
if you have System.Drawing.Font
use the following:
System.Drawing.Font systemDrawingFont = new System.Drawing.Font("Segoe UI", 12);
Font font = FontFactory.GetFont(systemDrawingFont.Name, systemDrawingFont.Size, BaseColor.Black);
Upvotes: 0
Reputation: 1916
Use FontFactory.RegisterDirectories()
to read your fonts. Get the font name from System.Drawing.Font
and call FontFactory.GetFont()
with that name.
Upvotes: 3