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

Free Support Forum - aspose.com

Table marginbottom not working

Hi,

When I use a table and set a marginbottom, it simply doesn’t do anything and the next paragraph is right below the table without any room between the paragraphs. Setting a top margin on the next paragraph doesn’t do anything either.

I am generating the pdf from xml using Aspose.Pdf 6.4 .NET 4 version, test sample xml & pdf are attached, code is as follows:

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
string xmlFile = HttpContext.Server.MapPath("~/App_Data/Test" + id + “.xml”);

pdf.BindXML(xmlFile, null);

System.IO.MemoryStream ms = new System.IO.MemoryStream();
pdf.Save(ms);

return new FileContentResult(ms.ToArray(), “application/pdf”) { FileDownloadName = “Test” + id + “.pdf” };

Regards,
Patrick

Hi Patrick,

Thanks for sharing the template XML file and resultant PDF Document. You are using MarginTop and MarginBottom attributes in Table and Image Tags and I am afraid using MarginTop and MarginBottom attributes in Table and Image will not affect anything. MarginBottom and MarginTop attributes affects only in case of paragraph and page.

We are realy very sorry for your inconvenience.

Thanks & Regards,

Hi,

I did some more testing and what you’re saying does not match my findings. MarginTop works fine for both Table and Image tags, it seems to me there’s a bug with MarginBottom.

When MarginBottom is used on a Table or Image, there is no margin with the Text paragraph below even if MarginTop is used there. However if MarginBottom on Table/Image is ommitted, the MarginTop works on the Text paragraph.

See my new example as attached.

Page1: Table with margintop and marginbottom = wrong result
Page2: Image with margintop and marginbottom = wrong result
Page3: Table with only margintop = correct result
Page4: Image with only margintop = correct result

Since margintop works for tables and images, I see no reason why marginbottom should not work. And it’s also unexpected that using it interferes with margintop of the following paragraph.

Regards,
Patrick

Hi Patrick,

Kindly check the following documentation links for details.

Margin Property

MarginInfo Members

We are realy very sorry for your inconvenience.

Thanks & Regards,

That doesn’t tell me anything I didn’t know already.

Please look into the issue, to me it’s clearly a bug that margins work around Image and Table, except MarginBottom. And which also interferes with MarginTop for the next paragraph.

Hi Patrick,

Thanks for your feedback.

I have shared this issue with our development team and they will investigate this issue and share further details. I also asked them to check for the support of this feature. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-32000. We will update you via this forum thread regarding any update against your issue.

We apologize for your inconvenience.

Thanks & Regards,