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

Free Support Forum - aspose.com

Text is getting wrapped in the converted image file

Hi Aspose Team,

The Requirement of my project is to convert the html file to image files.

I am using the following peice of code to accomplish this.

//set the license
Aspose.Words.License license = new Aspose.Words.License();

//load the html file into Aspose.Words
Aspose.Words.LoadOptions lo = new Aspose.Words.LoadOptions();
lo.LoadFormat = Aspose.Words.LoadFormat.Html;
Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\Aspose\RDP\NEWFiles\ImagePDF2.html", lo);

//Make the text display in individual rows

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
foreach (Aspose.Words.Tables.Table tbl in tables)
tbl.Alignment = TableAlignment.Left;
//Generate the images
for (int pageCounter = 0, stop = doc.PageCount; pageCounter < stop; pageCounter++)
Aspose.Words.Saving.ImageSaveOptions options2 = new Aspose.Words.Saving.ImageSaveOptions(SaveFormat.Png);
options2.PageIndex = pageCounter;
options2.PrettyFormat = true;
// images are of the format \<0-padded-page-index>.png, e.g. (somepath\myfile02.png)

doc.Save(string.Format("{0}{1}{2}{3:d2}.png", "D:\\Aspose\\RDP\\NEWFiles\\Images\\", "", "MyImage", pageCounter + 1) , options2);

I am able to convert the input html file to image files sucessfully.
But in the converted image files I have some text which is getting wrapped into multiple lines,Even though there is enogh space available.

For example the word "Yes" is shown in multiple lines.Pleae see the attached image file in which I have highlighted the wrapped text.

I request you to please look into this and help me to overcome this issue.



Thanks for your inquiry. First of all I would suggest you please upgrade to the latest version of Aspose.Words i.e. 11.0.0. Secondly, in your case, I believe the following code change would be helpful to you:


Best Regards,