Hi,

I have some difficulties to remove the borders that are in the header and footer PDF.

Can you give me some advices to do it please ?

Regards,

zmove

Comments

jnvera’s picture

I have de same problem but I removed the footer's.

In print_pdf.pages.inc:

function theme_print_pdf_tcpdf_footer2(&$pdf) {
  //Position at 1.5 cm from bottom
  $pdf->writeHTMLCell(0, 15, 15, -10, $pdf->footer, 0, 0, 0, TRUE, '');

  $ormargins = $pdf->getOriginalMargins();
  $pagenumtxt = t('Page !n of !total', array('!n' => $pdf->PageNo(), '!total' => $pdf->getAliasNbPages()));
  //Print page number
//  if ($pdf->getRTL()) {
//    $pdf->SetX($ormargins['right']);
//    $pdf->Cell(0, 10, $pagenumtxt, 'T', 0, 'L');    <----this commented lines display the footer, test which is the border one.
//  }
//  else {
//    $pdf->SetX($ormargins['left']);
//    $pdf->Cell(0, 10, $pagenumtxt, 'T', 0, 'R');
//  }

  return $pdf;
}

I can't remove header border, some advice?

Thank you.

P.D.: Sorry for my bad english.

jnvera’s picture

I found how remove header, using method setPrintHeader in the tcpdf object (if you use another pdf lib I don't know how is it).

Place this code in your theme template.php file (in my case theme = garland, change it if you need)

function garland_print_pdf_tcpdf_header($pdf, $html, $font){
	$pdf->setPrintHeader(false);
}

Good Luck!

jcnventura’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

anybody’s picture

Hi,

just one addition: You forgot to return the pdf object!

Correct version:


function YOURTHEMENAME_print_pdf_tcpdf_header($pdf, $html, $font){
    $pdf->setPrintHeader(false);
    
    return $pdf;
}

Furthermore there are:
_header
_page
_content
_footer
_footer2

overrides.

tavi_10’s picture

$pdf->Cell(0, 10, $pagenumtxt, 'T', 0, 'L');

replace with

$pdf->Cell(0, 10, $pagenumtxt, 0, 0, 'L');

As the 4th argument is the border style.

zulfierken’s picture

I just wrote this in print--node--contract.tpl.php in my theme folder but did not work :( I hacked the original print_pdf_tcpdf_pages.inc. Wish I could do this without hacking :)