Click here to Skip to main content
15,907,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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)


Posted
Comments
Fabio V Silva 16-Apr-11 17:25pm    
If it is a problem with a 3rd party component I would first ask in their forums if I was you...

1 solution

Did you tried looking here:
Knowledgebase documneted[^]
ComponentOne Support Forum[^]
ComponentOne Cummunity Forum[^]

Posting here is fine. Might be someone can help but I had found that specific questions related to 3rd party is answered more quickly and accurately at respective forums.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900