Source for file idd_pdf.php
Documentation is available at idd_pdf.php
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
// //////////////////////////////////
// formattage titres item & info
// //////////////////////////////////
$this->MultiCell(0,DOC_HEIGHT+ 1,$libelle,0,'L',1);
// //////////////////////////////////
// gestion header & footer
// //////////////////////////////////
$content = $report_settings['author'];
if(!empty($report_settings['mail_author'])) {
$content .= ' ('. $report_settings['mail_author']. ')';
$mailto= 'mailto:'. $report_settings['mail_author'];
$content_comp= !empty($report_settings['service_author']) ? ' -- '. $report_settings['service_author'] : '';
$content_comp.= !empty($report_settings['adress_author']) ? ' -- '. $report_settings['adress_author'] : '';
$this->Line($this->GetX(), $this->GetY(), $this->GetX()+ 190, $this->GetY());
$this->Cell($this->GetStringWidth($content), 4, $content, 0, 0, 'L', 0, $mailto);
$this->Cell(0, 4, $content_comp, 0, 0, 'L');
// Numéro et nombre de pages
$this->Cell(0, 4, $lang['divers']['page']. ' ' . $this->PageNo() . '/{nb}', 0, 0, 'R');
$content = formatText($report_settings['title']) . ' - '. SITE_CITY_NAME;
//$this->Cell(0, 4, $lang['statut']['published_on'].' '. $today, 0, 0, 'L');
$this->Cell(0, 4, $today, 0, 0, 'L');
$this->Cell(0, 4, $content, 0, 1, 'R');
$this->Line($this->GetX(), $this->GetY(), $this->GetX()+ 190, $this->GetY());
//$this->Image('inc_report/logo_p.png', $this->GetX(), $this->GetY());
// //////////////////////////////////
// gestion dynamique des couleurs
// //////////////////////////////////
* @param string $type 'TRACE' | 'FONT' | 'BCKG'
function SetColor($ink = 'DOC_COLOR', $type = 'FONT')
$this->SetTextColor($r, $g, $b);
$this->SetDrawColor($r, $g, $b);
$this->SetFillColor($r, $g, $b);
// //////////////////////////////////
// //////////////////////////////////
function Bookmark($txt, $level = 0, $y = 0)
$this->outlines[] = array('t' => $txt, 'l' => $level, 'y' => $y, 'p' => $this->PageNo());
$parent = $lru[$o['l']- 1];
// Set parent and last pointers
$this->outlines[$i]['parent'] = $parent;
// Level increasing: set first pointer
if ($o['l'] <= $level and $i > 0) {
// Set prev and next pointers
$this->_out('<</Title ' . $this->_textstring($o['t']));
//$this->_out('<</Title ' . $this->_escapetext($o['t']));
$this->_out('/Parent ' . ($n + $o['parent']) . ' 0 R');
$this->_out('/Prev ' . ($n + $o['prev']) . ' 0 R');
$this->_out('/Next ' . ($n + $o['next']) . ' 0 R');
$this->_out('/First ' . ($n + $o['first']) . ' 0 R');
$this->_out('/Last ' . ($n + $o['last']) . ' 0 R');
$this->_out(sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]', 1 + 2 * $o['p'], ($this->h - $o['y']) * $this->k));
$this->_out('/Count 0>>');
$this->_out('<</Type /Outlines /First ' . $n . ' 0 R');
$this->_out('/Last ' . ($n + $lru[0]) . ' 0 R>>');
$this->_out('/Outlines ' . $this->OutlineRoot . ' 0 R');
$this->_out('/PageMode /UseOutlines');
// //////////////////////////////////
// //////////////////////////////////
$this->Cell(0, DOC_HEIGHT, $lang['dashboard']['rap_summary'], 0, 2, 'C');
$size= sizeof($this->outlines)- 1; // -1 pour supprimer le bookmark de l'index
$PageCellSize= $this->GetStringWidth('p. '. $this->outlines[$size- 1]['p'])+ 2;
for ($i= 0;$i< $size;$i++ ){
$strsize= $this->GetStringWidth($str);
$avail_size= $this->w- $this->lMargin- $this->rMargin- $PageCellSize- ($level* 8)- 4;
while ($strsize>= $avail_size){
$strsize= $this->GetStringWidth($str);
$this->Cell($strsize+ 2,$this->FontSize+ 2,$str, 0, 0, 'L', 0, $link);
$w= $this->w- $this->lMargin- $this->rMargin- $PageCellSize- ($level* 8)- ($strsize+ 2);
$nb= $w/ $this->GetStringWidth('.');
$this->Cell($w,$this->FontSize+ 2,$dots,0,0,'R');
$this->Cell($PageCellSize,$this->FontSize+ 2,'p. '. $this->outlines[$i]['p'],0,1,'R');
// //////////////////////////////////
// Tableau avec multicells
// //////////////////////////////////
// Tableau des largeurs de colonnes
// Tableau des alignements de colonnes
// Calcule la hauteur de la ligne
for($i = 0;$i < count($data);$i++ )
// Effectue un saut de page si nécessaire
for($i = 0;$i < count($data);$i++ ) {
// Sauve la position courante
$this->Rect($x, $y, $w, $h);
$this->MultiCell($w, 5, $data[$i], 0, $a);
$this->SetXY($x + $w, $y);
// Si la hauteur h provoque un d�bordement, saut de page manuel
if ($this->GetY() + $h > $this->PageBreakTrigger)
$this->AddPage($this->CurOrientation);
// Calcule le nombre de lignes qu'occupe un MultiCell de largeur w
$cw = &$this->CurrentFont['cw'];
$w = $this->w - $this->rMargin - $this->x;
$wmax = ($w- 2 * $this->cMargin) * 1000 / $this->FontSize;
if ($nb > 0 and $s[$nb- 1] == "\n")
// //////////////////////////////////
// import d'image en memoire
// //////////////////////////////////
function MEM_IMAGE($orientation = 'P', $unit = 'mm', $format = 'A4')
$this->FPDF($orientation, $unit, $format);
// Register var stream protocol (requires PHP>=4.3.2)
// Read some bytes from string
$string = substr($var, $pos, $n);
// Read a 4-byte integer from string
$this->Error('Not a PNG image');
$this->Error('Incorrect PNG Image');
$this->Error('16-bit depth not supported: ' . $file);
$colspace = 'DeviceGray';
$this->Error('Alpha channel not supported: ' . $file);
$this->Error('Unknown compression method: ' . $file);
$this->Error('Unknown filter method: ' . $file);
$this->Error('Interlacing not supported: ' . $file);
$parms = '/DecodeParms <</Predictor 15 /Colors ' . ($ct == 2 ? 3 : 1) . ' /BitsPerComponent ' . $bpc . ' /Columns ' . $w . '>>';
// Scan chunks looking for palette, transparency and image data
} elseif ($type == 'tRNS') {
// Read transparency info
} elseif ($type == 'IDAT') {
$data .= $this->_readstr($var, $pos, $n);
} elseif ($type == 'IEND')
if ($colspace == 'Indexed' and empty($pal))
$this->Error('Missing palette in ' . $file);
function MemImage($data, $x, $y, $w = 0, $h = 0, $link = '')
// Put the PNG image stored in $data
if (!isset ($this->images[$id])) {
$info['i'] = count($this->images) + 1;
$this->images[$id] = $info;
$info = $this->images[$id];
// Automatic width and height calculation if needed
if ($w == 0 and $h == 0) {
$w = $info['w'] / $this->k;
$h = $info['h'] / $this->k;
$w = $h * $info['w'] / $info['h'];
$h = $w * $info['h'] / $info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q', $w * $this->k, $h * $this->k, $x * $this->k, ($this->h - ($y + $h)) * $this->k, $info['i']));
$this->Link($x, $y, $w, $h, $link);
|