54 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
55 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
56 require_once DOL_DOCUMENT_ROOT.
'/core/lib/format_cards.lib.php';
74 protected $_Avery_Name =
'';
76 protected $_Margin_Left = 0;
78 protected $_Margin_Top = 0;
80 protected $_X_Space = 0;
82 protected $_Y_Space = 0;
84 protected $_X_Number = 0;
86 protected $_Y_Number = 0;
88 protected $_Width = 0;
90 protected $_Height = 0;
92 protected $_Char_Size = 10;
94 protected $_Line_Height = 10;
96 protected $_Metric =
'mm';
98 protected $_Metric_Doc =
'mm';
99 protected $_COUNTX = 1;
100 protected $_COUNTY = 1;
101 protected $_First = 1;
124 public abstract function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir =
'');
135 public abstract function addSticker(&$pdf, $outputlangs, $param);
150 $this->_Char_Size = $pt;
152 $pdf->SetFont(
'',
'', $pt);
170 protected function _Pointille(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $nbPointilles = 15)
173 $pdf->SetLineWidth($epaisseur);
174 $length = abs($x1 - $x2);
175 $hauteur = abs($y1 - $y2);
176 if ($length > $hauteur) {
177 $Pointilles = ($length / $nbPointilles) / 2;
179 $Pointilles = ($hauteur / $nbPointilles) / 2;
181 for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
182 for ($j = $i; $j <= ($i + $Pointilles); $j++) {
183 if ($j <= ($x2 - 1)) {
184 $pdf->Line($j, $y1, $j + 1, $y1);
185 $pdf->Line($j, $y2, $j + 1, $y2);
189 for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
190 for ($j = $i; $j <= ($i + $Pointilles); $j++) {
191 if ($j <= ($y2 - 1)) {
192 $pdf->Line($x1, $j, $x1, $j + 1);
193 $pdf->Line($x2, $j, $x2, $j + 1);
213 protected function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4)
216 $pdf->SetDrawColor(192, 192, 192);
218 $pdf->SetLineWidth($epaisseur);
221 $pdf->Line($x1, $y1 - $lg, $x1, $y1 + $lg);
222 $pdf->Line($x1 - $lg, $y1, $x1 + $lg, $y1);
224 $pdf->Line($x1, $y2 - $lg, $x1, $y2 + $lg);
225 $pdf->Line($x1 - $lg, $y2, $x1 + $lg, $y2);
227 $pdf->Line($x2, $y1 - $lg, $x2, $y1 + $lg);
228 $pdf->Line($x2 - $lg, $y1, $x2 + $lg, $y1);
230 $pdf->Line($x2, $y2 - $lg, $x2, $y2 + $lg);
231 $pdf->Line($x2 - $lg, $y2, $x2 + $lg, $y2);
233 $pdf->SetDrawColor(0, 0, 0);
252 return $value * $tab[$dest] / $tab[$src];
270 $_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
271 if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
272 return $_Table_Hauteur_Chars[$pt];
290 $this->_Metric = $format[
'metric'];
291 $this->_Avery_Name = $format[
'name'];
292 $this->_Avery_Code = $format[
'code'];
293 $this->_Margin_Left = $this->
convertMetric($format[
'marginLeft'], $this->_Metric, $this->_Metric_Doc);
294 $this->_Margin_Top = $this->
convertMetric($format[
'marginTop'], $this->_Metric, $this->_Metric_Doc);
295 $this->_X_Space = $this->
convertMetric($format[
'SpaceX'], $this->_Metric, $this->_Metric_Doc);
296 $this->_Y_Space = $this->
convertMetric($format[
'SpaceY'], $this->_Metric, $this->_Metric_Doc);
297 $this->_X_Number = $format[
'NX'];
298 $this->_Y_Number = $format[
'NY'];
299 $this->_Width = $this->
convertMetric($format[
'width'], $this->_Metric, $this->_Metric_Doc);
300 $this->_Height = $this->
convertMetric($format[
'height'], $this->_Metric, $this->_Metric_Doc);
convertMetric($value, $src, $dest)
Convert units (in to mm, mm to in) $src and $dest must be 'in' or 'mm'.
_Croix(&$pdf, $x1=0, $y1=0, $x2=210, $y2=297, $epaisseur=1, $taille=4)
protected Function realisant une croix aux 4 coins des cartes
__construct($db)
Constructor.
Class to generate stick sheet with format Avery or other personalised.
addSticker(&$pdf, $outputlangs, $param)
Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) ...
$conf db
API class for accounts.
write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir= '')
Function to build PDF on disk, then output on HTTP strem.
_Pointille(&$pdf, $x1=0, $y1=0, $x2=210, $y2=297, $epaisseur=1, $nbPointilles=15)
protected Print dot line
Set_Char_Size(&$pdf, $pt)
Methode qui permet de modifier la taille des caracteres Cela modiera aussi l'espace entre chaque lign...
_Set_Format(&$pdf, $format)
protected Set format
_Get_Height_Chars($pt)
protected Give the height for a char size given.