I am not able to create multiple pdf font style with new version 3.2.102.5040 but with old version it was working fine,
PFB sample code
Please suggest any work around for this issue how to create multiple font style.
Thanks
Gaurav M.
- Code: Select all
Dim pdf As New PdfDocument
Dim page As PdfPageBase = pdf.Pages.Add()
Dim font As String = "Arial"
Dim BlackBrush As PdfBrush = PdfBrushes.Black
Dim SmallestFont As New PdfTrueTypeFont(New Font(font, 5.0F, FontStyle.Regular))
Dim x As Integer = 100
Dim SmallFont As PdfTrueTypeFont = New PdfTrueTypeFont(New Font(font, 7, FontStyle.Regular))
Dim y As Integer = 100
Dim ContentFont As PdfTrueTypeFont = New PdfTrueTypeFont(New Font(font, 8, FontStyle.Regular))
Dim HeadingFont As PdfTrueTypeFont = New PdfTrueTypeFont(New Font(font, 9, FontStyle.Regular))
Dim HeaderFont As PdfTrueTypeFont = New PdfTrueTypeFont(New Font(font, 12, FontStyle.Regular))
page.Canvas.DrawString("Spire 3.2.106 Test Application", SmallestFont, BlackBrush, x, y)
y += SmallestFont.Height + 5
page.Canvas.DrawString("Spire 3.2.106 Test Application", SmallFont, BlackBrush, x, y)
y += SmallFont.Height + 5
page.Canvas.DrawString("Spire 3.2.106 Test Application", ContentFont, BlackBrush, x, y)
y += ContentFont.Height + 5
page.Canvas.DrawString("Spire 3.2.106 Test Application", HeadingFont, BlackBrush, x, y)
y += HeadingFont.Height + 5
page.Canvas.DrawString("Spire 3.2.106 Test Application", HeaderFont, BlackBrush, x, y)
y += HeaderFont.Height + 5
y = y + 16.0F
Dim trueTypeFont As New PdfTrueTypeFont(New Font(font, 5.0F, FontStyle.Regular))
page.Canvas.DrawString("Spire 3.2.106 Test Application", trueTypeFont, BlackBrush, x, y)
pdf.SaveToFile("Test.pdf")
Process.Start("Test.pdf")