Change font in PDF

Dim signature As Text = New Text

Dim segSign As Segment = New Segment(pl)

segSign.TextInfo.FontName = "Monotype Corsiva"

segSign.TextInfo.IsFontEmbedded = True

signature.Segments.Add(segSign)

Dim Provrow37 As Row = ProviderTable.Rows.Add()

Dim Provrow37col As Cell = Provrow37.Cells.Add()

Provrow37col.Paragraphs.Add(signature)


font "Monotype Corsiva" is not effecting. i will make sure this font is in the font file where pdf was generated.

Hello Ying,

Thanks for considering Aspose.

I've tested the scenario using the following code snippet and latest hotfix for Aspose.Pdf for .NET 4.1.1 and I'm unable to notice the problem.

First I've installed the Monotype Corsiva font over my system and then executed the following code snippet to generate the PDF document. The latest hotfix, font file and resultant PDF that I've generated are in attachment. Please take a look.

[VB.NET]

'Instantiate Pdf instance by calling it empty constructor
Dim pdf1 As Pdf = New Pdf()
'Create a section in the Pdf object
Dim sec1 As Section = pdf1.Sections.Add()

'Create a text paragraph inheriting text format settings from the section
Dim signature As Text = New Text
Dim segSign As Segment = New Segment("Hello World in Monotype Conrsiva")
segSign.TextInfo.FontName = "Monotype Corsiva"
segSign.TextInfo.IsFontEmbedded = True
signature.Segments.Add(segSign)
sec1.Paragraphs.Add(signature)
pdf1.SetUnicode()
pdf1.IsAutoFontAdjusted = True

pdf1.Save("d:/sampleOutput.pdf")

In case you still face any problem or you've any further query, please feel free to contact.