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

Free Support Forum - aspose.com

Convert HTML string to PDF using Aspose PDF for .NET - Set background image in CSS

Hi team,
Is there any way to convert HTML string into PDF file?
And most importantly can we apply a background image to PDF page while converting HTML file/ contents into PDF file?
I am using HTML string with CSS where I am applying background image for div through CSS(background-image: URL());, But this is not working when I am converting this HTML to PDF using Aspose PDF for .NET
Can somebody help with this?


Thanks for contacting support.

You can surely convert HTML String to PDF using Aspose.PDF for .NET and in case you want to set background image through CSS property, you can specify HtmlLoadOptions of HtmlFragment as following:

htmlFragment.HtmlLoadOptions = new HtmlLoadOptions("{Path to Picture/complete Base URL}");

In case you still face any issue, please share your sample HTML string along with the image with us. We will test the scenario in our environment and address it accordingly.