public function prepare(): Mpdf
    {
        $this->pdf = $this->getPdf();

        // set the custom pdf template
        if (null !== $this->getTemplate() && file_exists($this->getTemplate())) {
            $this->pdf->SetImportUse();

            $pageCount = $this->pdf->SetSourceFile($this->getTemplate());
            $tplIdx = $this->pdf->ImportPage($pageCount);
            $this->pdf->UseTemplate($tplIdx);
            $this->pdf->UseTemplate($tplIdx);
        }

        $this->pdf->WriteHTML($this->html);

        $this->isPrepared = true;

        return $this->pdf;
    }