how can I set a different left margin in the footer?

Hi, I’m trying to add a quite large image in the footer, and it works, but the footer has the same left margin that I’ve set in the section’s margins, and the image does not fit my footer properly.

I would like the footer to have, say, a Left margin of 1cm while the body of the document (section) has a left margin of 2cm.

I’ve set the body section’s margins (using a small conversion helper) to

var margins = new PageMargins()
Top = cmToPoints(0.8),
Bottom = cmToPoints(1),
Left = cmToPoints(2.75),
Right = cmToPoints(2),
Footer = cmToPoints(2)

then I assign it to my body section like

var page= new Section(document) { PageSetup = new PageSetup { PageMargins = margins } };

then I add the footer
var footerInfo = new Paragraph(document, footerbar);
var footer = new HeaderFooter(document, HeaderFooterType.FooterDefault, footerInfo);

where footerbar is a Picture loaded from local file, like

var picture = new GemBox.Document.Picture(document, imagePathMap, 20, 2, LengthUnit.Centimeter);

Microsoft Word allows to have a different left margin in the footer, even if by default it seems to be set equal to the section margin. how should I do?



No, you cannot have a different left margin in the footer and Microsoft Word doesn’t allow that as well.
What I presume you’re referring to is the paragraph’s left indentation, so try using something like this:

footerInfo.ParagraphFormat.LeftIndentation = cmToPoints(-1);

In other words, set the left indentation to a minus value.

Does this solve your issue?


Absolutely, you’re right, thanks so much!