文档无法转换为iTextSharp.text.Document



所以我在代码项目中看到了这个教程http://www.codeproject.com/Articles/20640/Creating-PDF-Documents-in-ASP-NET.我在我的网络项目中使用了itextsharp

  Dim doc As Document = New Document
     PdfWriter.GetInstance(doc, New FileStream("C:UsersPCDesktop" + _
                                 "1.pdf", FileMode.Create))
            doc.Open()
            doc.Add(New Paragraph("Hello World"))
            doc.Close()
            Response.Redirect("~/1.pdf")

使用此语法时,我会出现错误,即"myProjectName.Document"无法转换为"iTextSharp.text.Documents"以及打开、添加、关闭不是"myProjectName:Document"的成员

我目前的框架是3.5。我已经下载了示例项目,它是框架2.0,但当我把它改为3.5时仍然可以运行,

我的问题有什么解决办法吗?

看起来您的Document来自其他命名空间,请尝试显式指定命名空间:

dim doc as iTextSharp.text.Document = new iTextSharp.text.Document()  'may need parameters to constructor

相关内容

最新更新