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

Free Support Forum - aspose.com

How to get/set Header/Footer top position?

Hi,

I am using Aspose latest version for document conversion. I have attached the document with this post. After conversion i cant able to see the top margin for the header. Is there any Api available ?

Thanks,
Anbu

Hi Anbu,


Thanks for your inquiry. Please use the following two properties to adjust the header/footer distances:

PageSetup.HeaderDistance property
PageSetup.FooterDistance property

Also, please try run the following code snippet:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Section currentSection = builder.getCurrentSection();
PageSetup pageSetup = currentSection.getPageSetup();
pageSetup.setHeaderDistance(2 72);
pageSetup.setFooterDistance(0.5
72);
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.write(“Header”);
doc.save(“C:\temp\out.docx”);
I hope, this helps.

Best regards,