Free Support Forum - aspose.com

Add HTML String to Footer of PDF using Aspose.PDF for .NET - text is overlapping

I have converted an excel document to PDF and then adding footer dynamically. Issue is footer content is overlapping with the PDF content.
Here is the link of aspose.cells forum which has all the details of the issue + code + files used.

https://forum.aspose.com/t/when-converting-excel-into-pdf-footer-and-actual-sheet-content-overlaps/208969/3

Could you please help in resolving the issue.

@anujshukla

Thanks for contacting support.

We have checked the referenced thread. Would you kindly share the sample HTML string that you are adding for header/footer in the PDF document. We will further proceed to assist you accordingly.

Please see below:

<p style="text-align: right;"><span style="font-size: 14pt; color: #ff0000;"><strong><span style="font-family: Arial;">Sample Book Footer</span></strong></span></p>"

@anujshukla

Would you kindly try setting top margin of your footer while adding to generated PDF as follows:

footer.Margin = new MarginInfo(0, 0, 0, 20);

OUTPUT.pdf (332.6 KB)

Thanks, It is working. However i notice one issue that blue line above footer text is spanning the entire width of the page, though it should not be there in left/right margin area of the page. This is happening at my side also. For header it is working fine.

Any suggestion on how it can be resolved.

@anujshukla

This is happening because in the suggested line of code, all margins except TOP are being set as 0. If you want to leave other margins as default, please replace the margin setting code with the following line:

footer.Margin.Top = 20;

OUTPUT.pdf (332.6 KB)

Thanks for the reply.

1 Like