Halimbawa Dokumento
Halimbawa Dokumento

Reputation: 105

Document cannot be converted into iTextSharp.text.Document

So I saw this tutorial in codeproject http://www.codeproject.com/Articles/20640/Creating-PDF-Documents-in-ASP-NET. I used the itextsharp in my web project

  Dim doc As Document = New Document
     PdfWriter.GetInstance(doc, New FileStream("C:\Users\PC\Desktop" + _
                                 "\1.pdf", FileMode.Create))

            doc.Open()
            doc.Add(New Paragraph("Hello World"))
            doc.Close()
            Response.Redirect("~/1.pdf")

with this syntax I get errors that 'myProjectName.Document' cannot be converted to 'iTextSharp.text.Document'and open, add ,close is not a member of 'myProjectName.Document'

My current framework is 3.5 . I have downloaded the sample project it was framework 2.0 but can still run when I changed it to 3.5,

Any workaround with my problem?

Upvotes: 0

Views: 968

Answers (1)

BlackICE
BlackICE

Reputation: 8926

Looks like your Document is coming from some other namespace, try specifying the namespace explicitly:

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

Upvotes: 1

Related Questions