comprendre un code en ASP.NET
Bonjour :),
je débute avec ASP.NET et j'ai besoin de votre aide pour comprendre un code :
http://http://www.dotnetspark.com/kb...nt.aspx?id=654 ,
j'ai pas compris ou et comment placer le code :
j'ai crée un fichier itextsharp.aspx , et j'ai placé le code suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
01
Protected Sub btnGeneratePDF_Click(ByVal sender As Object, ByVal e As EventArgs)
02
'Create Document class obejct and set its size to letter and give space left, right, Top, Bottom Margin
03
Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)
04
Try
05
Dim wri As PdfWriter = PdfWriter.GetInstance(doc, New FileStream("c:\Test11.pdf", FileMode.Create))
06
'Open Document to write
07
doc.Open
08
09
'Write some content
10
Dim paragraph As New Paragraph("This is my first line using Paragraph.")
11
Dim pharse As New Phrase("This is my second line using Pharse.")
12
Dim chunk As New Chunk(" This is my third line using Chunk.")
13
' Now add the above created text using different class object to our pdf document
14
doc.Add(paragraph)
15
doc.Add(pharse)
16
doc.Add(chunk)
17
Catch dex As DocumentException
18
19
20
'Handle document exception
21
Catch ioex As IOException
22
'Handle IO exception
23
Catch ex As Exception
24
'Handle Other Exception
25
Finally
26
'Close document
27
doc.Close()
28
End Try
29
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 :
Citation:
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
Merci de votre aide :zoubi: