如何在PHP中将HTML转换为pdf

问题描述:

我需要将带有css的html页面转换为php中的pdf格式。



我尝试了什么:



尝试使用wkhtmltopdf,很难实现

I need to convert html page with css to pdf in php .

What I have tried:

tried with wkhtmltopdf ,its to hard to implement

选择符合您需求的HTML到PDF命令行转换器工具安装它。



阅读工具文档并使用命令行执行转换,直到获得所需的输出。然后将命令传递给PHP PHP:shell_exec - Manual [ ^ ]功能。



如果您在使用该工具时遇到问题,请尝试使用支持选项。对于 wkhtmltopdf ,这将是 Google网上论坛:wkhtmltopdf一般 [ ^ ]邮件列表。
Choose an HTML to PDF command line converter tool that fits your needs and install it.

Read the documentation of the tool and perform conversions using the command line until you got the desired output. Then pass the command to the PHP PHP: shell_exec - Manual[^] function.

If you have problems using the tool, try the support options. For wkhtmltopdf this would be the Google Groups: wkhtmltopdf General[^] mailing list.