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

Free Support Forum - aspose.com

Aspose.Pdf issue convert html to pdf

I have a html in which I have big image. When I convert the html to pdf using Aspose.Pdf, the image goes to next page leaving the previous page with lots of blank space. How can I make the image display without going fully to the next page. I mean by making the image use the space available in the current page and showing the rest of the part of image in the next page?


My html is as below:

some text
some text


Hi Nishad,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 8.6.0 where I have used one of my sample images and I am unable to notice any issue. For your reference, I have attached the resultant PDF generated over my end.

Can you please the image which you are using so that we can again test the scenario at our end. We are sorry for this inconvenience.

[C#]

Pdf pdf = new Pdf();<o:p></o:p>

pdf.IsLandscape = true;

pdf.ParseToPdf("c:/pdftest/Page_275.html");

pdf.Save(“c:/pdftest/COnvertedFile.pdf”);

Hi Nayyer Shahbaz

Thanks very much for the reply.

Actually the issue for me is in the below scenario.

The page has one big paragraph at the top. And below that paragraph there is an image which has a height equal to or more than the height of pdf page. Then the image is displayed in the next page even though there is some more space in the current page.

I understand that it is because there is not enough space to display the image fully in the current page, that the image is displayed in the next page. But I would like to know if there any way to show the top part of the image in the current page and the rest bottom part to next page so that there won't be any blank space left in the current page. I need to achieve it without reducing the height of the image.

Another scenario is I have an image, the height of which is more than the height of pdf page. I want to show the image without reducing the height of the image. The image needs to be displayed in 2 pages as said in the above scenario.

I have attached the image, pdf created with Aspose and aso pdf created with ExpertPdf.HtmlToPdf. I would like to create the pdf using Aspose which needs to look like the pdf created with ExpertPdf.HtmlToPdf.

Please find code Below:

private void GeneratePdf()

{

var pdf = new Aspose.Pdf.Generator.Pdf();

pdf.ParseToPdf(GetHtml());

var response = System.Web.HttpContext.Current.Response;

response.Clear();

pdf.Save("test.pdf", Aspose.Pdf.Generator.SaveType.OpenInAcrobat, response);

response.Flush();

response.End();

}

private string GetHtml()

{

return ""

+ ""

+ ""

+ ""

+ ""

+ "some text some text"

+ ""

+ "";

}



Thanks & Regards

Nishad

Please replay for <a href="?View=Flat

Hi Nishad,


Thanks
for sharing the details.

I have tested the scenario and I am able to notice the same problem. For the sake of correction, I have logged this issue as PDFNEWNET-36108 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-36108) have been fixed in Aspose.Pdf for .NET 9.5.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Nishad,


Thanks for your patience. Your reported issue has been fixed in new DOM approach of HTML to PDF conversion. Please check following documentation link for details and code snippet.


Please feel free to contact us for any further assistance.

Best Regards,