0

How can I add custom header and footer text in tcpdf using laravel controller

Following the TCPDF doc I can create a pdf file fine. but when I want to add custom footer text I didn't do that. This is the Controller.

How can I add custom footer in tcpdf or you have any solution for the custom footer any other package which I will use custom footer easily please suggest me.

Inspire Shahin
  • 414
  • 2
  • 8
  • 24

1 Answers1

1

I fixed my problem using mPdf instead of tcpdf. Using mPdf I just called SetFooter() function.

$mpdf = new mPDF();

$mpdf->Bookmark('Start of the document');

$mpdf->WriteHTML('<div>This is body text </div>');
$mpdf->SetFooter('<div>This is custom footer!</div>');

$mpdf->Output();

Now custom footer worked for me!

Inspire Shahin
  • 414
  • 2
  • 8
  • 24