Zero Dependencies

A PHP PDF writer built for speed

Write PDF operators directly. No HTML-to-PDF conversion, no external dependencies. Purpose-built for table-heavy reports and large documents.

Why FlatPDF?

Zero Dependencies

No extensions, no external libraries. Just PHP 8.2+ and you're ready to generate PDFs.

Direct PDF Operators

Writes PDF commands directly instead of converting HTML/CSS. Faster generation and lower memory.

Blazing Fast Tables

Handles hundreds or thousands of rows with automatic column sizing and content-aware layout.

Smart Page Breaks

Automatic page breaks with repeating headers and striping continuity across pages.

Stream Compression

Built-in FlateDecode compression reduces file size by 60-70% out of the box.

Laravel Integration

Save to any Laravel Storage disk including S3, or stream downloads with a single method call.

Simple, expressive API

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

See it in action

This PDF was generated server-side with FlatPDF. What you see below is real output.

Want to customize it? Try the Playground

Built for real-world documents

Financial Reports

Revenue summaries, balance sheets, and quarterly reports with hundreds of rows.

Product Catalogs

Inventory listings with pricing, categories, and stock levels across thousands of items.

Invoices & Receipts

Clean, professional invoices with line items, totals, and formatted summary rows.

Data Exports

Export database records as formatted PDFs with proper page breaks and headers.

Get started in seconds

Install via Composer. No extensions, no configuration.

composer require pdfparse/flatpdf

Requires PHP 8.2+. No extensions needed.

Ready to generate PDFs?

Read the documentation or jump straight into the playground.