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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





143481 Mar 21,2019 06:25 PM UTC Mar 22,2019 12:35 PM UTC WinForms 1
Tags: PDF
Asked On March 21, 2019 06:25 PM UTC

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

        '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.

Karthikeyan Chandrasekar [Syncfusion]
Replied On 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. 


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon