用 PHP 生成 PDF [英] Generating PDFs with PHP
问题描述
我有一个 PHP 应用程序,需要使用查询结果生成 PDF.最简单的方法是使用 DOMPDF 为我生成 PDF.所以制作了一个为我生成 HTML 的函数,然后将其传递给 DOMPDF.在开发和测试环境中一切正常,但在生产环境中我遇到了一些内存使用问题.
I have a PHP application and a need to generate a PDF with the result of query. The easiest way a found to do this was to use the DOMPDF to generate the PDF for me. So a made a function that generates the HTML for me then a pass this to DOMPDF. In the development and testing enviroment everything was fine but on production enviroment I had some problems with memory usage.
所以我想知道我的策略是否是最好的,或者是否有更好、更简单的方法来做到这一点.
So I would like to know if my strategy was the best one or if there's a better and easy way to do this.
你会怎么做?
推荐答案
我曾经做过一个生成 PDF 的 PHP 项目.我使用了 Fpdf.
I once did a PHP project generating PDF. I used FPdf.
我从来没有任何记忆问题.它是免费的,它是纯 PHP 代码.您不必加载任何扩展程序.
I never had any memory problems. It's free, it's pure PHP code. You don't have to load any extensions.
我不知道是否有一些帮助程序可以从查询中自动生成文档,但是在网站中,您有一些脚本可以展示如何将其与 MySql 一起使用.
I don't know if there's some helpers to auto-generate document from a query, but in the website, you have some scripts that shows how to use it with MySql.
HTH
这篇关于用 PHP 生成 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!