Free Support Forum -

Background fill not repeating in nested tables

Hi. While converting HTML to PDF, there are instances where the tables in my code are nested and the cells have background fills, but the color fill gets removed automatically during PDF creation. Sharing a screenshot- the highlighted area in red bos is where the fill should have appeared but instead its appearing white.
Screenshot 2021-02-09 at 4.53.17 PM.png (113.5 KB)

Please let me know if there is a fix for it. FYI, its working fine on the webpage version.


Would you please share your sample HTML in .zip format with us along with the sample code snippet. We will test the scenario in our environment and address it accordingly.

Hi Asad, thanks for your response.
I’m attaching sample HTML with the table that is showing issue + (7.1 KB)


We checked the HTML file that you have shared. It did not include the Style Sheet link in the head tag. We modified it to refer the style to style.css and opened in a browser. There was no fill color in any table cell. Would you please share a HTML which has correct styles and those styles are not being rendered in output PDF? We will again test the scenario in our environment and address it accordingly.

renderedhtml.png (39.0 KB)

Hi Asad, here’s a screenshot of the table that I have created using same HTML. You can see the blue and grey fill in cells.
Screenshot 2021-02-19 at 12.00.06 PM.png (37.4 KB)

I’m including the zipped HTML again in the next comment with stylesheet linked in head this time, please check.

Attached zipped (7.9 KB)


We tested the scenario in our environment while using Aspose.PDF for .NET 21.2 and the following code snippet:

HtmlLoadOptions options = new HtmlLoadOptions(dataDir);
var htmlBody = File.ReadAllText(dataDir + "index.html");
var htmlByteArray = Encoding.UTF8.GetBytes(htmlBody);  // The default character encoding for HTML5 is UTF-8.
using (var stream = new MemoryStream(htmlByteArray))
 using (Document pdfDocument = new Document(stream, options))
  pdfDocument.Save(dataDir + "output.pdf");

We did not notice missing background colors in table cells in the output PDF. For your kind reference, an output PDF is also attached.

output.pdf (93.9 KB)

Would you please make sure to use the latest version of the API and let us know in case issue still persists.

Hi Asad, please see the screenshot- this is from the PDF that you have sent, the area that I have highlighted should have a grey fill as well but it’s not showing any background-color and that is precisely the issue.
Screenshot 2021-02-22 at 1.19.56 PM.png (56.4 KB)


We have logged an issue as PDFNET-49476 in our issue tracking system for this case. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.