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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PdfHTMLTextElement and breaks <br />

Thread ID:

Created:

Updated:

Platform:

Replies:

129826 Apr 5,2017 11:06 AM UTC Apr 6,2017 09:12 AM UTC WinForms 2
loading
Tags: PDF
M Angent
Asked On April 5, 2017 11:06 AM UTC

Hi,

I try to use breaks in some html text in a PdfHTMLTextElement. But they do not seem to work. I do not get any errors either. I used the example on on https://help.syncfusion.com/file-formats/pdf/working-with-text#adding-a-html-styled-text

According to the help page a BR is a supported tag.

I added some breaks to the example. But the do not show in the generated PDF:

//Simple HTML content

string htmlText = @"<font color='#0000F8'>Essential<br /><br />PDF</font> is<br /><br /> a <u><i>.NET</i></u><br /><br /> " +

"library <br /><br /> with the capability to <br /><br /> produce Adobe PDF files ";

M Angent
Replied On April 6, 2017 07:37 AM UTC

To answer my own Question. BR does not seem to work. Replacing the BR tags for 'Environment.NewLine', or '\r\n' does seem to work.

   string htmlText = "<font color='#0000F8'>Essenntial\r\n\r\nPDF</font> is" + Environment.NewLine + Environment.NewLine + " a <u><i>.NET</i></u>" + Environment.NewLine + Environment.NewLine + " " +

            "library " + Environment.NewLine + Environment.NewLine + " with the capability to " + Environment.NewLine + Environment.NewLine + " produce Adobe PDF files ";


Prakash Viswanathan [Syncfusion]
Replied On April 6, 2017 09:12 AM UTC

Hi Angent, 
 
Thanks for contacting Syncfusion support. 
 
On our analyze with the HTML document, the break tags contain spaces in between, so that our converter could not recognize the breaks. We suggest you to remove the spaces in the break tag (<br/>) then it will work fine. We have attached the output document for your reference. 
 
Please try the below modified HTML text and let us know the result. 
//Simple HTML content 
 
string htmlText = @"<font color='#0000F8'>Essential<br/><br/>PDF</font> is<br/><br/> a <u><i>.NET</i></u><br/><br/> " + 
 
"library <br/><br/> with the capability to <br/><br/> produce Adobe PDF files "; 
 
 
Regards, 
Prakash V 


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.

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

;