Group,
I'm converting a text file into a .pdf file using ItextSharp. The code below works perfectly to do this. Unfortunately the default font size is to large. I need to make it smaller. Here's my code:
Private Sub ConvertToPDF()
' Converting the Restran text file to a PDF file
Dim row As Integer
Dim lineEnd As String
Dim txtLine As String
saveRestran = hotelFolder & "\Restran\" & propertyNo & "Restran.txt"
Dim newPDFName As String = hotelFolder & "\Restran\" & yearFolder & "\" & propertyNo & " - Restran " & formDate & ".pdf"
Dim restranFile As String = hotelFolder & "\Restran\" & propertyNo & "Restran.txt"
Dim restranText As String = File.ReadAllText(restranFile)
Dim pdfDoc As New Document()
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream(newPDFName, FileMode.Create))
Dim objReader As New System.IO.StreamReader(saveRestran)
If System.IO.File.Exists(saveRestran) Then
row = 1
Do While objReader.Peek() <> -1
txtLine = objReader.ReadLine()
lineEnd = Trim(txtLine)
pdfDoc.Open()
pdfDoc.Add(New Paragraph(txtLine))
row = row + 1
If row = 61 Then
pdfDoc.NewPage()
row = 1
End If
If lineEnd = "End of Report" Then
pdfDoc.Close()
objReader.Close()
Exit Sub
End If
Loop
pdfDoc.Close()
End If
End Sub
I've read multiple sites to find the appropriate VB.net code to change the font/font size. Every different code I've tried gives me an error. If you've got some thoughts, I would appreciate the help.
FYI.... I'm using Visual Studio 2010 (visual basic).
Thanks,
Don