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';
109 protected $_Avery_Name =
'';
111 protected $_Margin_Left = 0;
113 protected $_Margin_Top = 0;
115 protected $_X_Space = 0;
117 protected $_Y_Space = 0;
119 protected $_X_Number = 0;
121 protected $_Y_Number = 0;
123 protected $_Width = 0;
125 protected $_Height = 0;
127 protected $_Char_Size = 10;
129 protected $_Line_Height = 10;
131 protected $_Metric =
'mm';
133 protected $_Metric_Doc =
'mm';
134 protected $_COUNTX = 1;
135 protected $_COUNTY = 1;
136 protected $_First = 1;
161 abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir =
'');
172 abstract public function addSticker(&$pdf, $outputlangs, $param);
187 $this->_Char_Size = $pt;
189 $pdf->SetFont(
'',
'', $pt);
207 protected function _Pointille(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $nbPointilles = 15)
210 $pdf->SetLineWidth($epaisseur);
211 $length = abs($x1 - $x2);
212 $hauteur = abs($y1 - $y2);
213 if ($length > $hauteur) {
214 $Pointilles = ($length / $nbPointilles) / 2;
216 $Pointilles = ($hauteur / $nbPointilles) / 2;
218 for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
219 for ($j = $i; $j <= ($i + $Pointilles); $j++) {
220 if ($j <= ($x2 - 1)) {
221 $pdf->Line($j, $y1, $j + 1, $y1);
222 $pdf->Line($j, $y2, $j + 1, $y2);
226 for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
227 for ($j = $i; $j <= ($i + $Pointilles); $j++) {
228 if ($j <= ($y2 - 1)) {
229 $pdf->Line($x1, $j, $x1, $j + 1);
230 $pdf->Line($x2, $j, $x2, $j + 1);
250 protected function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4)
253 $pdf->SetDrawColor(192, 192, 192);
255 $pdf->SetLineWidth($epaisseur);
258 $pdf->Line($x1, $y1 - $lg, $x1, $y1 + $lg);
259 $pdf->Line($x1 - $lg, $y1, $x1 + $lg, $y1);
261 $pdf->Line($x1, $y2 - $lg, $x1, $y2 + $lg);
262 $pdf->Line($x1 - $lg, $y2, $x1 + $lg, $y2);
264 $pdf->Line($x2, $y1 - $lg, $x2, $y1 + $lg);
265 $pdf->Line($x2 - $lg, $y1, $x2 + $lg, $y1);
267 $pdf->Line($x2, $y2 - $lg, $x2, $y2 + $lg);
268 $pdf->Line($x2 - $lg, $y2, $x2 + $lg, $y2);
270 $pdf->SetDrawColor(0, 0, 0);
289 return $value * $tab[$dest] / $tab[$src];
307 $_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);
308 if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
309 return $_Table_Hauteur_Chars[$pt];
327 $this->_Metric = $format[
'metric'];
328 $this->_Avery_Name = $format[
'name'];
329 $this->_Avery_Code = empty($format[
'code'])?
'':$format[
'code'];
330 $this->_Margin_Left = $this->
convertMetric($format[
'marginLeft'], $this->_Metric, $this->_Metric_Doc);
331 $this->_Margin_Top = $this->
convertMetric($format[
'marginTop'], $this->_Metric, $this->_Metric_Doc);
332 $this->_X_Space = $this->
convertMetric($format[
'SpaceX'], $this->_Metric, $this->_Metric_Doc);
333 $this->_Y_Space = $this->
convertMetric($format[
'SpaceY'], $this->_Metric, $this->_Metric_Doc);
334 $this->_X_Number = $format[
'NX'];
335 $this->_Y_Number = $format[
'NY'];
336 $this->_Width = $this->
convertMetric($format[
'width'], $this->_Metric, $this->_Metric_Doc);
337 $this->_Height = $this->
convertMetric($format[
'height'], $this->_Metric, $this->_Metric_Doc);