Remove unwanted white spaces

Hi Team,

I have created image using aspose.html, converted html to image. Facing issue with white space, How can I remove white space using aspose?

I have attached image for referenceRemoveWhiteSpaces.jpg (78.6 KB)
.

Thanks.

@siriussynoptek

Could you please share your sample HTML in .zip format with us. We will test the scenario in our environment and address it accordingly.

@asad.ali

Thanks for your response.

As requested find below attached HTML in .zip format.

HTMLToImage.zip (817.7 KB)

Do we need to do anything to maintain quality of our image, means we need to add any separate code or need to do anything from our-end?

Thanks.

@siriussynoptek

We used the below code snippet in our environment to generate a JPG image from your HTML file and obtained the attached result.

// PDFGenerateDocument.html
Aspose.Html.HTMLDocument HTMLFile = new Aspose.Html.HTMLDocument(dataDir + "index.html");

var options = new Aspose.Html.Saving.ImageSaveOptions(Aspose.Html.Rendering.Image.ImageFormat.Jpeg)
{
 HorizontalResolution = Aspose.Html.Drawing.Unit.FromDotsPerInch(300),
 VerticalResolution = Aspose.Html.Drawing.Unit.FromDotsPerInch(300),
 BackgroundColor = System.Drawing.Color.Transparent,
 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))
 }}
};

Aspose.Html.Converters.Converter.ConvertHTML(HTMLFile, options, dataDir + "output.jpg");

output_1.jpg (116.4 KB)

You can check in the attached image that quality was fine as well as no significant white space was present in it. Could you please share your feedback in this this output does not meet your requirements.

@asad.ali

Thanks for your response.

Issue has been resolved after we have created width and height as dynamic rather then hard code because we have multiple images of different height and width.

Also, please suggest that how can we generate high quality image, is there any other way to improve quality of the image? Please suggest all the possibilities for high quality image.

Thanks

@siriussynoptek

The quality of the output image depends upon the height/width and resolution which API offers a way to set. You may generate images with different qualities by specifying their values as per your desire. However, if you are interested in other quality parameters, please let us know. We will log a feature request in our issue management and share the ID with you.

@asad.ali

Thanks for your response.

Yes we are more interested in quality image, it would be great if you can log a feature request.

Thanks

@siriussynoptek

Could you please provide an image which is same to the one which we shared in our previous response but have high quality. It would help us making comparison between qualities of both images and investigate the feature feasibility accordingly.