Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

h2 / h3 tags not working? But they are supported....

$
0
0
I have a very simple test html that i want to convert to pdf. I made a small test program to test this but i ran into a problem. Code:

var content = @"<!DOCTYPE html>
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <h1>Title here 1</h1>
        <p>
            Some content here...
        </p>
        <h2>Title here 2</h2>
        <p>
            Some content here...
        </p>
        <h3>Title here 3</h3>
        <p>
            Some content here...
        </p>
    </body>
</html>
";

            var pdf = new Pdf();
            pdf.HtmlInfo.BadHtmlHandlingStrategy = BadHtmlHandlingStrategy.ThrowException;
            pdf.HtmlInfo.ShowUnknownHtmlTagsAsText = true;

            var section = pdf.Sections.Add();

            var html = new Text(content);
            html.IsHtmlTagSupported = true;
            section.Paragraphs.Add(html);

            pdf.Save("D:\\temp\\tmp.pdf");
            
            System.Diagnostics.Process.Start("D:\\temp\\tmp.pdf");

The rendered output shows the h2 and h3 tags as text. They are on the supported list (and should be :)) but they are not recognized. Am i doing something wrong? I am using 9.1.0 trial version.

Viewing all articles
Browse latest Browse all 3131

Trending Articles