Best way to create a PDF file from MySQL: TCPDF / FPDF or FDF?

Our company allows its customers to view reports through our website. Pages are based on php, and data is collected from MySQL. These reports were written long ago and include inline css. The pages themselves look great, but the print version is not enough. I want to accept reports and create visually appealing “printed” pages containing our branding.

I have found three solutions so far.

  • @Media Print Stylesheets

    This is the easiest way, but does not give me full control over the layouts. I need landscape mode and need to control where the page break occurs, so this method was excluded from my list of possible solutions. Reports are created by cyclizing through PHP data, so although I can always put a page break after or, for example, I cannot stop a page break before it gets to the next data set.

  • TCPDF / FPDF

    From what I saw, these classes will give me all the control I need for a PDF client. The challenge is that this seems to be a bit more advanced than what is required for programming, and all the inline CSS contained in the HTML tables can discard the formatting.

  • Fdf

    , . PDF , MySQL. FDF, . PDF, , PDF 2.

, ? "", ?

.

+4
4

TCPDF , . HTML, , .

+5

SO .

, mPDF. , , , ( ).

+4

FPDF , FPDF PDF .

I see that some people want to write HTML / CSS to create PDF, but you will always have differences, because the browser parses HTML / CSS differently than when using it in PDF.

Using the built-in FPDF method, I was able to get exactly what I wanted, and did not see any problems (for now).

0
source

Source: https://habr.com/ru/post/1524782/


All Articles