Free Support Forum - aspose.com

Large image getting cropped with HTML to PDF conversion

AsposeTest.zip (2.3 MB)
I am trying to convert HTML to PDF and I am having large image within my HTML

Image is getting cropped out from the very first page and rest image is shown in rest of the page
I am attaching sample HTML, image and output PDF file with following code snippet

var objMemoryStream = new MemoryStream();
var writer = new StreamWriter(objMemoryStream);
writer.Write("<html><head></head><body><img src=\"http://dnndev.me/Portals/0/download.png\" width=\"1200\"/></body></html>");

HtmlLoadOptions objHtmlLoadOptions = new HtmlLoadOptions("styles/assets/");
PageSize.A4.IsLandscape = true;

using (Document objPDFDocument = new Document(objMemoryStream, objHtmlLoadOptions))
{
   objPDFDocument.Save(Server.MapPath("output.pdf"));
}

@abyjoshi2891

Please try to use below property to render the image on single page inside PDF:

objHtmlLoadOptions.IsRenderToSinglePage = true;

output.pdf (2.8 MB)