HTML to PDF in PHP

Plain cURL, no Composer dependency required. Modern CSS that Dompdf and TCPDF have never supported.

HTML PDF PNG JPEG URL
No credit card required · 500 free renders/month

The whole integration

No extensions beyond cURL, which your PHP install already has.

render.php
<?php
$ch = curl_init('https://api.filecook.com/render/pdf');

curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('FILECOOK_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'html'    => '<h1>Invoice #1042</h1>',
        'options' => ['format' => 'A4', 'margin' => '12mm'],
    ]),
]);

$pdf = curl_exec($ch);
curl_close($ch);

file_put_contents('invoice.pdf', $pdf);

Why the classic PHP libraries struggle

Dompdf and TCPDF are pure-PHP layout engines. That makes them easy to install and genuinely useful for simple, table-driven documents — but they implement only a subset of CSS, and neither executes JavaScript. Flexbox and Grid layouts collapse, and anything a front-end library draws at runtime never appears.

  • Filecook renders in Chromium, so the PDF matches what you see in the browser
  • No PHP memory_limit tuning for large documents — the work happens off-box
  • No pinned library version quietly breaking on a PHP upgrade

Laravel, Symfony, and WordPress

In Laravel, render a Blade view with view()->render() and post the string. In Symfony, do the same with Twig. In WordPress, capture a template with output buffering. In every case the API takes a string of HTML and hands back bytes, so it slots in wherever you already build markup.

Frequently asked questions

Can I use this from Laravel?
Yes. Render a Blade view to a string and post it as the html field, then return the response bytes as a download. Laravel’s HTTP client works just as well as raw cURL.
Will my existing Dompdf templates work?
Usually better than before, since Filecook supports far more CSS than Dompdf. You may want to remove workarounds you added for Dompdf’s limitations.
Do you support modern CSS like Grid and Flexbox?
Yes. Filecook renders on the latest Chromium, so CSS Grid, Flexbox, custom properties, and modern selectors all behave exactly as they do in Chrome. If it looks right in your browser, it looks right in the PDF.
Can I use Google Fonts or my own web fonts?
Yes. Load them the normal way — an @import in your stylesheet, a <link> tag, or a self-hosted @font-face rule. The renderer waits for fonts to load before it captures the page.
Is there a free tier?
Yes — 500 renders a month, free forever, with no credit card required. That covers the playground, the full API, and both PDF and image output.

Keep reading

Ready to start cooking?

500 renders a month, free forever. No credit card, no sales call.