How can I add headers automatically in headless mode?

I’m using libreoffice in headless mode to convert html to pdf. Can I specify headers for the pdf? I would like make pdfs over multiple pages and it would be difficult to size the html correctly over page breaks so headers and footers were in the correct places.

I would like to be able to just tell libreoffice to put in headers and footers with the cmd line.

Right now my cmd is

'libreoffice --headless --writer --convert-to pdf --outdir /tmp ' +


If there’s no way to specify headers at the moment of document creation, could I edit a pdf programmatically with code?