iTextSharp VB.NET更改段落

时间:2016-07-19 20:13:36

标签: vb.net itext

我正在学习iTextsharp,如果没有好的文档,那就太难了。

我想更改一个段落的字体

http://www.mikesdotnetting.com/Article/81/iTextSharp-Working-with-Fonts读取并尝试将代码移至VB.NEt

我有这个

Dim pdfDoc As New Document(PageSize.A4, 72.0F, 72.0F, 72.0F, 72.0F)
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream("c:\\PDFSample.pdf", FileMode.Create))

BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, false)
Font times = new Font(bfTimes, 12, Font.ITALIC, Color.RED)

pdfDoc.Open()
pdfDoc.Add(New Paragraph("This is normal text"))
pdfDoc.Add(New Paragraph("Now the text is times", times))
pdfDoc.Close()

但我收到了错误

  

' BASEFONT'是类类型,不能用作表达式

0 个答案:

没有答案