PDFPipe

Comparison

A PHP alternative to mPDF

mPDF is one of the most-used PHP PDF libraries. It ships its own HTML and CSS parser, which means its rendering output depends on mPDF's own interpretation of your markup, not a browser's. The result: CSS properties that work in your browser sometimes produce wrong or missing output in mPDF. PDFPipe renders with a real browser engine and returns the PDF over HTTP, so what you see in the browser is what you get in the PDF.

mPDF versus browser rendering

PDFPipemPDF
Rendering engineModern browserCustom HTML/CSS parser
CSS FlexboxYesNo
CSS GridYesNo
CSS custom propertiesYesNo
Web fontsAny URLNeeds font files on disk
Memory on large docsNone in PHP processHigh (all layout in PHP memory)
SVG supportFullPartial
Emoji / UnicodeFullIncomplete in some ranges
Composer dependencyNoneRequired

The custom parser gap

mPDF's parser was written to handle the HTML and CSS that existed when the library was first built. Modern CSS layout systems (Flexbox, Grid, custom properties, logical properties) are not supported because adding them would require rewriting the layout engine from scratch. Any template that uses modern CSS needs to be reworked to use only the subset mPDF understands, which in practice means maintaining a separate print stylesheet alongside your normal one.

Memory and timeouts on large documents

mPDF runs the entire layout and rendering process inside your PHP process. On documents with many pages, images, or complex tables, PHP memory usage climbs steeply and requests can time out before the PDF is returned. PDFPipe renders asynchronously on dedicated infrastructure. Your PHP process only makes one HTTP call, regardless of how large the document is.

PHP replacement

php
<?php
$html = renderView('invoices.show', ['invoice' => $invoice]);

$response = Http::withToken(config('services.pdfpipe.key'))
    ->post('https://api.pdfpipe.xyz/v1/pdf', [
        'html'    => $html,
        'options' => ['format' => 'A4'],
    ]);

abort_unless($response->successful(), 502, 'PDF render failed.');

return response($response->body(), 200, [
    'Content-Type'        => 'application/pdf',
    'Content-Disposition' => 'attachment; filename="invoice.pdf"',
]);

More PHP examples on the PHP guide and the Laravel guide.

See pricing →