I have HTML text including css style classes inside <style></style> tag in HTML text but it's not applied to HTML text how can i apply css class to HTML text.
How to apply CSS class inside HTML text to HTML data
Re: How to apply CSS class inside HTML text to HTML data
Support · Feb 26, 2014Hello,
Can you please let us know what DynamicPDF product you are using? Also tell us how you are adding HTML text to PDF. This information will help us to look into it further.
Thanks,
ceTe Software Support Team.
Re: How to apply CSS class inside HTML text to HTML data
Forum member · Mar 2, 2014am using DynamicPDF Generator for .net version 7
use FormattedTextArea class
ceTe.DynamicPDF.PageElements.FormattedTextArea formattedtext = new ceTe.DynamicPDF.PageElements.FormattedTextArea(HTMLtext(), 6, 0, 510, pageDimensions.Height, style);
public string HTMLtext()
{
return "HTML text";
}
Re: How to apply CSS class inside HTML text to HTML data
Forum member · Mar 2, 2014HTML text is below
<p style="page-break-before: always" />
<hr style="color:#F3F3F3;width:490px;"/>
<strong style="font-size:11px;">Calendar Summary</strong>
<hr style="color:#F3F3F3;width:490px;"/>
<style xmlns:fo="http://www.w3.org/1999/XSL/Format">
tr.boldWithBorderTop td {font-weight:bold; border-top:2px solid black;}
tr.boldWithBorderTopAndBottom td {font-weight:bold; border-bottom:2px solid black; border-top:1px solid black;}
tr.headerRow td {font-weight:bold; border-top:2px solid black; border-bottom:1px solid black;}
tr.percentRow td {font-style:italic;}
td.separatorColumn {border-right:1px solid black;}
</style>
<table style="font-size:10px;width:650px;" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<tr class="headerRow">
<td>Country</td>
<td>State</td>
<td class="separatorColumn">Locality</td>
<td>Date From</td>
<td>Date To</td>
<td>Work</td>
<td>Non-Work</td>
<td>Sick Day</td>
<td>Vacation</td>
<td>National Holiday</td>
<td>Training</td>
<td>Total</td>
</tr>
<tr>
<td>United States</td>
<td> </td>
<td class="separatorColumn"> </td>
<td>01-Jan-2013</td>
<td>31-Dec-2013</td>
<td>365</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>365</td>
</tr>
<tr class="boldWithBorderTopAndBottom">
<td>Totals</td>
<td> </td>
<td class="separatorColumn"> </td>
<td> </td>
<td> </td>
<td>365</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>365</td>
</tr>
<tr>
<td> </td>
</tr>
<tr class="percentRow">
<td>Percentage</td>
<td />
<td />
<td />
<td />
<td>
100%
</td>
<td>
0%
</td>
<td>
0%
</td>
<td>
0%
</td>
<td>
0%
</td>
<td>
0%
</td>
<td>100%</td>
</tr>
</table><br />
Re: How to apply CSS class inside HTML text to HTML data
Support · Mar 3, 2014Hello,
The DynamicPDF Generator for .NET API does not supports adding css to HTML text using FormattedTextArea page element. The FormattedTextArea ignores unsupported HTML/CSS tags while adding the text to the PDF. You can refer to the documentation on supported HTML tags here
.
We have another product called DynamicPDF Converter for .NET which supports converting HTML which uses styles (CSS) and other supported file types to PDF. Please refer to the documentation on ConvertHtmlString method of Converter class here
. If you would like to try DynamicPDF Converter then you can download evaluation edition from our website here
. Also you can refer to the code samples included with the evaluation download.
Thanks,
ceTe Software Support Team.