50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
require_once 'Vendors/tcpdf/tcpdf.php';
|
|
|
|
class Scores_Pdf_Tcpdf extends TCPDF
|
|
{
|
|
protected $bgimage = null;
|
|
|
|
public function SetBackgroundImage($file)
|
|
{
|
|
$this->bgimage = $file;
|
|
}
|
|
|
|
/**
|
|
* (non-PHPdoc)
|
|
* @see TCPDF::Header()
|
|
*/
|
|
public function Header()
|
|
{
|
|
if ($this->bgimage) {
|
|
// get the current page break margin
|
|
$bMargin = $this->getBreakMargin();
|
|
// get current auto-page-break mode
|
|
$auto_page_break = $this->AutoPageBreak;
|
|
// disable auto-page-break
|
|
$this->SetAutoPageBreak(false, 0);
|
|
// set bacground image
|
|
$this->Image($this->bgimage, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
|
|
// restore auto-page-break status
|
|
$this->SetAutoPageBreak($auto_page_break, 20);
|
|
// set the starting point for the page content
|
|
$this->setPageMark();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* (non-PHPdoc)
|
|
* @see TCPDF::Footer()
|
|
*/
|
|
public function Footer()
|
|
{
|
|
// Position at 15 mm from bottom
|
|
$this->SetY(-15);
|
|
// Set font
|
|
$this->SetFont('helvetica', 'I', 8);
|
|
// Page number
|
|
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
|
|
}
|
|
|
|
|
|
} |