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: June 24, 2019).
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 Jul 1,2020 02:36 PM UTC WinForms 5
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 


Laz
Replied On June 27, 2020 06:52 AM UTC

I had the same issue...tried various combinations, didn't think to try <br/>, since that is non-standard syntax. The standard syntax would be: HTML:<br>XHTML:<br />.

I wish Syncfusion's PDF component were maintained, because oddities like this make it very cumbersome and un-intuitive to use. This is a basic problem that (1) should be well-documented on the relevant pages, specifically: 


and 


And (2) the parser should accept the official xhtml tag, which is <br /> and ideally the standard html tag, which is <br>.

Instead the developer is left scratching his head and wasting time unnecessarily on a simple problem. I myself stumbled upon this solution by accident while browsing the forum trying to figure out another problem, after I gave up on finding a solution days ago.

Sowmiya Loganathan [Syncfusion]
Replied On June 29, 2020 12:41 PM UTC

Hi László,  

We have analyzed your requirement and currently we are validating on this and will update the further details on July 01, 2020.  

Regards, 
Sowmiya Loganathan 
 


Ravikumar Baladhandapani [Syncfusion]
Replied On July 1, 2020 02:36 PM UTC

Hi László,  
 
We have confirmed that the issue with “Change the standard break tags in HTML which contain space while adding styled text in PDF” is a defect. We will include this fix in upcoming weekly nuget release and which will be expected available on July 14th ,  2020. 
 
Please find the feedback link from below,       
 
Regards, 
Ravikumar. 


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

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