forked from science-ation/science-ation
- Remove unused nametag stuff. It's not referenced anywhere in the code base
anymore
This commit is contained in:
parent
e7776a6b9c
commit
8c044c8309
149
lpdf.php
149
lpdf.php
@ -38,20 +38,6 @@ class lpdf
|
||||
var $page_width=8.5;
|
||||
var $page_height=11;
|
||||
|
||||
//all of these are overwritten by setNametagDimensions(width,height);
|
||||
var $nametag_width=4;
|
||||
var $nametag_height=3;
|
||||
var $nametags_per_row=2;
|
||||
var $nametags_per_column=3;
|
||||
var $nametags_per_page=6;
|
||||
|
||||
var $nametags_start_xpos;
|
||||
var $nametags_start_ypos;
|
||||
|
||||
var $current_nametag_index=0;
|
||||
var $current_nametag_col_index=0;
|
||||
var $current_nametag_row_index=1;
|
||||
|
||||
//all of these are overwritten by setLabelDimensions(width,height,xspacer,yspacer);
|
||||
var $label_width=4;
|
||||
var $label_height=2, $label_effective_height=0;
|
||||
@ -211,63 +197,6 @@ class lpdf
|
||||
|
||||
}
|
||||
|
||||
function addNametagText($Y,$text,$align="center")
|
||||
{
|
||||
$fontsize=pdf_get_value($this->pdf,"fontsize",0);
|
||||
$lineheight=ceil($fontsize*1.3);
|
||||
|
||||
$textstr=$text;
|
||||
|
||||
$texty=$this->nametag_current_ypos-$Y;
|
||||
|
||||
$nr=0;
|
||||
$prevnr=-1;
|
||||
do
|
||||
{
|
||||
//echo "textstr=$textstr";
|
||||
$len=strlen($textstr);
|
||||
// echo "(lh:$lineheight nr:$nr len:$len)".$textstr;
|
||||
|
||||
$nl=false;
|
||||
//now lets handle a newline at the beginning, just rip it off and move the yloc ourself
|
||||
while($textstr[0]=="\n")
|
||||
{
|
||||
$textstr=substr($textstr,1);
|
||||
$texty-=$lineheight/72;
|
||||
$nl=true;
|
||||
}
|
||||
|
||||
if(!$nl)
|
||||
$texty-=$lineheight/72;
|
||||
$nr=pdf_show_boxed($this->pdf,$textstr, $this->loc($this->nametag_current_xpos),$this->loc($texty),$this->loc($this->nametag_width),$lineheight,$align,null);
|
||||
|
||||
if($nr==$prevnr)
|
||||
{
|
||||
echo "in addNametagText - breaking because nr==prevnr ($nr==$prevnr) ";
|
||||
break;
|
||||
}
|
||||
|
||||
$prevnr=$nr;
|
||||
// printf("x=%f y=%f w=%f h=%f",$this->loc(0.75),$this->loc($this->yloc),$this->loc(7),$lineheight);
|
||||
// echo "$nr didnt fit";
|
||||
// echo "<br>doing: substr($textstr,-$nr) <br>";
|
||||
$textstr=substr($textstr,-$nr);
|
||||
// echo "nr=$nr";
|
||||
} while($nr>0);
|
||||
|
||||
|
||||
/*
|
||||
$this->nametag_current_ypos-=$lineheight/72;
|
||||
pdf_show_boxed($this->pdf,$text,
|
||||
$this->loc($this->nametag_current_xpos),
|
||||
$this->loc($this->nametag_current_ypos),
|
||||
$this->loc($this->nametag_width),
|
||||
$lineheight,
|
||||
"center",
|
||||
null);
|
||||
*/
|
||||
}
|
||||
|
||||
function mailingLabel($to,$co,$address,$city,$province,$postalcode)
|
||||
{
|
||||
$this->setFontSize($this->currentFontSize);
|
||||
@ -424,68 +353,6 @@ class lpdf
|
||||
$align,null);
|
||||
}
|
||||
|
||||
function newNametag()
|
||||
{
|
||||
if($this->current_nametag_index==$this->nametags_per_page)
|
||||
{
|
||||
|
||||
$this->newPage();
|
||||
$this->current_nametag_index=1;
|
||||
$this->current_nametag_col_index=0;
|
||||
$this->current_nametag_row_index=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->current_nametag_index++;
|
||||
}
|
||||
|
||||
if($this->current_nametag_col_index==$this->nametags_per_row)
|
||||
{
|
||||
|
||||
$this->current_nametag_col_index=1;
|
||||
$this->current_nametag_row_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->current_nametag_col_index++;
|
||||
}
|
||||
|
||||
$this->nametag_current_ypos=$this->nametags_start_ypos-(($this->current_nametag_row_index-1)*$this->nametag_height)-$this->nametag_height;
|
||||
$this->nametag_current_xpos=$this->nametags_start_xpos+(($this->current_nametag_col_index-1)*$this->nametag_width);
|
||||
|
||||
pdf_rect($this->pdf,
|
||||
$this->loc($this->nametag_current_xpos),
|
||||
$this->loc($this->nametag_current_ypos),
|
||||
$this->loc($this->nametag_width),
|
||||
$this->loc($this->nametag_height));
|
||||
pdf_stroke($this->pdf);
|
||||
|
||||
$this->nametag_current_ypos+=$this->nametag_height-0.25;
|
||||
|
||||
//only put the logo on the nametag if we actually have the logo
|
||||
if($this->logoimage)
|
||||
{
|
||||
//now place the logo image in the top-left-ish
|
||||
pdf_place_image($this->pdf,$this->logoimage,
|
||||
$this->loc($this->nametag_current_xpos+0.05),
|
||||
$this->loc($this->nametag_current_ypos-0.50),0.2);
|
||||
}
|
||||
|
||||
$height['title']=0.50;
|
||||
$this->nametag_current_ypos-=$height['title'];
|
||||
pdf_setfont($this->pdf,$this->headerfont,14);
|
||||
pdf_show_boxed($this->pdf,$this->page_header,
|
||||
$this->loc($this->nametag_current_xpos+0.65),
|
||||
$this->loc($this->nametag_current_ypos),
|
||||
$this->loc($this->nametag_width-0.70),
|
||||
$this->loc($height['title']),
|
||||
"center",
|
||||
null);
|
||||
pdf_setfont($this->pdf,$this->normalfont,10);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function newLabel($show_box=false, $show_fairname=false, $show_logo=false)
|
||||
{
|
||||
if($this->current_label_index==$this->labels_per_page)
|
||||
@ -799,26 +666,12 @@ class lpdf
|
||||
|
||||
}
|
||||
|
||||
//page styles: "normal" "nametags" "empty" "labels"
|
||||
//page styles: "normal" "empty" "labels"
|
||||
function setPageStyle($style="normal")
|
||||
{
|
||||
$this->page_style=$style;
|
||||
}
|
||||
|
||||
function setNametagDimensions($width,$height)
|
||||
{
|
||||
$this->nametag_width=$width;
|
||||
$this->nametag_height=$height;
|
||||
|
||||
$this->nametags_per_row=floor($this->page_width/$width);
|
||||
$this->nametags_per_column=floor($this->page_height/$height);
|
||||
$this->nametags_per_page=$this->nametags_per_row * $this->nametags_per_column;
|
||||
|
||||
$this->nametags_start_xpos=($this->page_width-$this->nametags_per_row*$width)/2;
|
||||
$this->nametags_start_ypos=$this->page_height-($this->page_height-$this->nametags_per_column*$height)/2;
|
||||
|
||||
}
|
||||
|
||||
function setLabelDimensions($width,$height,$xspacer=0.125,$yspacer=0.125,$fontsize=10)
|
||||
{
|
||||
$this->label_width=$width;
|
||||
|
Loading…
Reference in New Issue
Block a user