We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Wrong wrapping table-cell in a RTF

Thread ID:

Created:

Updated:

Platform:

Replies:

140822 Nov 8,2018 09:34 AM UTC Nov 9,2018 11:26 AM UTC WinForms 1
loading
Tags: PDF
Carlos Gimenez Guerrero
Asked On November 8, 2018 09:34 AM UTC

Dear Sir or Madam,

We develop an winform software and we need to generate a pdf report with different sections. One of them came from a RTF text, that it has previosly loaded from a RichEditControl.

we use a exaple code, it works for almost all cases, but it does not work when we want to print a table with a large cell text (from RTF).
When we have a many-line cell in a table, the text does not wrap properly and the border is from a single line cell (it attach text out site of the cell).
I have tried to find a solution to this bug but I have not find solution as long as all code is behind syncfusion libraries.


Our code is
 
Private Shared Sub PintarLinea(doc As PdfDocument, ByRef pointY As Integer, texto As String)             
      Dim page As PdfPage = doc.Pages(doc.Pages.Count - 1)
      Dim bounds As SizeF = page.GetClientSize()
      Dim metafile As PdfMetafile = DirectCast(PdfImage.FromRtf(texto, bounds.Width - 30, PdfImageType.Metafile), PdfMetafile)
      Dim format As New PdfMetafileLayoutFormat()
 
      IncrementarPointY(metafile.Draw(page, 30, pointY, format), doc, pointY)
end Sub


Private Shared Sub IncrementarPointY(ByRef layout As PdfLayoutResult, doc As PdfDocument, ByRef pointY As Integer)
        If (layout.Bounds.Bottom > 710) Then
            doc.Pages.Add()
            pointY = 20.0F
        Else
            pointY = layout.Bounds.Bottom + 20.0F
        End If
  End Sub

The RTF text in this case is:


I attach a zip file with the right table (docx) and how it is show (PDF).

Please, let me know if you need more information about it.

Yours sincerely,


Attachment: TableRTF_4f776c46.zip

KarthikeyanC [Syncfusion]
Replied On November 9, 2018 11:26 AM UTC

Hi Carlos,
Thank you for contacting Syncfusion support.
Essential PDF has native support for converting RTF to PDF and it has some limitation with wrapping text. We suggest to use RTF file to PDF conversion using essential DocIO.

Kindly refer the below KB to convert the RTF to PDF.
RTF to PDF: https://www.syncfusion.com/kb/2631/how-to-convert-rtf-file-to-pdf-using-essential-docio

In order to wrap the text in PDF, please specifies the width parameter of PdfImage.FromRtf method. (i.e. PdfImage.FromRtf(“text”,width, PdfImageType.Metafile)). In PDF the text will preserved as like the metafile image.

Please try our suggestion and let us know if you need further assistance in this.
Regards,
Karthikeyan


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;