Search by

camilord / xfpdf

camilo3rd

Extended FPDF include FPDF, FPDF Protection, HTML2PDF, etc

Package info

github.com/camilord/xfpdf

pkg:composer/camilord/xfpdf

Statistics

Installs: 48 540

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.20 2026-11-02 07:13 UTC

README

PHP 7.4+ License: MIT Tests Coverage

Extended FPDF including FPDF, FPDF Protection, HTML2PDF, FPDI and helpers.

The FPDF library is made up of the following elements:

  • the main file, fpdf.php, which contains the class
  • the font definition files located in the font directory

The font definition files are necessary as soon as you want to output some text in a document. If they are not accessible, the SetFont() method will produce the following error:

FPDF error: Could not include font definition file

Remarks:

  • Only the files corresponding to the fonts actually used are necessary
  • The tutorials provided in this package are ready to be executed

Requirements

  • PHP 7.4 or 8.4+
  • Composer

Installation

composer require camilord/xfpdf

Basic usage

use camilord\xfpdf\XFPDF_CORE;

$pdf = new XFPDF_CORE();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->Cell(40, 10, 'Hello World!');
$pdf->Output();

Or extend the core class:

use camilord\xfpdf\XFPDF_CORE;

class MyPDF extends XFPDF_CORE
{
    // custom header/footer or helpers
}

Features

  • FPDF 1.7 compatible API
  • HTML to PDF (HTML2PDF / XFPDF_CORE::WriteHTML)
  • PDF protection (FPDF_Protection)
  • FPDI page import and templates
  • Font utilities in makefont/

Development

Install dependencies:

composer install

Run the test suite:

vendor/bin/phpunit

Run with coverage:

XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text

PHP compatibility

The codebase is tested on PHP 7.4 and PHP 8.4. Deprecated and removed PHP features have been replaced with compatible alternatives while keeping the public API intact.