Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2461 → Rev 2462

/trunk/jrest/bibliotheque/GenerateurPDF.php
1,16 → 1,23
<?php
 
// declare(encoding='UTF-8');
/**
* @category PHP
* @package jrest
* @author Raphaël Droz <raphael@tela-botania.org>
* @copyright 2013 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
*/
 
* Classe permettant de générer des PDFs.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Raphaël Droz <raphael@tela-botania.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
// Include the main TCPDF library (search for installation path).
date_default_timezone_set("Europe/Paris");
date_default_timezone_set('Europe/Paris');
require_once('tcpdf_config.php');
require_once('tcpdf/tcpdf.php');
 
29,14 → 36,6
$pdf->SetSubject('Étiquettes des observations');
$pdf->SetKeywords('botaniques, observations, étiquettes, cel, tela-botanica');
 
// set default header data
// $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING);
 
// set header and footer fonts
// $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
// $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
 
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
 
// set margins
44,8 → 43,6
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
 
// set auto page breaks
// $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
 
$pdf->SetFont('times', '', 11);
58,9 → 55,7
$this->pdf = $pdf;
}
 
 
 
function export($obs) {
public function export($obs) {
$pdf = &$this->pdf;
 
$i = 0;
128,7 → 123,7
 
function getlinenb2($txt) {
//var_dump($line, $this->pdf->GetStringWidth($line));
return ceil($this->pdf->GetStringWidth($txt) / $this->column_width);
return ceil($this->pdf->GetStringWidth($txt) / $this->column_width);
}
 
function getlinenb($txt) {
365,7 → 360,7
 
$this->pdf->MultiCell(80, 20,
$txt = 'Observation : ' . self::elude('Observation : ', $obs['commentaire']),
$border = 'RL', 'L', 0, 1, '', '', true);
$border = 'RL', 'L', 0, 1, '', '', true);
 
$this->pdf->Cell($w = 80, '',
$txt = 'Date : ' . strftime("%d/%m/%Y", strtotime($obs['date_observation'])),
428,7 → 423,7
$obs['commentaire'],
strftime("%Y-%m-%d", strtotime($obs['date_observation']))
);
 
}
 
 
480,7 → 475,7
$obs['commentaire'],
strftime("%Y-%m-%d", strtotime($obs['date_observation']))
);
 
}
 
}