arabel-pdf
Zero-dependency PHP PDF library
Generate invoices, reports and certificates programmatically in PHP. No system dependencies. No configuration. Just Composer.
composer require arabel/pdf
Everything you need, nothing you don't
arabel-pdf ships with a focused feature set for document generation — no bloat, no system libraries, no surprises.
Zero dependencies
Pure PHP. No wkhtmltopdf, Ghostscript, ImageMagick or any other system library required.
UTF-8 text
Full Unicode support. Render any language, accented characters and special symbols.
Tables
Complex multi-column tables with custom headers, cell padding and border control.
Images
JPEG and PNG images with pixel-perfect positioning. Works with URLs and local file paths.
Multi-page
Automatic page breaks, headers and footers, page numbering across documents of any length.
Variable system
Use {{clientName}} placeholders — fill at runtime for invoices, certificates and bulk generation.
Visual builder export
Design visually in Arabel, export clean PHP code targeting arabel-pdf — ready to run in your project.
MIT licensed
Use in personal and commercial projects. No attribution required. Fork it, modify it, ship it.
Up and running in 60 seconds
arabel-pdf requires PHP 8.1 or higher. Install it with Composer:
Install via Composer
Run this in your project root. No additional configuration needed.
composer require arabel/pdf
Require the autoloader
Include Composer's autoloader at the top of your PHP file.
<?php
require 'vendor/autoload.php';
use Arabel\Pdf\Document;
Generate your first PDF
That's it. You're ready to generate PDFs.
$doc = new Document();
$doc->addPage();
$doc->text('Hello World', ['fontSize' => 24, 'align' => 'C']);
$doc->output('hello.pdf');
Common use cases
Invoice with dynamic data
<?php
require 'vendor/autoload.php';
use Arabel\Pdf\Document;
$doc = new Document(['margins' => ['top' => 15, 'right' => 15, 'bottom' => 15, 'left' => 15]]);
$doc->addPage();
// Header
$doc->text('INVOICE #2026-001', ['fontSize' => 18, 'fontStyle' => 'B']);
$doc->text('Issued: ' . date('d/m/Y'), ['fontSize' => 10, 'color' => '#6b7280']);
$doc->spacer(8);
// Client
$doc->text('Bill to: Acme Corp', ['fontSize' => 11]);
$doc->spacer(12);
// Items table
$doc->table([
'headers' => ['Description', 'Qty', 'Unit', 'Total'],
'rows' => [
['PDF Builder Pro', '1', '€49.00', '€49.00'],
['Setup fee', '1', '€0.00', '€0.00'],
],
'headerBg' => '#a78bfa',
]);
$doc->spacer(8);
$doc->text('Total: €49.00', ['align' => 'R', 'fontSize' => 12, 'fontStyle' => 'B']);
$doc->output('invoice.pdf');
Certificate with variable substitution
$vars = ['name' => 'Jane Doe', 'course' => 'PHP Mastery', 'date' => '14 May 2026'];
$doc = new Document();
$doc->addPage();
$doc->text('Certificate of Completion', ['fontSize' => 24, 'align' => 'C', 'fontStyle' => 'B']);
$doc->spacer(16);
$doc->text('This certifies that {{name}}', ['vars' => $vars, 'align' => 'C']);
$doc->text('has completed {{course}} on {{date}}', ['vars' => $vars, 'align' => 'C']);
$doc->output('certificate.pdf');
💡 Tip: Design your layout visually in the Arabel PDF Builder, then export → PHP to get production-ready arabel-pdf code automatically.
Document API
All methods are chainable. The $doc instance is your entry point.
| Method | Parameters | Description |
|---|---|---|
| new Document() | array $options = [] | Create a new document. Options: margins, pageSize, orientation. |
| addPage() | array $options = [] | Add a new page. Optional: size, orientation. |
| text() | string $text, array $options = [] | Write text. Options: fontSize, fontStyle, color, align, vars. |
| table() | array $config | Render a table. Config: headers, rows, headerBg, cellPadding. |
| image() | string $src, array $options = [] | Insert image (JPEG/PNG). Options: x, y, width, height. |
| spacer() | int $height = 8 | Add vertical whitespace (in mm). |
| hr() | array $options = [] | Draw a horizontal rule. Options: color, width, style. |
| setHeader() | callable $fn | Set a header callback — called automatically on every page. |
| setFooter() | callable $fn | Set a footer callback — called automatically on every page. |
| output() | string $filename, string $dest = 'F' | Output the PDF. Destinations: 'F' file, 'D' download, 'S' string, 'I' browser. |
How arabel-pdf compares
Choosing a PHP PDF library? Here's how arabel-pdf stacks up against the alternatives.
| Feature | arabel-pdf | mPDF | FPDF | TCPDF | Dompdf |
|---|---|---|---|---|---|
| Zero dependencies | ✓ | ✗ | ✓ | ✓ | ✗ |
| Composer install | ✓ | ✓ | ✗ | ✗ | ✓ |
| PHP 8.1+ native | ✓ | ✓ | ~ | ✓ | ✓ |
| Visual builder | ✓ | ✗ | ✗ | ✗ | ✗ |
| Variable system | ✓ | ✗ | ✗ | ✗ | ✗ |
| License | MIT | GPL-2 | FPDF | LGPL | LGPL |
| UTF-8 support | ✓ | ✓ | Plugin | ✓ | ✓ |
Frequently asked questions
composer require arabel/pdf in your project root. PHP 8.1 or higher required. No other setup needed.