How to Simply Generate a PDF From HTML in Symfony With WeasyPrint

This page summarizes the projects mentioned and recommended in the original post on dev.to

Stream - Scalable APIs for Chat, Feeds, Moderation, & Video.
Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.
getstream.io
featured
InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
  1. Snappy

    PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage (by KnpLabs)

    When I first looked for solutions to generate a PDF document in a Symfony application, I was amazed to find that a SymfonyCast was made about this. It features the PHP library Snappy, which is essentially a wrapper around wkhtmltopdf.

  2. Stream

    Stream - Scalable APIs for Chat, Feeds, Moderation, & Video. Stream helps developers build engaging apps that scale to millions with performant and flexible Chat, Feeds, Moderation, and Video APIs and SDKs powered by a global edge network and enterprise-grade infrastructure.

    Stream logo
  3. wkhtmltopdf-windows

    wkhtmltopdf - Convert html to pdf using webkit (qtwebkit). Windows binaries

    wkhtmltopdf

  4. WeasyPrintBundle

    Easily create PDF in Symfony by converting HTML using WeasyPrint

    The advantage of this approach is that it can be used as a command-line tool with other languages, just like the bundle for Symfony that I will present in this article!

  5. Twig

    Twig, the flexible, fast, and secure template language for PHP

    The first step before generating the PDF is writing the HTML. To generate the HTML string, we will use the Twig template engine, which is the default one in Symfony. It comes with tons of features such as inheritance, blocks, filters, functions, and more.

  6. WeasyPrint

    The awesome document factory

    Performance is not the strength of WeasyPrint, meaning that heavy HTML files will increase generation time. You should always compress images before attaching them, as they are not compressed by default. Generating a 50-page-long PDF may take up to a minute in extreme cases, although multi-page documents generated on my project take fewer than 2 seconds to generate.

  7. gotenberg

    A developer-friendly API for converting numerous document formats into PDF files, and more!

    If you also want to convert Markdown or LibreOffice formats, the self-hosted API Gotenberg is worth checking out

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Lyon Drops Microsoft to Boost Digital Sovereignty

    2 projects | news.ycombinator.com | 25 Jun 2025
  • Show HN: PlutoBook – Fast, lightweight C++ library for generating PDF from HTML

    2 projects | news.ycombinator.com | 19 Jun 2025
  • Dompdf VS plutoprint - a user suggested alternative

    2 projects | 19 Jun 2025
  • pagedjs VS plutoprint - a user suggested alternative

    2 projects | 19 Jun 2025
  • plutoprint VS WeasyPrint - a user suggested alternative

    2 projects | 19 Jun 2025

Did you know that PHP is
the 14th most popular programming language
based on number of references?