Free Support Forum - aspose.com

HTML to image converting issue

Hi Team,

While converting HTML to image we are facing issue as title text goes cut in converted image, but in HTML it will displayed properly.

I am attaching HTML and after converted image sample for reference. please review that image on right side title text goes cut.

HTMLToImage.zip (817.7 KB)

image.png (21.0 KB)

Thanks.

@siriussynoptek

Can you please share the sample code snippet for our reference as well so that we can test the scenario accordingly and share our feedback with you.

Hello Team,

PFA for sample application. when you run application it will generate output_1 and output_2 named file in ImageOutput folder. Both images cut down. So how can we generate single image with propter output as per the input.html file? Please suggest.

HTMLtoImage_Core.zip (462.9 KB)

@siriussynoptek

You are getting this output because the image size has been specified in your code. Please remove the size specifications in order to get the complete image:

//PageSetup = { AnyPage = new Aspose.Html.Drawing.Page
//{
 //  Size = new Aspose.Html.Drawing.Size(Aspose.Html.Drawing.Unit.FromCentimeters(12.57), Aspose.Html.Drawing.Unit.FromCentimeters(14.4))
//}}

output_1.jpg (251.9 KB)

Thanks for suggestion.

If we don’t set page size, generated image have white space as per attached image(red highlighted) and small image displaying. So we want to cover text and image in single image having minimum whitespace(so that image will be in readable mode) after image. Text is dynamic we don’t know how long it will. Also image will be of different different dimension. We also want to remove left and right vertical space as highlighted in attached image. Can you please suggest how can we achieve this?

Output.png (49.0 KB)

@siriussynoptek

We have logged an investigation ticket as HTMLNET-3161 in our issue tracking system to analyze whether your requirements are possible to achieve. We will look into details of the logged ticket and let you know once it is fixed. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello Team,

Thank you for your response.
Can we know ETA for whether our requirement is possible to achieve & if possible then when can we expect solution of it from ASPOSE?

@siriussynoptek

The ticket has recently been logged in our issue tracking system and we are afraid that it is pending for an investigation. We will investigate and resolved it on a first come first serve basis. However, we will surely share our feedback with you as soon as the ticket is fully analyzed and further updates are available regarding its resolution. Please give us some time.

We are sorry for the inconvenience.

Hello Team,

By removing page setup, we are not getting proper output image. so we want to go with page setup. Can you please your feedback for below queries?

  1. How can we calculate height of page setup to generate single image having whole html
    content into it?
  2. Is there any other way to generate single image instead of splitting it into multiple images?

@siriussynoptek

We are afraid that we cannot share details against the inquiries which you posted before complete investigation of the ticket. The ticket is currently under the phase of investigation and we have updated its information as well as per your inquiries. We will surely let you know once we have some updates to share with you. We greatly appreciate your patience and comprehension in this regard. Please give us some time.

@siriussynoptek

We have attached the print preview generated by Google Chrome (“chrome.png”), as you can see the text is cut down. This happens because of the CSS styles used in this document, its content size is dependent on the page size. That is why the usage of the calculated content size would not have the desired effect.

chrome.png (97.3 KB)

In order to give you the ability to generate a single image, which will contain the whole document, we are going to implement the new sizing option. This option will change the size of the output image, so it will fit the content size. Because of the high complexity, it will take us some time to implement this resizing algorithm. We will further inform you once we have more updates.