5

i have a mPDF report on my system and in the report, it has a header and footer where i use $mpdf->setHeader(); & $mpdf->setFooter(); to set the header and footer. but it displays a bottom border for header and top border for footer. can anyone help me how to remove this?

heres the image:

enter image description here

Here's my Code:

$mpdf=new mPDF('','LETTER-L','','',35,35,60,25,10,10);
//left margin, right margin, body, top margin,top margin,bottom margin, 

/*HEADER Monthly Accomplishment Report*/
$mpdf->SetHeader('Sample');


/*FOOTER xMonthly Accomplishment Report*/
$mpdf->SetFooter('Sample');




//==============================================================
//=====================FILE DESCRIPTION=========================
//==============================================================
$mpdf->SetTitle('Monthly Accomplishment Report');
$mpdf->SetSubject('Report');
$mpdf->SetAuthor('sample');
$mpdf->Output('sample.pdf','I');
exit;
//==============================================================
//==============================================================
//==============================================================
Vincent Dapiton
  • 587
  • 1
  • 9
  • 27

3 Answers3

13

You could use those two mpdf properties instead:

$mpdf->defaultheaderline = 0;
$mpdf->defaultfooterline = 0;
Razvan Grigore
  • 1,649
  • 17
  • 17
2

I had a look at the documentation of the method setHeader and found that exists a line parameter :

$line: specify whether to draw a line under the Header

You passed a string to the method but it also accept an array of options.

$line mentionned in the doc is not exactly a parameter of the method, rather a key of the configuration array.

So this code should accomplish what you look for, based on the documentation:

$mpdf = new mPDF('','LETTER-L','','',35,35,60,25,10,10);
$headerFooterContent = 'Sample';
$oddEvenConfiguration = 
 [
    'L' => [ // L for Left part of the header
      'content' => '',
    ],
    'C' => [ // C for Center part of the header
      'content' => '',
    ],
    'R' => [
      'content' => $headerFooterContent,
    ],
    'line' => 0, // That's the relevant parameter
  ];
$headerFooterConfiguration = [
  'odd' => $oddEvenConfiguration,
  'even' => $oddEvenConfiguration
];
$mpdf->SetHeader($headerFooterConfiguration);
$mpdf->SetFooter($headerFooterConfiguration);

The setHeader and setFooter methods accept the same arguments (they are almost copy/pasted in the library).

I let you look further at the specific part of the examples related to complex header configuration of mPDF.

Let me know if it solves your issue.

Lex Lustor
  • 1,525
  • 2
  • 22
  • 27
0

Depending on the version of mpdf, you can use this:

$pdf->options['defaultheaderline'] = 0;
$pdf->options['defaultfooterline'] = 0;
Elikill58
  • 4,050
  • 24
  • 23
  • 45