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

Free Support Forum - aspose.com

Use a PDF for the headers/footers of a generated PDF

I have been supplied a PDF file containing headers/footers to use for a PDF I am generating.

When I load the PDF using Aspose.Pdf.Document(“filename.pdf”), I can see that I have 1 page. However, I cannot figure out how to get the content of that page and create a HeaderFooter instance out of it to use in my generated PDF. The collection Page[1].Paragraphs is empty.

Is this possible?

Hi There,

Thanks for your inquiry. You may extract the content (i.e text, images) from the PDF document using Aspose.Pdf. However in order to understand the problem which you are facing, we need a sample input document. This way we can test the scenario in our environment. We will really appreciate if you please provide a sample input document so that we can respond you accordingly.

Best Regards,

I was able to almost achieve this using the PdfPageStamp and loading the PDF containing the header and footer. However, the footer is correctly placed but the header is lower than it is supposed to be. Page sizes are the same. Why is it mangling the original document?


Thanks for contacting support.

Can you please share the input file and source code, so that we can test the scenario in our environment. We are sorry for this inconvenience.

It turns out that I was wrong – the page sizes were very close but not the same.

I was not setting the PageHeight value and it was defaulting to A4Height (842) when I needed LetterHeight (792).

Now that I have corrected this it is working as expected.

Thank you.

Hi There,

Thanks for your feedback. It is good to know that your issue has been resolved. Please keep using our API and in case you need any assistance please feel free to contact us.

Best Regards,