Write PDF operators directly. No HTML-to-PDF conversion, no external dependencies. Purpose-built for table-heavy reports and large documents.
No extensions, no external libraries. Just PHP 8.2+ and you're ready to generate PDFs.
Writes PDF commands directly instead of converting HTML/CSS. Faster generation and lower memory.
Handles hundreds or thousands of rows with automatic column sizing and content-aware layout.
Automatic page breaks with repeating headers and striping continuity across pages.
Built-in FlateDecode compression reduces file size by 60-70% out of the box.
Save to any Laravel Storage disk including S3, or stream downloads with a single method call.
Generate a complete PDF report in under 10 lines of code.
use PdfParse\FlatPdf\FlatPdf;
$pdf = new FlatPdf();
$pdf->h1('Monthly Report');
$pdf->text('Generated on ' . date('Y-m-d'));
$pdf->table(
headers: ['Product', 'Revenue', 'Margin'],
rows: [
['Widget A', '$12,400', '34%'],
['Widget B', '$8,200', '41%'],
['Widget C', '$15,800', '28%'],
],
options: ['columnAligns' => ['left', 'right', 'right']]
);
$pdf->save('report.pdf');
This PDF was generated server-side with FlatPDF. What you see below is real output.
Want to customize it? Try the Playground
Revenue summaries, balance sheets, and quarterly reports with hundreds of rows.
Inventory listings with pricing, categories, and stock levels across thousands of items.
Clean, professional invoices with line items, totals, and formatted summary rows.
Export database records as formatted PDFs with proper page breaks and headers.
Install via Composer. No extensions, no configuration.
composer require pdfparse/flatpdf
Requires PHP 8.2+. No extensions needed.
Read the documentation or jump straight into the playground.