I am having an issue using componentone in creating PDF's. When I create the PDF from a RTF file, alot of the paragraph on the right of the page will not be viewable as the created pdf has no vertical scroll as if theres no reason to scroll. Also the pdf will always be only 1 page. It always prints the first page only. My code is below if anyone can help...
<pre lang="vb">Dim pdf As New C1.C1Pdf.C1PdfDocument
Dim fs As System.IO.FileStream
Dim sreader As System.IO.StreamReader
Dim s As String
fs = New System.IO.FileStream(currentFile, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)
sreader = New StreamReader(fs)
s = sreader.ReadToEnd()
Dim txtFont As Font = RTB.Font
Dim txtH, txtW As Integer
Dim LMargin, TMargin As Integer
' Calculate the dimensions of the printable area of the page
With PrintDocument1.DefaultPageSettings
txtH = .PaperSize.Height - _
.Margins.Top - .Margins.Bottom
txtW = .PaperSize.Width - _
.Margins.Left - .Margins.Right
LMargin = PrintDocument1.DefaultPageSettings.Margins.Left
TMargin = PrintDocument1.DefaultPageSettings.Margins.Top
End With
'Dim rr As New RectangleF(1, 1, 1, 1)
Dim R As New RectangleF(LMargin, TMargin, txtW, txtH)
Dim rc As RectangleF = pdf.PageRectangle
' pdf.DrawRectangle(Pens.Blue, New Rectangle(LMargin, TMargin, txtW, txtH))
' rc.Inflate((-1 * txtH), (-1 * txtW))
pdf.DrawStringRtf(s, SystemFonts.DefaultFont, Brushes.Black, R)
SaveFileDialog1.Title = "Save PDF File"
SaveFileDialog1.DefaultExt = "pdf"
If OS = "XP" Then
SaveFileDialog1.Filter = "PDF Files (*.pdf)|*.pdf"
Else
SaveFileDialog1.Filter = "PDF Files|*.pdf"
End If
SaveFileDialog1.FilterIndex = 1
SaveFileDialog1.FileName = ""
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName = "" Then Exit Sub
If SaveFileDialog1.FileName = currentFile Then Exit Sub
If SaveFileDialog1.FileName = "SaveFileDialog1" Then Exit Sub
pdf.Save(SaveFileDialog1.FileName)