[-] PDF : Logo path

This commit is contained in:
fBrignoli
2011-12-13 15:15:28 +00:00
parent 872fc047c1
commit ad0a300af4
2 changed files with 12 additions and 13 deletions
+3 -9
View File
@@ -84,11 +84,11 @@ abstract class HTMLTemplateCore
$logo = '';
if (file_exists(_PS_IMG_DIR_.'logo_invoice.jpg'))
$logo = 'img/logo_invoice.jpg';
$logo = _PS_IMG_.'logo_invoice.jpg';
else if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
$logo = 'img/logo.jpg';
$logo = _PS_IMG_.'logo.jpg';
return Tools::getShopDomain(true).__PS_BASE_URI__.'/'.$logo;
return $logo;
}
/**
@@ -101,15 +101,9 @@ abstract class HTMLTemplateCore
$template = ucfirst(str_replace('HTMLTemplate', '', get_class($this)));
$hook_name = 'displayPDF'.$template;
// p('='.Hook::exec($hook_name, array('object' => $object)));
$this->smarty->assign(array(
'HOOK_DISPLAY_PDF' => Hook::exec($hook_name, array('object' => $object)),
'kikoo' => 'lol'
));
}
/**
+9 -4
View File
@@ -34,7 +34,7 @@ require_once(_PS_TOOL_DIR_.'tcpdf/tcpdf.php');
*/
class PDFGeneratorCore extends TCPDF
{
const DEFAULT_FONT = 'dejavusans';
const DEFAULT_FONT = 'helvetica';
public $header;
public $footer;
@@ -43,6 +43,12 @@ class PDFGeneratorCore extends TCPDF
public $font_by_lang = array('jp' => 'cid0jp');
public function __construct()
{
parent::__construct('P', 'mm', 'A4', true, 'UTF-8', false, false);
}
/**
* set the PDF encoding
* @param string $encoding
@@ -91,6 +97,8 @@ class PDFGeneratorCore extends TCPDF
$this->font = self::DEFAULT_FONT;
if (array_key_exists($iso_lang, $this->font_by_lang))
$this->font = $this->font_by_lang[$iso_lang];
$this->setFont($this->font);
}
/**
@@ -98,7 +106,6 @@ class PDFGeneratorCore extends TCPDF
*/
public function Header()
{
$this->setFont($this->font);
$this->writehtml($this->header);
}
@@ -107,7 +114,6 @@ class PDFGeneratorCore extends TCPDF
*/
public function Footer()
{
$this->setFont($this->font);
$this->writehtml($this->footer);
}
@@ -131,7 +137,6 @@ class PDFGeneratorCore extends TCPDF
*/
public function writePage()
{
$this->SetHeaderMargin(5);
$this->SetFooterMargin(18);
$this->setMargins(10, 40, 10);