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

PdfHTMLTextElement not rendering style

Thread ID:

Created:

Updated:

Platform:

Replies:

131720 Jul 25,2017 03:45 AM Jul 26,2017 07:48 AM ASP.NET Web Forms 1
loading
Tags: PDF
Vincent Dupin
Asked On July 25, 2017 03:45 AM

Hi, 

I'm evaluating the htmltopdf functionality. 
I've got a string with a style tag containing a color and text-align attribute 

PdfHTMLTextElement texthtml = new PdfHTMLTextElement();
texthtml.HTMLText = "<p style=\"color: red;text-align: left\">This is a red text align left</p>";                                                              
PdfLayoutResult res = texthtml.Draw(currentPdfPage, new Rectangle(20, 20, page.GetClientSize().with, page.GetClientSize().Height), new PdfMetafileLayoutFormat { Break = PdfLayoutBreakType.FitPage, Layout = PdfLayoutType.OnePage });

From this ressource Working with Text, PdfHTMLTextElement support for a basic HTML tags but not the style tag. 
Is there any way to render the text-align property with a PdfHTMLTextElement  ?

thanks,



Prakash Viswanathan [Syncfusion]
Replied On July 26, 2017 07:48 AM

Hi Vincent, 
 
Thanks for contacting Syncfusion support. 
 
The PdfHTMLTextElement class provides only basic set of HTML tags to render in the PDF document. HTML with CSS are not supported in this class, so we could not align the text using PdfHTMLTextElement class. To convert complex HTML, HTML with CSS and URL to PDF, we suggest you to try our WebKit HTML converter. Please refer below links for more information of our WebKit HTML converter, 
 
Please let us know if you need any further assistance on this. 
 
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.

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.

;