Hello,
Thank you for the quick response. I did find a work around but I don’t think it is exactly a fix. I compared a few of the tables that were not rendering, each one would throw that exception. When stepping through my code and stopping at the breakpoint that captures my web page’s html, I noticed that the XML view of that string is breaking at the same point for each, the max-width attribute. When the data grids are generated on our application’s side, for some reason they are generated with a tfoot element and each of those has a style of max-width:0; I have removed these from the string and the html document is now being rendered as a pdf and saving correctly. I’m not sure if this will help much but from my end it seems like the pdf rendering functionality does not like that attribute for some reason. Here is a clip of my source code for reference:
// Using WebClient, get the html of the Url.
string html;
using (WebClient client = new WebClient())
{
client.UseDefaultCredentials = true;
html = client.DownloadString(currentUrl).Replace(“max-width:0;”, “max-width:none;”);
}
// Configure the Aspose PDF rendering options.
renderOptions = GetPdfRenderOptions(1500, 1500);
// Instantiate PdfDevice object while passing PdfRenderingOptions and resultant file path as arguments
using (Aspose.Html.Rendering.Pdf.PdfDevice pdf_device = new Aspose.Html.Rendering.Pdf.PdfDevice(renderOptions, fileName))
{
// Create HtmlRenderer object
using (Aspose.Html.Rendering.HtmlRenderer renderer = new Aspose.Html.Rendering.HtmlRenderer())
{
// Create Aspose HTML document object from generated URL of grid.
using (Aspose.Html.HTMLDocument htmlDoc = new Aspose.Html.HTMLDocument(html, currentUrl))
{
// Render to PDF device, saving the PDF to file for PNG conversion.
renderer.Render(pdf_device, htmlDoc);
}
}
}
Thank you,
Zachary