Thanks for your inquiry. I would suggest you please upgrade to the latest version (v13.5.0) from here and use following code snippet to resize large images.
Document doc = new Document(MyDir + "test.html");
foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true))
doc.Save(MyDir + "out.pdf");
public static void ResizeLargeImage(Shape image)
// Return if this shape is not an image.
// Calculate the free space based on an inline or floating image. If inline we must take the page margins into account.
PageSetup ps = image.ParentParagraph.ParentSection.PageSetup;
double freePageWidth = image.IsInline ? ps.PageWidth - ps.LeftMargin - ps.RightMargin : ps.PageWidth;
double freePageHeight = image.IsInline ? ps.PageHeight - ps.TopMargin - ps.BottomMargin : ps.PageHeight;
ImageSize size = image.ImageData.ImageSize;
Boolean exceedsMaxPageSize = size.WidthPoints > freePageWidth || size.HeightPoints > freePageHeight;
// Calculate the ratio to fit the page size based on which side is longer.
Boolean widthLonger = (size.WidthPoints > size.HeightPoints);
double ratio = widthLonger ? freePageWidth / size.WidthPoints : freePageHeight / size.HeightPoints;
// Set the new size.
image.Width = size.WidthPoints * ratio;
image.Height = size.HeightPoints * ratio;
Regarding CSS and inline style, please note that upon processing HTML some features of HTML might be lost. You can find a list of limitations upon HTML exporting/importing here:
- I needed an agent that will assist me in buying your product. That is if we manage to overcome those challenges above.
Please post your query at Aspose.Purchase forum. My colleagues from sales team will reply you about your query.