Possible bug located pasting word to a text fragment for PDF

Here is the C# and HTML copied from Word and pasted over for rendering in PDF which caused a failure. The HTML would render in PDF once the nested font tags, being direct children of an un-ordered list element, were removed

Granted that’s not properly formatted HTML but when copying from Word over to PDF there should be some Word Format Scrubbing involved somehow. The code should survive this.
C#
public void TestHTMLFail(Page page) {
var testFail = (html from the first paragraph tag to the closing unorderedlist tag here. It will render if I paste it)
AddLineHtml(page, testFail, false);
}

Add Line HTML Method
protected static void AddLineHtml(Page page, string text, bool addSpace = true, int fontSize = 11)
{
var fragment = GetHtmlFragment(text);
SetSize(fragment, fontSize);
page.Paragraphs.Add(fragment);
if (addSpace) page.Paragraphs.Add(SetSize(new TextFragment { Text = “” }, 10));
}

HTML

<p>
    <br>
</p>
<p>
    <span>
        The existing structure was built in 1953 and is a 5 span, steel truss structure with a total length of 828 feet and a bridge deck width of 26 feet.
        <span>&nbsp; </span>
        The existing structure has a reinforced concrete deck for four spans and an asphalt wearing course over steel decking for the swing span.
        <span>&nbsp; </span>
        The existing piers are stone with concrete caps while the existing abutments are concrete.
    </span>
</p>
<p>
    <span>
        Previous structures at this location, included: a covered bridge (1875), rebuilt after flood damage (1884) and, swing span (added in 1896);
        and a Pratt truss with swing span after the 1913 flood. These bridges featured the extant stone piers and concrete pivot pier.
        The original stone piers and concrete pivot pier were modified in 1953 by the addition of caps which raised the height of the bridge. In summary, remnants of the 1875 covered bridge (stone piers)
        and remnants of the 1896 and 1913 swing spans (concrete pivot) were incorporated into the 1953 bridge design. The 1953 bridge featured new deck, trusses, mechanicals and swing span.
    </span>
</p>
<p>
    <span>
        <span>
            <span>
                <font>
                    <span>
                    </span>
                </font>
            </span>
        </span>
    </span>
</p>
<ul>
    <font>
    </font>
    <li>
        <font>
        </font>
        <div>
            <font>
                <span>
                </span>
                <span>
                    Detailed information regarding existing bridge conditions can be found in the Feasibility Study (E. L. Robinson; January 2016) located in the project file under
                    <i>Alternatives/Reports</i>
                </span>
            </font>
        </div>
    </li>
</ul>

@Ohio_Mike,

Thanks for contacting support.

In order to test the scenario, I have placed above shared HTML content in .html file, loaded the contents of html file to HtmlFragment object, then have added it to paragraphs collection of Page instance and as per my observations, the PDF file contains similar contents as they appear in web browser. For your reference, I have also attached the output file generated over my end. Please take a look over HTML_PDF_Preview.PNG (127.6 KB), ConvertedFile.pdf (84.4 KB)

Please note that for testing purposes, I have used Aspose.Pdf for .NET 17.6 in VisualStudio 2010 running over Windows 7 (x64). Can you please try using latest release and in case you still face any issue, please share a sample project, so that we can again try replicating the issue in our environment. We are sorry for this inconvenience.

[C#]

// Read the source HTML file
TextReader tr = new StreamReader("c:/pdftest/sourcehtml.html");

// Instantiate Document object
Document doc = new Document();
// Add a page to pages collection of PDF file
Page page = doc.Pages.Add();
// Instantiate HtmlFragment with HTML contnets
HtmlFragment titel = new HtmlFragment(tr.ReadToEnd());
// Set bottom margin information. Optional
titel.Margin.Bottom = 10;
// Set top margin information. Optional
titel.Margin.Top = 200;
// Add HTML Fragment to paragraphs collection of page
page.Paragraphs.Add(titel);

// Save PDF file
doc.Save("c:/pdftest/ConvertedFile.pdf");