How to generate pdf files with php and download them
1. First download and install pdf: test the effect
2. Calling the code in php is very simple. Just use the shell_exec function. If the shell_exec function cannot be used, check whether it is in php.ini. The supplement is disabled.
3.wkhtmltopdf is very useful, but it is also somewhat unsatisfactory. The developers of wkhtmltopdf did not take this into consideration when developing, for example, this html page:
4. When I generate pdf, I want each block to be They are all one page, but the values are wrong the further they go. We still don’t know how many pixels there are in one PDF page. But wkhtmltopdf has a good method, which is to add a page-break-inside:avoid; after the style of that div, and it will be ok.
Introducing css files:
5.css style code:
6.html page Code
For more PHP knowledge, please visit the PHP Chinese websitePHP Tutorial!
The above is the detailed content of How to generate pdf files in php and download them. For more information, please follow other related articles on the PHP Chinese website!