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

Free Support Forum - aspose.com

Header & Footer are not getting recognized by Acrobat Reader

Hello,

We’re trying to add header & footer to the PDF but when we check the same with the Acrobat Reader it’s not able to find any header & footer. I’m attaching the PDF here and screen shot from the Acrobat Reader as well. image.png (100.8 KB) firstpage.pdf (90.7 KB)

Code we used to add header & footer is as below:
//add header and footer
Aspose.Pdf.HtmlFragment headerFragment = new Aspose.Pdf.HtmlFragment(headerHTMLString);
Aspose.Pdf.HtmlFragment footerFragment = new Aspose.Pdf.HtmlFragment(footerHTMLString);
for (int k = 0; k < docLastPage.Pages.Count; k++)
{
Aspose.Pdf.HeaderFooter pdfHeader = new Aspose.Pdf.HeaderFooter();
pdfHeader.Paragraphs.Add(headerFragment);
pdfHeader.Margin = new MarginInfo(30, 0, 30, 0);
docLastPage.Pages[k + 1].Header = pdfHeader;

                                Aspose.Pdf.HeaderFooter pdfFooter = new Aspose.Pdf.HeaderFooter();
                                pdfFooter.Paragraphs.Add(footerFragment);
                                //pdfFooter.Margin = new MarginInfo(20, 0, 20, 710);
                                pdfFooter.Margin = new MarginInfo(20, 0, 20, 0);
                                docLastPage.Pages[k + 1].Footer = pdfFooter;
                            }

Regards,
Synoptek

1 Like

@siriussynoptek

Adobe Reader does not deal with the content as separate entities of header and footer. They are defined at the time of PDF generation only and once the PDF is generated, they become part of other content. Can you please share a sample PDF in which existing header/footer can be recognized using Adobe Reader?