j'ai crée un fichier itextsharp.aspx , et j'ai placé le code suivant :
Protected Sub btnGeneratePDF_Click(ByVal sender As Object, ByVal e As EventArgs)
'Create Document class obejct and set its size to letter and give space left, right, Top, Bottom Margin
Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)
Try
Dim wri As PdfWriter = PdfWriter.GetInstance(doc, New FileStream("c:\Test11.pdf", FileMode.Create))
'Open Document to write
doc.Open
'Write some content
Dim paragraph As New Paragraph("This is my first line using Paragraph.")
Dim pharse As New Phrase("This is my second line using Pharse.")
Dim chunk As New Chunk(" This is my third line using Chunk.")
' Now add the above created text using different class object to our pdf document
doc.Add(paragraph)
doc.Add(pharse)
doc.Add(chunk)
Catch dex As DocumentException
'Handle document exception
Catch ioex As IOException
'Handle IO exception
Catch ex As Exception
'Handle Other Exception
Finally
'Close document
doc.Close()
End Try
End Sub
j'ai téléchargé itextsharp.dll et je l'ai placé dans le même répertoire de itextsharp.aspx , lorsque j'exécute itextsharp.aspx j'ai ceci :
Message d'erreur du compilateur: BC30002: Type 'Document' is not defined.
Erreur source:
Ligne 3 : Protected Sub btnGeneratePDF_Click(ByVal sender As Object, ByVal e As EventArgs)
Ligne 4 :
Ligne 5 : Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)
Ligne 6 :
Ligne 7 : Try
Fichier source: c:\inetpub\wwwroot\ing2010\ing_scripts\fr\itextsharp.aspx Ligne: 5