First you need to add it into the getHeader method of the HTMLTemplateInvoice class (classes/pdf/HTMLTemplateInvoice.pdf)
public function getHeader() { $this->assignCommonHeaderData(); $this->smarty->assign(['header' => Context::getContext()->getTranslator()->trans('Invoice', [], 'Shop.Pdf')]); $this->smarty->assign(['order_reference' => $this->order->reference]); /* add this line! */ return $this->smarty->fetch($this->getTemplate('header')); }
Then you can use {$order_reference} in header.tpl