those header and footer templates are created when you use the chrome native header/footer, a simple example for that is available here
i have seen few examples where new templates are added for both header and footer and use before script and append those header and footer with the main template.
those examples are probably using the pdf-utils header/footers which basically involves pdf manipulation which are more powerful than the native chrome header/footers