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';
104 protected $_Avery_Name =
'';
106 protected $_Margin_Left = 0;
108 protected $_Margin_Top = 0;
110 protected $_X_Space = 0;
112 protected $_Y_Space = 0;
114 protected $_X_Number = 0;
116 protected $_Y_Number = 0;
118 protected $_Width = 0;
120 protected $_Height = 0;
122 protected $_Char_Size = 10;
124 protected $_Line_Height = 10;
126 protected $_Metric =
'mm';
128 protected $_Metric_Doc =
'mm';
129 protected $_COUNTX = 1;
130 protected $_COUNTY = 1;
131 protected $_First = 1;
156 abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir =
'');
167 abstract public function addSticker(&$pdf, $outputlangs, $param);
182 $this->_Char_Size = $pt;
184 $pdf->SetFont(
'',
'', $pt);
202 protected function _Pointille(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $nbPointilles = 15)
205 $pdf->SetLineWidth($epaisseur);
206 $length = abs($x1 - $x2);
207 $hauteur = abs($y1 - $y2);
208 if ($length > $hauteur) {
209 $Pointilles = ($length / $nbPointilles) / 2;
211 $Pointilles = ($hauteur / $nbPointilles) / 2;
213 for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
214 for ($j = $i; $j <= ($i + $Pointilles); $j++) {
215 if ($j <= ($x2 - 1)) {
216 $pdf->Line($j, $y1, $j + 1, $y1);
217 $pdf->Line($j, $y2, $j + 1, $y2);
221 for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
222 for ($j = $i; $j <= ($i + $Pointilles); $j++) {
223 if ($j <= ($y2 - 1)) {
224 $pdf->Line($x1, $j, $x1, $j + 1);
225 $pdf->Line($x2, $j, $x2, $j + 1);
245 protected function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4)
248 $pdf->SetDrawColor(192, 192, 192);
250 $pdf->SetLineWidth($epaisseur);
253 $pdf->Line($x1, $y1 - $lg, $x1, $y1 + $lg);
254 $pdf->Line($x1 - $lg, $y1, $x1 + $lg, $y1);
256 $pdf->Line($x1, $y2 - $lg, $x1, $y2 + $lg);
257 $pdf->Line($x1 - $lg, $y2, $x1 + $lg, $y2);
259 $pdf->Line($x2, $y1 - $lg, $x2, $y1 + $lg);
260 $pdf->Line($x2 - $lg, $y1, $x2 + $lg, $y1);
262 $pdf->Line($x2, $y2 - $lg, $x2, $y2 + $lg);
263 $pdf->Line($x2 - $lg, $y2, $x2 + $lg, $y2);
265 $pdf->SetDrawColor(0, 0, 0);
284 return $value * $tab[$dest] / $tab[$src];
302 $_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);
303 if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
304 return $_Table_Hauteur_Chars[$pt];
322 $this->_Metric = $format[
'metric'];
323 $this->_Avery_Name = $format[
'name'];
324 $this->_Avery_Code = empty($format[
'code'])?
'':$format[
'code'];
325 $this->_Margin_Left = $this->
convertMetric($format[
'marginLeft'], $this->_Metric, $this->_Metric_Doc);
326 $this->_Margin_Top = $this->
convertMetric($format[
'marginTop'], $this->_Metric, $this->_Metric_Doc);
327 $this->_X_Space = $this->
convertMetric($format[
'SpaceX'], $this->_Metric, $this->_Metric_Doc);
328 $this->_Y_Space = $this->
convertMetric($format[
'SpaceY'], $this->_Metric, $this->_Metric_Doc);
329 $this->_X_Number = $format[
'NX'];
330 $this->_Y_Number = $format[
'NY'];
331 $this->_Width = $this->
convertMetric($format[
'width'], $this->_Metric, $this->_Metric_Doc);
332 $this->_Height = $this->
convertMetric($format[
'height'], $this->_Metric, $this->_Metric_Doc);
Class to generate stick sheet with format Avery or other personalised.
_Get_Height_Chars($pt)
protected Give the height for a char size given.
_Croix(&$pdf, $x1=0, $y1=0, $x2=210, $y2=297, $epaisseur=1, $taille=4)
protected Function realisant une croix aux 4 coins des cartes
Set_Char_Size(&$pdf, $pt)
Methode qui permet de modifier la taille des caracteres Cela modiera aussi l'espace entre chaque lign...
convertMetric($value, $src, $dest)
Convert units (in to mm, mm to in) $src and $dest must be 'in' or 'mm'.
_Set_Format(&$pdf, $format)
protected Set format
__construct($db)
Constructor.
_Pointille(&$pdf, $x1=0, $y1=0, $x2=210, $y2=297, $epaisseur=1, $nbPointilles=15)
protected Print dot line
write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir='')
Function to build PDF on disk, then output on HTTP strem.
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.