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
| Imports System
Imports System.IO
Imports iTextSharp
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Public Class clsPrint
Private nouveauDocument As Document
Private Tableau As PdfPTable
Private celulle As PdfPCell
Public Sub New()
nouveauDocument = New Document
End Sub
Public Sub Impression()
Dim Ligne As Phrase
Dim Typ As iTextSharp.text.Font
Dim Para As Paragraph
Dim monChuck As Chunk
Try
PdfWriter.GetInstance(nouveauDocument, New FileStream("fichier.pdf", FileMode.Create))
nouveauDocument.Open()
'Typ = New iTextSharp.text.Font(Font.
'Ligne = New Phrase("bonjour", )
monChuck = New Chunk("TITRE", FontFactory.GetFont(FontFactory.COURIER, 20, Font.ITALIC))
'nouveauDocument.Add(New Phrase("hello word"))
Tableau = New PdfPTable(1)
Para = New Paragraph(1, monChuck)
Para.Alignment = Element.ALIGN_RIGHT
celulle = New PdfPCell(Para)
celulle.Colspan = 1
Tableau.AddCell(celulle)
nouveauDocument.Add(Tableau)
nouveauDocument.Close()
Catch ex As DocumentException
Console.WriteLine("error " + ex.Message)
nouveauDocument.Close()
Catch e As System.IO.IOException
Console.WriteLine("error " + e.Message)
nouveauDocument.Close()
End Try
End Sub
End Class |
Partager