-
Peter Rotich authoredPeter Rotich authored
class.pdf.php 8.74 KiB
<?php
/*********************************************************************
class.pdf.php
Ticket PDF Export
Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
define('THIS_DIR', str_replace('\\\\', '/', realpath(dirname(__FILE__))) . '/'); //Include path..
define('FPDF_DIR', THIS_DIR . 'fpdf/');
define('FPDF_FONTPATH', FPDF_DIR . 'font/'); //fonts directory.
require (FPDF_DIR . 'fpdf.php');
class Ticket2PDF extends FPDF
{
var $includenotes = false;
var $pageOffset = 0;
var $ticket = null;
function Ticket2PDF($ticket, $psize='Letter', $notes=false) {
global $thisstaff;
parent::FPDF('P', 'mm', $psize);
$this->ticket = $ticket;
$this->includenotes = $notes;
$this->SetMargins(10,10,10);
$this->AliasNbPages();
$this->AddPage();
$this->cMargin = 3;
$this->_print();
}
function getTicket() {
return $this->ticket;
}
//report header...most stuff are hard coded for now...
function Header() {
global $cfg;
//Common header
$this->Ln(2);
$this->SetFont('Times', 'B', 16);
$this->Image(FPDF_DIR . 'print-logo.png', null, 10, 0, 20);
$this->SetX(200, 15);
$this->Cell(0, 15, $cfg->getTitle(), 0, 1, 'R', 0);
//$this->SetY(40);
$this->SetX($this->lMargin);
$this->Cell(0, 3, '', "B", 2, 'L');
$this->SetFont('Arial', 'I',10);
$this->Cell(0, 5, 'Generated on '.Format::date($cfg->getDateTimeFormat(), Misc::gmtime(), $_SESSION['TZ_OFFSET'], $_SESSION['TZ_DST']), 0, 0, 'L');
$this->Cell(0, 5, 'Date & Time based on GMT '.$_SESSION['TZ_OFFSET'], 0, 1, 'R');
$this->Ln(10);
}
//Page footer baby