Merge elements of 2 pdf pages in single one

Solution 1:

You can use the watermark command from HexaPDF for this:

$ hexapdf watermark -w header_footer.pdf content.pdf output.pdf