Making Header font to be bold in ITextSharp using VB.Net

Last Reply 8 months ago By dharmendr

Posted 8 months ago

Hi Sir,

How to change header font style is bold in ITextSharp .

My code is, 

Dim bf As itextsharp.text.pdf.BaseFont = itextsharp.text.pdf.BaseFont.CreateFont("", itextsharp.text.pdf.BaseFont.CP1252, itextsharp.text.pdf.BaseFont.EMBEDDED)
Dim Font As itextsharp.text.Font = New itextsharp.text.Font(bf, 10)
Dim cell As New PdfPCell(New Phrase(column.HeaderText, Font))
           

 

Posted 8 months ago
PSowmiya says:
Dim bf As itextsharp.text.pdf.BaseFont = itextsharp.text.pdf.BaseFont.CreateFont("", itextsharp.text.pdf.BaseFont.CP1252, itextsharp.text.pdf.BaseFont.EMBEDDED)
Dim Font As itextsharp.text.Font = New itextsharp.text.Font(bf, 10)
Dim cell As New PdfPCell(New Phrase(column.HeaderText, Font))

Change above code with below.

Dim bf As BaseFont = BaseFont.CreateFont("c:/windows/fonts/HARLOWSI.ttf", BaseFont.CP1252, BaseFont.EMBEDDED)
Dim Font As Font = New Font(bf, 10, Font.BOLD)
Dim cell As New PdfPCell(New Phrase(column.HeaderText, Font))