Location: PHPKode > projects > pdfDOM > pdfdom-0.5/tests/borders.php
<?php
$root_path = "../";
define('FPDF_FONTPATH', $root_path."fpdf/font/");
include($root_path . "fpdf/fpdf.php");
include($root_path ."classes/class.coordinateobject.php");
include($root_path ."classes/class.container.php");
include($root_path ."classes/class.page.php");
include($root_path ."classes/class.textcontainer.php");
include($root_path ."classes/class.table.php");

$root = new pdPage();

$j = 0;
for ($k = 0; $k < 7; $k++)
{
	for ($i = 0; $i < 5; $i++)
	{
		$container1[$j] = new pdContainer();
		$container1[$j]->setBorder(1);
		$container1[$j]->coordinates->setXYWH(($i * 40)+10,($k*40)+10,20,20);
		$container1[$j]->setBackground(rand(0,255),rand(0,255),rand(0,255));

		$container1[$j]->setBorderColorLeft(rand(0,255),rand(0,255),rand(0,255));
		$container1[$j]->setBorderColorRight(rand(0,255),rand(0,255),rand(0,255));
		$container1[$j]->setBorderColorTop(rand(0,255),rand(0,255),rand(0,255));
		$container1[$j]->setBorderColorBottom(rand(0,255),rand(0,255),rand(0,255));
		$container1[$j]->setBorderLeft(rand(0,200) / 100);		
		$container1[$j]->setBorderRight(rand(0,200) / 100);
		$container1[$j]->setBorderTop(rand(0,200) / 100);
		$container1[$j]->setBorderBottom(rand(0,200) / 100);
		$root->addContainer($container1[$j]);
		
		$j++;
		
		$container1[$j] = new pdContainer();
		$container1[$j]->setBorder(1);
		$container1[$j]->coordinates->setXYWH(10,10,20,20);
		$container1[$j]->setRelativeToContainer($container1[$j-1]);
		$container1[$j]->setBorderColor(rand(0,255),rand(0,255),rand(0,255));

		if ($bg)
		{
			$container1[$j]->setBackgroundMode(pdContainerBackgroundHollow);
		}
		
		$bg = !$bg;

		
		$root->addContainer($container1[$j]);
		
		$j++;
		
			
	}
}





$root->preRender();
$root->sizeCalc();
$root->render();

$_pdfDom_PDF->setDisplayMode("fullpage");
$_pdfDom_PDF->output();	
?>
Return current item: pdfDOM