Added support to header and footer document

Hi, i made improvements, added support for placeholders in the header and footer.