I have tried many examples found from Google without a lot of luck.
I have below but cannot implement without getting "System.InvalidCastException: 'Conversion from string "Report by: Some Text" to type 'Integer' is not valid.'" and do not understand why it is wanting to convert to Integer.
ERROR ON THIS LINE:
Code:
pdfParagraph.Add("Report by: Some Text", Ffont)
Code:
Dim pdfFont As BaseFont = BaseFont.CreateFont("c:\windows\fonts\Arial.ttf", BaseFont.IDENTITY_H, True)
Dim Ffont As New iTextSharp.text.Font(pdfFont, 8, iTextSharp.text.Font.NORMAL)
'pdfParagraph.Add(Ffont)
'Dim pdfFont As iTextSharp.text.Font = New Font(FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8.0F, Font.Bold, BaseColor.BLACK))
pdfParagraph.Add("Report by: Some Text", Ffont)
pdfDoc.Add(pdfParagraph)
It looks like something is missing, but you probably just didn't include it in the code you posted. What you showed doesn't show you creating the paragraph, but you probably did.
There are so many variants out there around this subject, but you might try something like this:
Code:
paragraph.Font = font
paragraph.Add(content)
In other words, add the font in one step, then add the content in the next. I found things that suggest that what you are doing should work, but like I said, there seem to be loads of slightly different variants out there.
Dim pdfFont As BaseFont = BaseFont.CreateFont("c:\windows\fonts\Arial.ttf", BaseFont.IDENTITY_H, True)
Dim Ffont As New iTextSharp.text.Font(pdfFont, 8, iTextSharp.text.Font.NORMAL)
pdfParagraph.Font = Ffont
pdfParagraph.Add("Report by: Some text")
pdfDoc.Add(pdfParagraph)