我这样做了:
Imports iTextSharp.text.rtf
然后这个:
Dim grx As graphic = New graphic
在第一个“图形”上,我得到了一个“预期类型”
图形是 iTextSharp.text.rtf 的成员
这是周围的代码:
Public Sub New1()
Console.WriteLine("Chapter 4 example 4: Simple Graphic")
Dim document As Document = New Document
Try
PdfWriter.GetInstance(document, New FileStream("Chap0404.pdf", FileMode.Create))
document.Open()
Dim grx As graphic = New graphic
grx.Rectangle(100, 700, 100, 100)
grx.MoveTo(100, 700)
grx.LineTo(200, 800)
grx.Stroke()
document.Add(grx)
Catch de As DocumentException
Console.Error.WriteLine(de.Message)
Catch ioe As IOException
Console.Error.WriteLine(ioe.Message)
End Try
document.Close()
End Sub
这是整个教程:(抱歉,它不是教程,但他们就是这么称呼的)
Imports System
Imports System.IO
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Namespace iTextSharp.tutorial.Chap04
Public Class Chap0404
Public Sub New()
Console.WriteLine("Chapter 4 example 4: Simple Graphic")
Dim document As Document = New Document
Try
PdfWriter.GetInstance(document, New FileStream("Chap0404.pdf", FileMode.Create))
document.Open
Dim grx As Graphic = New Graphic
grx.Rectangle(100, 700, 100, 100)
grx.MoveTo(100, 700)
grx.LineTo(200, 800)
grx.Stroke
document.Add(grx)
Catch de As DocumentException
Console.Error.WriteLine(de.Message)
Catch ioe As IOException
Console.Error.WriteLine(ioe.Message)
End Try
document.Close
End Sub
End Class
结束命名空间