Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/account/genPDF.php
<?php
if (!isset($oreon))
                exit();

if(isset($error)){ echo $error;  unset($error); return;} //just to be sure
	//set up the display format ..  This will change
define('RELATIVE_PATH','include/fpdf/');
define('FPDF_FONTPATH','include/fpdf/font/');
$pdfprint=$oreon->pdfprint;
//set up the display format ..  This will change
require_once("include/fpdf/fpdf.php");             // FIXME this needs to be part of configuration file
require_once("include/fpdf/cl_pdfcard.php");
/*-------------------------------------------------
        To create the object, 2 possibilities:
        either pass a custom format via an array
        or use a built-in AVERY name
        -------------------------------------------------*/
// Example of custom format; we start at the second column
//$pdf = new PDF_Label(array('name'=>'5163', 'paper-size'=>'A4', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>100, 'NY'=>100, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>120, 'height'=>20, 'metric'=>'mm', 'font-size'=>16), 1, 2);
// Standard format
        
if ($pdfprint['avery_name']=="None") {
	$margin_left=$pdfprint['margin_left']; 
	$margin_top=$pdfprint['margin_top']; 
	$x_space=$pdfprint['x_space']; 
	$y_space=$pdfprint['y_space']; 
	$x_number=$pdfprint['x_number']; 
	$y_number=$pdfprint['y_number']; 
	$width=$pdfprint['width']; 
	$height=$pdfprint['height']; 
	$paper_size=$pdfprint['paper_size']; 
	$metric=$pdfprint['metric']; 
	$pdf = new PDF_card(array('name'=>'5163', 'paper-size'=>''.$paper_size.'', 'marginLeft'=>$margin_left, 'marginTop'=>$margin_top, 'NX'=>$x_number, 'NY'=>$y_number, 'SpaceX'=>$x_space, 'SpaceY'=>$y_space, 'width'=>$width, 'height'=>$height, 'metric'=>''.$metric.'', 'font-size'=>16), 1, 1);
}
else
$pdf = new PDF_card($pdfprint['avery_name']);

$pdf->_Set_Char_Size($pdfprint['char_size']);
$pdf->_Set_FontColor($pdfprint['font_color']);
$pdf->_Set_FontStyle(substr($pdfprint['font_style'],0,1));
$pdf->_Set_Font($pdfprint['font_name']);
$pdf->_Apply_Font_Attr();

$pdf->_Set_Point($pdfprint['print_point']);
$pdf->_Set_Cross($pdfprint['print_cross']);

$pdf->_Set_BackgroundImage($pdfprint['background_image']);
$pdf->_Set_LogoImage($pdfprint['logo_image']);
$pdf->Open();
$pdf->AddPage();

// Print labels
$locname=$_SESSION['LocName'];
foreach($UserPass as $id => $pass ) {
$pdf->Add_PDF_card(sprintf(str_replace('\n',"\n",$pdfprint['format_text']),$pdfprint['card_type_text'], $pdfprint['login_text'].$id,$pdfprint['passwd_text'].$pass,$pdfprint['validity_text'].$display,$pdfprint['location_text'].$locname),$pdfprint['header_text'],$pdfprint['footer_text']);
	$i=$i+1;

}
 //     $pdf->Output(); // can't output now because data has already been sent to the browser
$pdf->Output("tmp/list.pdf",false);
?>																										  
Return current item: phpMyPrepaid