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. Image for the cookie policy date

Getting Font size from RTF and casting the same size (metafile) in PDF Output

Hi. I am using the PDF functions. I trying to print the contents odf a RichBox. (text format only). I am casting to a metafile, but the font size is not as big as the font diaplyed in the RTF on the form... how do I make the output the same (or bigger) that what is displayed on the form.

Here is my basic code:

Dim text As String = txtScript.Text
        'reader.Close()

        'Convert it to metafile.
        Dim metafile As PdfMetafile = DirectCast(PdfImage.FromRtf(text, bounds.Width, PdfImageType.Metafile), PdfMetafile)
        Dim format As New PdfMetafileLayoutFormat()

        'Allow text to flow multiple pages without any break.
        format.SplitTextLines = True

        'Draws image.
        metafile.Draw(page, 0, 0, format)

        'Save the document.
        doc.Save("Output.pdf")
        doc.Close(True)

1 Reply

KC Karthikeyan Chandrasekar Syncfusion Team March 22, 2019 12:35 PM UTC

Hi Frank, 
Greetings from Syncfusion. 
We have tried the sample with the provided code snippet and the font size is preserved properly as like in the RTF file. Please find the below sample which we have tried in our end, 
 
 
Kindly provide the RTF file which you have used, it will be helpful for us to provide the precise solution on this. 
 
Regards, 
Karthikeyan  


Loader.
Up arrow icon