Esempio n. 1
0
<?php

require 'clipping.php';
$pdf = new PDF_Clipping();
$pdf->AddPage();
//example of clipped cell
$pdf->SetFont('Arial', '', 14);
$pdf->SetX(72);
$pdf->ClippedCell(60, 6, 'These are clipping examples', 1);
//example of clipping text
$pdf->SetFont('Arial', 'B', 120);
//set the outline color
$pdf->SetDrawColor(0);
//set the outline width (note that only its outer half will be shown)
$pdf->SetLineWidth(2);
//draw the clipping text
$pdf->ClippingText(40, 55, 'CLIPS', true);
//fill it with the image
$pdf->Image('clips.jpg', 40, 10, 130);
//remove the clipping
$pdf->UnsetClipping();
//example of clipping rectangle
$pdf->ClippingRect(45, 65, 116, 20, true);
$pdf->Image('clips.jpg', 40, 10, 130);
$pdf->UnsetClipping();
//example of clipping ellipse
$pdf->ClippingEllipse(61, 104, 16, 10, true);
$pdf->Image('clips.jpg', 40, 10, 130);
$pdf->UnsetClipping();
//example of clipping circle
$pdf->ClippingCircle(103, 104, 10, true);
 function AddPage($orientation = '', $header = false, $categories_name = '')
 {
     parent::AddPage($orientation);
     if ($this->parameter_arr['bgimage_display'] == '1') {
         $file = PDF_IMAGE_DIR . $this->parameter_arr['bgimage_image'];
         if (file_exists($file)) {
             $i = getimagesize($file);
             $px = ($this->w - $i[0] / $this->k) / 2;
             $py = ($this->h - $i[1] / $this->k) / 2;
             if ($px < 0) {
                 $px = 0;
             }
             if ($py < 0) {
                 $py = 0;
             }
             $this->Image($file, $px, $py);
         } else {
             // file not exists
             $this->format_text('', '#000000', 'arial', 10);
             $this->Cell(50, 30, 'Error: File ' . DECKBLATT . ' doesn\'t exists.');
         }
     }
     if ($this->parameter_arr['grids'] == '1') {
         $this->draw_grids();
     }
     if ($this->demomode) {
         //      $this->demoinfo();
     }
 }