We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML (SVG tag) to PDF, not rendering as expected

Attached is a simple program with a HTML file in resources folder where a style tag is specified with all the CSS used for the html. The html itself is a simple file with just a chart created using svg tag. When you run the program you will see the generated PDF does not look like the HTML opened in the browser. The fonts, background etc are not applied.

Please investigate and let me know what’s missing in the code. I wasn’t able to find an answer for the same.


aspose-pdf-basic.zip (87.6 KB)

We managed to replicate the issues as below:

PDFNET-43317: HTML to PDF - incorrect background color of the horizontal linear graph
PDFNET-43318: HTML to PDF - the text line is displaced

We have linked your post to these tickets and will keep you informed regarding any available updates.

Thanks for creating the ticket. How would I know the detailed status of the ticket? When is the expected resolution date?

I have a couple of follow up questions:

  1. It also looks like the fonts and similar styling is not applied for the chart, do you have a separate ticket to address that issue?
  2. Also, can we use a css file to set styles for the tag or are we supposed to use inline?


You can ask for the detailed status in this forum thread and normally we keep our clients up to date. We have just identified and logged tickets in the issue tracking system and our product team will schedule logged tickets as per the development schedule. Once the analysis phase is completed, then we would be able to share estimates.

We have logged this issue under the ticket ID PDFNET-43325 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

The CSS files are supported and you can pass a base path parameter in the HtmlLoadOptions class constructor. Please try the following code:


// Specify the The base path/url for the html file which serves as images database
String basePath = "C:/temp/";
HtmlLoadOptions htmloptions = new HtmlLoadOptions(basePath);
// Load HTML file
Document doc = new Document("input.html", htmloptions);
// Save HTML file
1 Like