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

Free Support Forum - aspose.com

Problem with Images with CSS floats on them and paging

We are seeing a problem when an image has a float the paging is not working correctly. We are using the HTML to PDF portion of ASPOSE Words.



It looks like ASPOSE is supporting the float on the image, however, not supporting the float clear and the image is bleeding into the footer? Is that the case and is there any workaround or fix for this.

I am currently using the latest version of ASPOSE words: v17.2.0

Attached is the HTML from the problem in the document. And the attached PDF is what it looks like.


Hi Kathleen,

Thanks for your inquiry. Could you please attach your complete input html document along with image here for testing? We will investigate the issue on our side and provide you more information.

OK here is the HTML document and image.

Hi Kathleen,

Thanks for sharing the document. We have tested the scenario using latest version of Aspose.Words for .NET 17.2.0 and have not found the shared issue. Please use Aspose.Words for .NET 17.2.0. We have attached the output Pdf with this post for your kind reference.

As I mentioned we are using 17.2.0, however, for some reason that document did not have a float:left on that image.(sorry about that) We have put the float left on the image and now it definitely does it. Notice how it does not respect the bottom margin (which we have as one inch) or the footer.


here is our margin settings (on the real report we also have a footer, with page number in it.)
builder.PageSetup.LeftMargin = ConvertUtil.InchToPoint(.25);
builder.PageSetup.RightMargin = ConvertUtil.InchToPoint(.25);
builder.PageSetup.TopMargin = ConvertUtil.PixelToPoint(1);
builder.PageSetup.BottomMargin = ConvertUtil.InchToPoint(1);

See new attached documents and image for your testing.


Hi Kathleen,

Thanks for your inquiry. The shared Pdf is generated by Aspose.Words v15.8.1. Please upgrade to the latest version of Aspose.Words for .NET 17.2.0.

We have converted the html to Pdf using following code example and have not found the shared issue. Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. We will investigate the issue on our side and provide you more information.

Document doc = new Document(MyDir + "ProblemDocument.html");

doc.Save(MyDir + "Out v17.2.0.pdf");

Just curious how could you tell it was an older version of Aspose from the PDF file? That would be a handy thing to know.

I have included a console app ( we used with the last example we sent you ) with the exact code we use to reproduce it along with the problem HTML document and PDF it generated. I double checked and the Aspose library is definitely 17.2.0. As you can see from the PDF, the picture is overlapping the bottom margin which is one inch.

Try using the the InsertHtml method and you will probably reproduced it. We put together several HTML documents so the InsertHtml method is very useful for us.

If you can't reproduce then please attach what your Apose 17.2.0 generates.

Hi Kathleen,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you open your input html in MS Word and set the same page margins, you will get the same output. You are facing this behavior because the shape's warp type is square. Please set it to inline to render the shape on next page in Pdf.
shmeep:
Just curious how could you tell it was an older version of Aspose from the PDF file? That would be a handy thing to know.
Open the Pdf in Adobe Pdf viewer and click File->Properties. The Pdf producer shows the Aspose.Words' version. Please see the attached image for detail.