PHP Classes

File: XFPDFExample.php

Recommend this page to a friend!
  Classes of Stefan Kientzler   PHP PDF Table using FPDF   XFPDFExample.php   Download  
File: XFPDFExample.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP PDF Table using FPDF
Generate PDF documents with tables displaying data
Author: By
Last change:
Date: 3 years ago
Size: 870 bytes
 

Contents

Class file image Download
<?php
require_once 'autoloader.php';
require_once
'XFPDFExample.class.php';

$pdf = new ExampleXPDF();

// set some file information
$pdf->SetInfo('XFPDF', 'Example', 'PHP classes', 'Keyword1, Keyword2, ...');
$pdf->SetPageHeader('Create PDF Table', 'using extpdf package from PHPClasses.org');

// prepare grid and just insert a bulk of lines
$pdf->Prepare();

$date = time();
for (
$iRow = 1; $iRow <= 100; $iRow++) {
   
// just a simple demo - most cases data comes from DB-query ;-)
   
$row = array(
       
'text' => 'Text in var Col, Line ' . $iRow,
       
'weight' => (rand(10, 500) / 10),
       
'date' => date('Y-m-d', $date),
       
'price' => (rand(10, 2000) / 9),
       
'grp_id' => rand(1, 4)
    );
   
$pdf->Row($row);
   
$date += 24 * 60 * 60;
}
// ...and end of the grid
$pdf->EndGrid();

$pdf->CreatePDF('example');