Quantcast
Viewing all articles
Browse latest Browse all 3131

Bold tag does not work when using HTML

Hello,

I am having a difficult time getting the bold tag to work as expected.  Here is a code snippet that should reproduce the problem.  I am taking an HTML string and passing it as a new segment.  From there, I am setting the Text class object to use Courier and font size 10.  The fonts are working as expected, but the html text inside the bold tags does not end up bold as expected.

            var document = new Pdf();

            var section = new Section();

            document.Sections.Add(section);

            var html = "<b>This text should be bold.</b>  This text is not bold.";

            var text = new Text();

            text.Segments.Add(new Segment(html));

            text.TextInfo.FontSize = 10;
            text.TextInfo.FontName = "Courier";

            text.IsHtmlTagSupported = true;
            text.UseTextInfoStyle = true;
            text.IfHtmlTagSupportedOverwriteHtmlFontNames = true;
            text.IfHtmlTagSupportedOverwriteHtmlFontSizes = true;

            section.Paragraphs.Add(text);

            document.Save(@"C:\test.pdf");

Viewing all articles
Browse latest Browse all 3131