まず.TTF
、コードで簡単にアクセスできるようにフォント ファイルをルート パスに配置してから、次のコードで新しいフォントを作成しobject
ます。
// this code is for VB
FontFactory.Register(Server.MapPath(".") + "/IranNastaliq.ttf")
Dim Mitra As Font = FontFactory.GetFont("Mitra", BaseFont.IDENTITY_H)
Mitra.Size = 11
以下に示すように、新しいフォントを作成しFontSelector
object
てフォントを追加します。
Dim fontSelector = New FontSelector()
fontSelector.AddFont(Mitra)
そして、新しいものを作成しますPdfPCell
object
Dim contentCell = New PdfPCell With {.RunDirection = PdfWriter.RUN_DIRECTION_LTR}
最後に、このコードから使用してフォントを適用します。
contentCell.Phrase = fontSelector.Process(row(i).ToString())
注
コーディング言語が の場合、このオンライン ツールを使用して上記のコードをすべて に変換C#
できます。C#