React-to-print: change header and footer in print

Created on 20 Mar 2019  路  3Comments  路  Source: gregnb/react-to-print

I want to set header and footer in all pages like company logo on header and some details in footer

All 3 comments

Header and footer are controlled by the browser print dialog, it's not something we set. The header is normally the date and page title, and the footer is normally the page url and the page number. If you mean you just want to add some React components above/below the thing being printed, just wrap the thing being printed with those elements before the print is triggered.

please help i am also having same issue as @avni-logistic

Hi @thebinarybrain as mentioned above, the only option you have is to add/remove content to the page before/after print. You can use the onBeforeGetContent prop to do this, or you can hide/show elements using CSS with the @media print { ... } query. There is no print API that browsers expose to allow settings headers/footers unfortunately.

Was this page helpful?
0 / 5 - 0 ratings