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

Free Support Forum - aspose.com

Question for size base

When importing and converting HTML to other document types, if an object has a size, either width, or height, and px, pt, in, % is not defined, what is the default?

what is the default measurement for 460?


Thank you for contacting support.

Would you please explain which Aspose API are you using in your environment to convert the HTML file to other file format. Please also specify the output file format for our reference. Moreover, Aspose APIs render the HTML file to other formats as it is displayed by a browser. Furthermore, kindly note that the basic measuring unit in Aspose APIs is point, where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points.

I am using Words .NET 17.9. When I convert HTML to .docx, or .pdf the html does not have the unit defined in some places.

<IMG src='imagesorce.com/123456.jpg' width='480'>

notice the width of 480 has no unit defined (px,pt, em…) what is the default when importing html to words .net?


Thanks for your inquiry. Most of the object properties provided in the Aspose.Words API that represent some measurement (width/height, margins and various distances) accept values in points (1 inch equals 72 points). You can check it using following code example.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertHtml("<img src='image.png' width='480' height='480'>");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
Console.WriteLine(shape.Width); // returns 360
Console.WriteLine(ConvertUtil.PointToPixel(shape.Width)); // returns 480

Moreover, we suggest you please read following article.
How to Convert Between Measurement Units