PrestaShop uses TCPDF to produce PDFs, but the process is messy. In general, using a PHP library to produce PDFs is sufficient for simple documents, but it's not a good option if you want advanced features like CSS Level 3, grids, flex....
I suggest to use an headless browser like open source gotenberg project or an advanced API like pdfactorix which can create PDFs from data and a separate template.