PHP Classes

PHP PDF Table using FPDF: Generate PDF documents with tables displaying data

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (31)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 545 This week: 2All time: 5,538 This week: 40Up
Version License PHP version Categories
extfpdf 1.1.0Freely Distributable7.4PHP 5, Printing
Description 

Author

This class can generate PDF documents with tables displaying data.

It is an extension of the FPDF that takes arrays with data to display on the rows of a table and then it can generate a PDF document that displays the table on a page.

The class allows to configure the orientation of the table on the page. Other attributes can be set using functions of the FPDF base class.

Picture of Stefan Kientzler
  Performance   Level  
Name: Stefan Kientzler is available for providing paid consulting. Contact Stefan Kientzler .
Classes: 18 packages by
Country: Germany Germany
Age: 56
All time rank: 73147 in Germany Germany
Week rank: 14 Up1 in Germany Germany Up
Innovation award
Innovation award
Nominee: 11x

Winner: 6x

Recommendations

What is the best PHP save pdf to folder class?
Want to save FPDF report in a folder on the server

What is the best PHP mssql pagination class?
Example mssql pagination with php

Example

<?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');


Details

Generate PDF documents with tables displaying data

Latest Stable Version License Donate Minimum PHP Version Scrutinizer Code Quality

Dependency

this package contains a modified version of FPDF (based on Version 1.82 from 2019-12-07) with following changes: - PHP 7.4 typehinting - integrated the bookmark extension from http://www.fpdf.org/ - phpDoc comments (content from the FPDF-Manual at http://www.fpdf.org/) - PSR coding style (camel case methods, spacing, indentation, brackets) - namespace for PSR-4 autoloading - some fixes according to phpStan/scrutinizer inspections

Overview

This class can generate PDF reports with tables displaying data.

It is an extension of the FPDF that takes arrays with data to display on the rows of a table and then it can generate a PDF document that displays the table on a page.

The class allows to configure the orientation of the table on the page. Other attributes can be set using functions of the FPDF base class.

In addition to extensive column definitions such as - Date values - Currency information - formatted numerical values - graphic symbols

the package offers the possibility to automatically insert totals, subtotals and page transfers.

Usage

See the blog post here for detailed description.

History

2020-03-06 Version 1.00

* initial Version

2020-03-24 Version 1.0.1

* added functions for total, subtotals and carryover * added formating for currency, number and datetime * fixed some problems with euro-sign and german umlauts

				
2020-04-21 Version 1.0.2

* Integrated extension to set bookmarks from O.Plathey * Added new functions to set internal links within the datagrid

2020-11-23 Version 1.1.0

* Moved XPDFFont into a separate file to correspond to PSR-0 / PSR-4 (one file per class) * Set namespace to fit PSR-4 recommendations for autoloading. * Added missing PHP 7.4 type hints / docBlock changes * Support of image columns * Added separate font for subject in page header (2'nd line) * customizeable Height of the header logo


Screenshots  
  • images/xpdf-sample.jpg
  Files folder image Files  
File Role Description
Files folder imageimages (5 files)
Files folder imageOPlathey (1 directory)
Files folder imageSKien (1 directory)
Accessible without login Plain text file autoloader.php Aux. Auxiliary script
Accessible without login Plain text file example_en.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file readme.md Doc. Documentation
Accessible without login Plain text file xfpdf-sample.json Data sample format
Plain text file XFPDFExample.class.php Class Example class demonstrating use of package
Accessible without login Plain text file XFPDFExample.php Example Example script
Accessible without login Plain text file xpdf-example.pdf Output example PDF file

  Files folder image Files  /  images  
File Role Description
  Accessible without login Image file elephpant.png Icon sample Logo
  Accessible without login Image file green.png Icon Icon image
  Accessible without login Image file mysql_logo.png Icon Icon image
  Accessible without login Image file red.png Icon Icon image
  Accessible without login Image file yellow.png Icon Icon image

  Files folder image Files  /  OPlathey  
File Role Description
Files folder imageFPDF (1 file, 1 directory)

  Files folder image Files  /  OPlathey  /  FPDF  
File Role Description
Files folder imagefont (14 files)
  Plain text file FPDF.php Class Class source

  Files folder image Files  /  OPlathey  /  FPDF  /  font  
File Role Description
  Accessible without login Plain text file courier.php Aux. Auxiliary script
  Accessible without login Plain text file courierb.php Aux. Auxiliary script
  Accessible without login Plain text file courierbi.php Aux. Auxiliary script
  Accessible without login Plain text file courieri.php Aux. Auxiliary script
  Accessible without login Plain text file helvetica.php Aux. Auxiliary script
  Accessible without login Plain text file helveticab.php Aux. Auxiliary script
  Accessible without login Plain text file helveticabi.php Aux. Auxiliary script
  Accessible without login Plain text file helveticai.php Aux. Auxiliary script
  Accessible without login Plain text file symbol.php Aux. Auxiliary script
  Accessible without login Plain text file times.php Aux. Auxiliary script
  Accessible without login Plain text file timesb.php Aux. Auxiliary script
  Accessible without login Plain text file timesbi.php Aux. Auxiliary script
  Accessible without login Plain text file timesi.php Aux. Auxiliary script
  Accessible without login Plain text file zapfdingbats.php Aux. Auxiliary script

  Files folder image Files  /  SKien  
File Role Description
Files folder imageXFPDF (2 files)

  Files folder image Files  /  SKien  /  XFPDF  
File Role Description
  Plain text file XPDF.php Class Class source
  Plain text file XPDFFont.php Class Class source

 Version Control Reuses Unique User Downloads Download Rankings  
 100%1
Total:545
This week:2
All time:5,538
This week:40Up