What is the best way to create PDF files with PHP
Anton Dachauer

Anton Dachauer @antondachauer

Location:
Nuremberg, Germany
Joined:
Nov 29, 2020

What is the best way to create PDF files with PHP

Publish Date: Dec 7 '20
3 5

Hello, what is the best and easiest way to create PDF files with PHP?

I know about libs like fpdf, tcpdf and wkhtmltopdf. But they have all their own limitations.

What is your preferred way to create pdf files with php, optimaly by transforming a html file?

Comments 5 total

  • Carlos Núñez
    Carlos NúñezDec 7, 2020

    I've been using TCPDF with Laravel for simple or complex printing or parsing html to pdf

  • Sak
    SakDec 7, 2020

    I used "spipu/html2pdf" for a while, then switched to mpdf (way faster, and a little more css complaint).

    The workflow always being: take the html, give me the pdf.

    No mater what you choose, be prepared for some pain...

  • Marcus
    MarcusDec 7, 2020

    I got pretty far with wkhtmltopdf, but it can be tricky or one is not able to install the latest version at all (depending on hosting plan)

    There is a python lib weasy print, that seems to be good, but you need to install a ton of stuff.

    Typeset.sh typeset.sh/en/ is pure php and seems to be pretty good, but it is expensive.

    Here is an overview: html2pdf.guru/

Add comment