From a46cb110ca2fe502c0a02e5b8a6e64f5d3156b28 Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 9 Jun 2010 05:21:42 +0000 Subject: [PATCH] Add logo and fairname to labels (still doesn't scale the contents of the label). --- admin/reports_editor.php | 2 -- tcpdf.inc.php | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/admin/reports_editor.php b/admin/reports_editor.php index 374cc9f..f3c8d65 100644 --- a/admin/reports_editor.php +++ b/admin/reports_editor.php @@ -411,8 +411,6 @@ $doCanvasSample = false; if($l_w && $l_h && $report['option']['type']=='label') { echo "

Label Data Locations

"; - $l_w *= 25.4; - $l_h *= 25.4; $doCanvasSample=true; $ratio=$l_h/$l_w; $canvaswidth=600; diff --git a/tcpdf.inc.php b/tcpdf.inc.php index 0413d5d..fadc56f 100644 --- a/tcpdf.inc.php +++ b/tcpdf.inc.php @@ -315,6 +315,7 @@ class pdf extends TCPDF { function label_new() { + global $config; /* Advance to new label */ // echo "cindex=$this->current_label_index, perpage=$this->labels_per_page\n"; if($this->current_label_index + 1 == $this->labels_per_page) { @@ -340,11 +341,23 @@ class pdf extends TCPDF { if($this->label_show_box) $this->label_rect(0,0,$this->label_width, $this->label_height); + $w = $this->label_width * 0.2; + $h = $this->label_height * 0.2; + if($w < $h) $h = $w; + else $w = $h; if($this->label_show_logo) { + $img_dir = $_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY'].'/data'; + /* Scale image to proportinally fit in w x h */ + $this->Image("$img_dir/logo.jpg", $this->lMargin + 1, $this->tMargin + 1, + $w, $h, '', '', '', true, + 300, '', false, false, 0, true); } if($this->label_show_fair) { - + $this->SetXY($this->lMargin + $w + 2, $this->tMargin + 1); + $this->SetFontSize(((($h / 2) - $this->cMargin) / 25.4) * 72); + $this->FitCell($this->label_width - $w - 2, $this->label_height *0.2, + $config['fairname'], 0, 0, 'L', 'M', 'scale'); } }