Free Support Forum - aspose.com

Get Header and Footer from PDF

Hi,


I want to get headers and footers from pdf.

1. Header Footer text
or

2. Header Footer coordinates
I want to get header footer from pdf??
I want to get header and footer from pdf

Hi,

You can use Page.Header and Page.Footer properties for this purpose.

Best Regards,

Hi,

You can loop through each page and use Page.Header and Page.Footer properties to get header and footer of the page.

Best Regards,

Hi there,


Thanks for your inquiry. We can read header/footer text as following. But It is not working with your shared document, So we have logged a ticket PDFNEWNET-38282 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

Following code is used to read text from header/footer added using Aspse.Pdf.


PdfContentEditor pce = new PdfContentEditor();<o:p></o:p>

pce.BindPdf(“input.pdf”);<o:p></o:p>

StampInfo[] infos = pce.GetStamps(1);<o:p></o:p>

foreach (StampInfo si in infos)<o:p></o:p>

{ Console.WriteLine(si.Text); }<o:p></o:p>

<o:p> </o:p>

And if we need to get text of header/footer added with Adobe Acrobat (not stamps added by Aspose software) Page.Artifacts property to read header and footer artifacts on the page.


foreach (Artifact artifact in doc.Page[1].Artifacts)<o:p></o:p>

{ if (artifact.Subtype == Artifact.ArtifactSubtype.Header || artifact.Subtype == Artifact.ArtifactSubtype.Footer)<o:p></o:p>

Console.WriteLine(artifact.Text);<o:p></o:p>

}<o:p></o:p>

<o:p> </o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>

<o:p>
</o:p>

<o:p>Best Regards,</o:p>

Hi Muhammad,

Page.Header and Page.Footer is returning null values.

Can u share the code

@ratnakar

Thanks for posting your inquiry.

We believe that you have posted identical question over this forum thread and it has been replied. You may please follow up further discussion there.