Free Support Forum - aspose.com

Html to pdf conversion using Aspose.pdf

I have a trial version of the latest Aspose.pdf and am trying to convert an html to pdf.

The formatting does not seem to be retained at all. Even the text does not come up. If the html is a std one with no styling, then it seems to work. I AM ATTACHING THE HTML FILE in a zip.

I am using the following code

string file = @"d:/temp/default.html";

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

pdf1.BindHTML(File.ReadAllText(file));

pdf1.Save(@"D:\temp\deafult.pdf");

We are looking to buy this product, so please let me know if converting html to pdf will work with styling and images.

i just tried it to

doesn’t works

Hi Kulsum,


Thanks for using our products and sorry for the delayed response.

I have gone through the HTML file which you have shared and as per my observations, it contains a huge amount of JavaScript. Please note that Aspose.Pdf for .NET only supports simple HTML and CSS styles and JavaScript cannot be executed when converting HTML file to PDF format. Can you please again try using a bit simple version of HTML file and in case you still face the similar issue, please feel free to contact. We are really sorry for this inconvenience.
medec:
i just tried it to
doesn't works
Hi,
Can you please share the HTML file which you are trying to convert and facing this problem, so that we can test the scenario at our end. We are really sorry for this inconvenience.