Formatted TextArea html

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v3 and older)  /  Formatted TextArea html

DynamicPDF Generator for .NET (v3 and older) Forum

 Jan 23 2013 6:56 AM
I have a text like so: <p><b>lalala</b>blaaaa</p><p>more text</p>(large chunk of html text).

the formatted text area shows tags. instead of rendering it properly.
I realize it is possible to set the textarea to bold etc. programmatically, but I need it to render the text differently depending on what tag it encounters in the large chunk of text.
 Jan 23 2013 7:29 AM
A correction to my previous post my html actually shows like this.
"<p><span style=\"text-decoration: underline;\"><strong>æklsjgfhnræunjrfgæoiurgnjwrse</strong></span></p> "
could this be the issue?
 Jan 23 2013 7:30 AM
Posted by a ceTe Software moderator
Hello,

The version 3 DynamicPDF Generator for .NET product supports some limited number of HTML tags and you can add HTML text using these supported HTML tags. Please refer documentation on supported HTML tags by our HtmlTextArea here.

If you are working with the TextArea page element then you can set only one font to the whole text within the TextArea. It is not possible to set different styles for substring within TextArea page element using our DynamicPDF Generator for .NET product.

Thanks,
ceTe Software Support Team.
 Jan 28 2013 8:13 AM
According to the description of the formattedTextArea here: http://www.dynamicpdf.com/Support/NET_Help_Library/html/ceTeDynamicPDFPageElementsHtmlTextArea.htm
this clearly indicates that I should be able to render text that appears like this: <p><b>bold</b></p><p><b><i>bold and italic</i></b></p>
 Jan 28 2013 8:46 AM
Posted by a ceTe Software moderator
Hello,

In order to add the text with bold and bold italic style you will need to build respective font objects using bold and bold italic fonts then you will need to create FontFamily object  using the font objects and add it to the FontFaces of the HtmlTextArea. Below is the sample code for it.

            Document document = new Document();
            Page page = new Page();
            //Building font objects and FontFamily object.
            TrueTypeFont verdanaRegularFont = new TrueTypeFont("verdana.TTF");
            TrueTypeFont verdanaBoldFont = new TrueTypeFont("verdanab.TTF");
            TrueTypeFont verdanaBoldItalicFont = new TrueTypeFont("verdanaz.TTF");
            TrueTypeFont verdanaItalicFont = new TrueTypeFont("verdanai.TTF");
            FontFamily verdanaFontFamily = new FontFamily("VerdanaFontFamily", verdanaRegularFont, verdanaBoldFont, verdanaItalicFont, verdanaBoldItalicFont);
            string text = "<p><b>bold</b></p><p><b><i>bold and italic</i></b></p>";
            HtmlTextArea htmlTextArea = new HtmlTextArea(text, 100, 100, 300, 200, verdanaFontFamily, 12, true);
            htmlTextArea.FontFaces.Add(verdanaFontFamily);
            page.Elements.Add(htmlTextArea);
            document.Pages.Add(page);
            document.Draw(@"C:\MyDocument_v3.pdf");

Thanks,
ceTe Software Support Team.
 Jan 28 2013 9:37 AM
This is perfect! thank you very much

All times are US Eastern Standard time. The time now is 7:10 AM.