HTML to Image, image in table left justifies


#1

The application im working on currently implements Aspose.HTML . One of the html layouts has an image embedded in a html table with data rows where the image is center justified. After using the HTML to Png render function, the converted HTML page left justifies all images that were in the table. Am i missing a configuration setting or is there some workaround to get the render engine to output images inside of html.tables with the proper spacing?

Thanks,
Chris


#2

@Chris_Dieu

Thank you for contacting support.

Would you please share a narrowed down sample application along with source and generated files so that we may try to reproduce and investigate it in our environment.


#3

Hi @Farhan.Raza,

Thank you for responding to the post. Included the input html and output .png file for investigation.
Aspose_Question.zip (1.5 MB)


#4

@Chris_Dieu

Thank you for sharing requested files.

Please also share the code snippet which you are using in your environment so that we may proceed to investigate it further.


#5

@Farhan.Raza

public async Task HtmlToPNG(string html, string blobLoc, string blobKey, string container)
{
Aspose.Html.License license = new Aspose.Html.License();
license.SetLicense(Directory.GetCurrentDirectory() + @"\Aspose.Total.lic");

string dataDir = Path.Combine(Directory.GetCurrentDirectory(), "Data\\");
String InputHtml = dataDir + "Aspose.HTMLinput.html";
Guid guidVal = Guid.NewGuid();
string fileLocation = dataDir + guidVal + @".png";

using (FileStream fs = File.Create(InputHtml))
{
    using (StreamWriter sw = new StreamWriter(fs))
    {
        sw.Write(html);
    }
}

Aspose.Html.Rendering.Image.ImageRenderingOptions png_options = new Aspose.Html.Rendering.Image.ImageRenderingOptions();
using (Aspose.Html.Rendering.Image.ImageDevice png_device = new Aspose.Html.Rendering.Image.ImageDevice(png_options, fileLocation)) 
using (Aspose.Html.Rendering.HtmlRenderer renderer = new Aspose.Html.Rendering.HtmlRenderer())
using (Aspose.Html.HTMLDocument html_document = new Aspose.Html.HTMLDocument(InputHtml))
{
    renderer.Render(png_device, html_document);

}

///

}


#6

@Chris_Dieu

We have been able to reproduce the issue in our environment. A ticket with ID HTMLNET-1584 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.


#7

@Farhan.Raza

Thank you for putting in the ticket. I updated the version of Aspose.HTML to 18.11 and it seems to continue to have the same spacing error on png image output.


#8

@Chris_Dieu

The problem persists with latest available version. We will notify you as soon as it will be resolved. We appreciate your patience in this regard.