Current Path : /web/htdocs/www.entinoprofit.org/home/database/
Upload File :
Current File : /web/htdocs/www.entinoprofit.org/home/database/ref2pdf.php

<?php
include_once("include/config.php");
include_once("include/auth.lib.php");

require_once("html2pdf/html2fpdf.php");

$id = $_GET['id'];

$query = "SELECT * FROM referente WHERE id = '$id'";
$postdb = mysql_query($query) or die (mysql_error());
$array = mysql_fetch_array($postdb, MYSQL_BOTH);

$referente = $array['nome'].' '.$array['cognome'];
$progetto = $array['progetto'];
$contatti = $array['tel'].' - '.$array['mail'];
$indirizzo = $array['indirizzo'];


$image_info = 'http://www.entinoprofit.org/database/images/ModuloRef1.jpeg';


$image_text = array(

	array(  //
        'x'     => 269,
        'y'     => 416,
        'color' => array(103, 103, 103),
        'font'  => 1,
		'size' => 18,
        'text'  => $progetto
    ),
	array(  //
        'x'     => 803,
        'y'     => 416,
        'color' => array(103, 103, 103),
        'font'  => 1,
		'size' => 18,
        'text'  => $indirizzo
    ),
	array(  //
        'x'     => 230,
        'y'     => 491,
        'color' => array(103, 103, 103),
        'font'  => 1,
		'size' => 18,
        'text'  => $referente
    ),
	array( //
        'x'     => 700,
        'y'     => 491,
        'color' => array(103, 103, 103),
        'font'  => 1,
		'size' => 18,
        'text'  => $contatti
    )
);
	
$gdfonts = array(
    'arial'
);


$im = @imagecreatefromjpeg($image_info);
$rgb = ( isset($image_info['color']) ? $image_info['color'] : array(255, 255, 255) );
$bgColor = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);

for( $i = 0; $i < count($image_text); $i++ )
{
    if( !is_numeric($image_text[$i]['font']) )
    {
        $font = 1;
    }
    else if( $image_text[$i]['font'] < 0 )
    {
        $font = $image_text[$i]['font'] * -1;
    }
    else
    {
        if( !($font = @imageloadfont('./fonts_gd/04b25.gdf')) )
        {
            $font = 1;
        }
    }
	$fonts = './fonts_gd/arial.ttf';
	$black = imagecolorallocate($im, 0, 0, 0);
    $rgb = $image_text[$i]['color'];
	$size = $image_text[$i]['size'];
    $fgColor = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);
	
	imagettftext($im, $size, 0, $image_text[$i]['x'], $image_text[$i]['y'], $black, $fonts, $image_text[$i]['text']);

}
imagejpeg($im,"ModuloRef1.jpg",100);

$content = "<page><img width='100%' src='http://www.entinoprofit.org/database/ModuloRef1.jpg'></page>";
$content .= "<page><img width='100%' src='http://www.entinoprofit.org/database/images/ModuloRef2.jpeg'></page>";


	$pdf=new HTML2FPDF();
	$pdf -> AddPage('P','A4','fr');
	$pdf -> WriteHTML($content);
	$pdf -> Output ('ref_'.$id.'.pdf','D');
	
?>