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

Free Support Forum - aspose.com

CSS compatibility

Hi,

We are currently about to create a service in Java which runs a xslt stylesheet creating an HTML file with embedded CSS styles (in the head) and then starts the PDF converter . This runs nicely and quick, however, there is a really poor CSS support which seems to be more like CSS 1 from 20 years ago. No gradients, no flex, not even float, no negative margins, no @print nor @document support, no background pictures etc. If I open the html file in the browser everything looks fine.

Browsing around in this forum I found some statements that there would be at least a css2 support. So my question: am I doing something wrong? Is there a setting to enable an advanced CSS support or are there any tricks? Or is there an overview of supported css attributes?

Thanks,
Dirk

@dalex

Would you kindly share you sample source files along with sample code snippet that you are using to convert them into PDF. We will test the scenario in our environment and address it accordingly.

Sure, I attach a html file with embedded pictures (the original has just links). Please open it with a browser to see my expectations how it should look like.

test.zip (59.3 KB)

In the result we don’t get any background-pictures. If I replace the div’s with an img-tag the result shows up like this.

convertedDoc.pdf (164.7 KB)

Thanks for your investigations

Dirk

@dalex

It seems like you are using Aspose.Words for Java in your environment whereas this forum is related to Aspose.PDF. Would you kindly try to use Aspose.Words for Java 19.9 and share your feedback about the result it produces at your side.

Furthermore, we obtained attached output with Aspose.PDF for Java using following code snippet:

HtmlLoadOptions options = new HtmlLoadOptions();
options.getPageInfo().setMargin(new MarginInfo(0,0,0,0));
Document doc = new Document(dataDir + "test.html", options);
doc.save(dataDir + "HTMLtoPDF_19.9.pdf");

HTMLtoPDF_19.9.pdf (285.8 KB)

Right, I just went back from our Java developers. We implemented Words, and it was not obvious to me that both APIs use separated PDF engines. Sorry about. We will try 19.9. Thanks for your help.