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

Free Support Forum - aspose.com

Convert HTML to PDF with Aspose.PDF - Automatic resize image which is to large to fit inside pdf

We port the HTML to PDF converter from iText to Aspose.
We run into the problem that the rendered PDF in aspose produces a different result than with iText.
In iText, an image that is wider than the PDF page is automatically scaled to fit exactly.

We want to simulate this functionality in Aspose.PDF, only it doesn’t seem to be possible to do this automatically, or to resize images. An image which is wider than the PDF is just cut off, it is not scaled.

What we also tried is to reduce the size of the large images on the generated PDF document, but it seems that the space occupied on the PDF remains the same. So there is a large white area visible.

How can we realize that oversized images are nevertheless displayed in their entirety on the PDF page?


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

I run into the same issue. Is there further information?


As requested earlier, would you kindly share your sample HTML document in .zip format with us. Also, please share an expected PDF output so that we can test the scenario in our environment and address it accordingly.

Hi @asad.ali,
I am also facing same problem. when converting html page having an image, into pdf the image is not getting compressed while converting to PDF. I’ve attached the code, image and the pdf with image coming over two pages.

htmltopdf.zip (603.9 KB)


We were able to reproduce the issue in our environment while testing the scenario with Aspose.PDF for .NET 21.4. We have logged it as PDFNET-49806 in our issue tracking system for the sake of correction. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.


I’m facing the same issue on Aspose Words for Java,

are there any updates/solutions?

Best regards


In that case, please create a new topic in Aspose.Words category along with sample files and code snippet. Your issue will be addressed accordingly.

Okay, thank you. :slight_smile:

Hi @asad.ali ,
Please let me know the status for this issue.


The ticket is currently under the phase of the investigation and we are afraid that it has not been yet resolved. We will notify you in this forum thread as soon as we have some definite updates about its rectification. We highly appreciate your patience and comprehension in this regard.

We apologize for the inconvenience.