Account for spacing between labels when generating mailing labels for the schools

Also shrink the c/o line to better accomodate long names
This commit is contained in:
james 2006-09-12 18:03:46 +00:00
parent a8d31a3603
commit e6ed1c35b0
2 changed files with 19 additions and 10 deletions

View File

@ -29,8 +29,10 @@
if($type=="pdf")
{
$card_width=4;
$card_height=2;
$card_width=4.00;
$card_height=2.00;
$xspacer=0.125;
$yspacer=0.125;
$rep=new lpdf( i18n($config['fairname']),
"School Mailing Labels",
@ -39,7 +41,7 @@
$rep->setPageStyle("labels");
$rep->newPage(8.5,11);
$rep->setLabelDimensions($card_width,$card_height);
$rep->setLabelDimensions($card_width,$card_height,$xspacer,$yspacer);
$rep->setFontSize(11);
}
else if($type=="csv") {
@ -78,6 +80,7 @@
$rep->addLabelText(0.50,$r->address);
$rep->addLabelText(0.75,"$r->city, $r->province_code");
$rep->addLabelText(1.0,$r->postalcode);
$rep->setFontSize(10);
if($r->sciencehead)
$rep->addLabelText(1.25,"c/o $r->sciencehead OR Science Head");
else

View File

@ -52,9 +52,11 @@ class lpdf
var $current_nametag_col_index=0;
var $current_nametag_row_index=1;
//all of these are overwritten by setLabelDimensions(width,height);
//all of these are overwritten by setLabelDimensions(width,height,xspacer,yspacer);
var $label_width=4;
var $label_height=2;
var $label_xspacer=0.125;
var $label_yspacer=0.125;
var $labels_per_row=2;
var $labels_per_column=5;
var $labels_per_page=10;
@ -395,8 +397,9 @@ class lpdf
$this->current_label_col_index++;
}
$this->label_current_ypos=$this->labels_start_ypos-(($this->current_label_row_index-1)*$this->label_height)-$this->label_height;
$this->label_current_xpos=$this->labels_start_xpos+(($this->current_label_col_index-1)*$this->label_width);
$this->label_current_ypos=$this->labels_start_ypos-(($this->current_label_row_index-1)*($this->label_height + $this->label_yspacer))-$this->label_height;
$this->label_current_xpos=$this->labels_start_xpos+(($this->current_label_col_index-1)*($this->label_width + $this->label_xspacer));
/*
pdf_rect($this->pdf,
@ -407,7 +410,7 @@ class lpdf
pdf_stroke($this->pdf);
*/
$this->label_current_ypos+=$this->label_height-0.25;
$this->label_current_ypos+=$this->label_height-0.15;
//only put the logo on the label if we actually have the logo
/*
@ -663,17 +666,20 @@ class lpdf
}
function setLabelDimensions($width,$height)
function setLabelDimensions($width,$height,$xspacer=0.125,$yspacer=0.125)
{
$this->label_width=$width;
$this->label_height=$height;
$this->label_xspacer=$xspacer;
$this->label_yspacer=$yspacer;
$this->labels_per_row=floor($this->page_width/$width);
$this->labels_per_column=floor($this->page_height/$height);
$this->labels_per_page=$this->labels_per_row * $this->labels_per_column;
$this->labels_start_xpos=($this->page_width-$this->labels_per_row*$width)/2;
$this->labels_start_ypos=$this->page_height-($this->page_height-$this->labels_per_column*$height)/2;
$this->labels_start_xpos=($this->page_width-$this->labels_per_row*$width - $this->label_xspacer*($this->labels_per_row-1))/2;
$this->labels_start_ypos=$this->page_height
- ($this->page_height-$this->labels_per_column*$height-$this->label_yspacer*($this->labels_per_column-1))/2;
}