How to remove header margin from first page?

Hello,

We’re trying to convert the HTML to PDF. And we’re applying the top & bottom margin for header and footer but in our document there is no header on first page. so can you please guide how we can remove the top margin from the first page?

Aspose.Pdf.HtmlLoadOptions objLoadOptions = new Aspose.Pdf.HtmlLoadOptions(basePath);
objLoadOptions.PageInfo.Margin = new MarginInfo(0, 72, 0, 72);
objLoadOptions.PageInfo.Height = 792;//11 inch
objLoadOptions.PageInfo.Width = 612;//8.5 inch
objLoadOptions.PageInfo.IsLandscape = false;
objLoadOptions.IsEmbedFonts = true;

                    Aspose.Pdf.Document doc = new Aspose.Pdf.Document(new MemoryStream(Encoding.UTF8.GetBytes(body)), objLoadOptions);

RES178080.pdf (392.9 KB)

@siriussynoptek

Can you please provide the source HTML file that you are loading and saving as PDF.

demo.zip (11.3 KB)

@siriussynoptek

I have understood your requirements and regret to share that at present the API does not support setting margin height for selected page/pages only. The margin height that you will set during initial loading of HTML that in your case is 72 will hold for all pages in PDF. I have also created a ticket with ID PDFNET-49779 in our issue tracking system to further investigate the requirements on our end and will share the good news with you as soon as it will be addressed.