Location: PHPKode > projects > pdfDOM > pdfdom-0.5/tests/clipping.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();

$clippingContainer = new pdTextContainer();
$clippingContainer->coordinates->setXYWH(40,40,50,50);
$clippingContainer->setBorder(0.1);
$clippingContainer->setBackgroundMode(pdContainerBackgroundSolid);
$clippingContainer->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla ac turpis vitae tellus congue scelerisque. Nam risus erat, adipiscing ut, hendrerit quis, facilisis id, massa. In convallis nunc id orci. Aliquam faucibus dolor et nunc. Nam risus nisl, pulvinar sit amet, feugiat ut, fermentum vel, arcu. In hac habitasse platea dictumst. Pellentesque justo eros, convallis non, pulvinar at, fringilla id, urna. Nunc mi. Mauris non dolor posuere risus hendrerit vestibulum. In scelerisque, metus eu placerat viverra, metus dui dignissim est, nec cursus magna augue quis arcu. Duis pretium, odio vel sodales convallis, urna tortor pellentesque erat, eu pretium quam lorem nec nunc. Sed id tortor.");


$clippedContainer = new pdTextContainer();
$clippedContainer->coordinates->setXYWH(10,10,50,50);
$clippedContainer->setBorder(0.1);
$clippedContainer->below($clippingContainer);
$clippedContainer->setBackgroundMode(pdContainerBackgroundSolid);
$clippedContainer->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla ac turpis vitae tellus congue scelerisque. Nam risus erat, adipiscing ut, hendrerit quis, facilisis id, massa. In convallis nunc id orci. Aliquam faucibus dolor et nunc. Nam risus nisl, pulvinar sit amet, feugiat ut, fermentum vel, arcu. In hac habitasse platea dictumst. Pellentesque justo eros, convallis non, pulvinar at, fringilla id, urna. Nunc mi. Mauris non dolor posuere risus hendrerit vestibulum. In scelerisque, metus eu placerat viverra, metus dui dignissim est, nec cursus magna augue quis arcu. Duis pretium, odio vel sodales convallis, urna tortor pellentesque erat, eu pretium quam lorem nec nunc. Sed id tortor.");
$clippedContainer->setClippingObjects($clippingContainer);

$root->addContainer($clippingContainer);
$root->addContainer($clippedContainer);

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

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