在 php 中导出 PDF [英] PDF Export in php

查看:36
本文介绍了在 php 中导出 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在不更改任何 ini 修改的情况下以 pdf 格式写入大量数据,并减少执行时间..

Is there any possibility to write huge data in pdf without changing any ini modifications with less executing time..?

目前我正在使用 tcpdf 插件.

Currently I'm using tcpdf plugin.

推荐答案

如果您打算从 PHP 创建 PDF,pdflib 将为您提供帮助.

If your intention is to create a PDF from PHP, pdflib will help you.

否则,如果您想通过 PHP 将 HTML 页面转换为 PDF,您会发现这里有点麻烦.

Otherwise, if you want to convert an HTML page to PDF via PHP, you'll find a little trouble outta here.

所以,我知道的选项是:

So, the options I know are:

DOMPDF :包装 HTML 并构建 PDF 的 PHP 类.工作良好,可定制(如果您了解 PHP),基于 pdflib,而且,如果我没记错的话,它甚至需要一些 CSS.坏消息:当 HTML 很大或非常复杂时会变慢.

DOMPDF : PHP class that wraps the HTML and builds the PDF. Works good, customizable (if you know PHP), based on pdflib, and, if I remember correctly, it takes even some CSS. Bad news: slow when the HTML is big or very complex.

HTML2PS:与 DOMPDF 相同,但这个在 .ps (GhostScript),然后,以您需要的任何格式(PDF、JPEG、PNG).对我来说,它比 DOMPDF 好一点,但有相同的速度问题.哦,更好的与 CSS 的兼容性.

HTML2PS: same as DOMPDF, but this one converts first in .ps (GhostScript), then, in whatever format you need (PDF, JPEG, PNG). For me it is a little better then DOMPDF, but have the same speed problem. Oh, better compatibility with CSS.

那两个是PHP类,但是如果你可以在服务器上安装一些软件,通​​过passthru()system()访问,看看这些也是:

Those two are PHP classes, but if you can install some software on the server, and access it through passthru() or system(), give a look to these too:

wkhtmltopdf:基于 WebKit(Safari 的包装器),它真的快速而强大.似乎它是最好的(目前)HTML 到 PDF 的动态转换,一个带有 CSS2 的 3 页 XHTML 文档只需要 2 秒钟.无论如何,这是一个最近的项目,因此 google.code 页面经常更新.

wkhtmltopdf: based on WebKit (Safari's wrapper), it's really fast and powerful. Seems like it is the best one (at the moment) for HTML to PDF conversion on the fly, taking only 2 seconds for a 3 page XHTML document with CSS2. It's a recent project anyway, so the google.code page is often updated.

htmldoc :这是一辆坦克,它真的从来没有停止/崩溃.到 2007 年,该项目似乎已经死了,但如果您不需要 CSS 兼容性,这对您来说会很好.

htmldoc : this one is a tank, it really never stops/crashes. The project seems dead, as of 2007, but if you don't need CSS compatibility this can be nice for you.

tcpdf - 这是 fpdf 的增强和维护版本.它具有 tpdf 的所有主要功能,并且还具有更快的执行时间和出色的输出.有关使用两个最流行的 PDF 生成类:TCPDF 和 FPDF 的详细教程,请关注 此链接.我认为您应该继续使用 TCPDF.

tcpdf - this is an enhanced and maintained version of fpdf. It has all the main Features of tpdf and it also has faster execution time with great output. For detailed tutorial on using the two most popular PDF generation classes: TCPDF and FPDF, please follow this link. I think you should continue using TCPDF.

另见这些帖子:

  1. 使用 PHP 将 HTML + CSS 转换为 PDF?
  2. 哪个是最适合 PHP 的 PDF-API?
  3. 在 PHP 中将 html 导出为 PDF?
  4. 将带有 PHP 变量的 HTML 写入 PDF 文件?
  5. 如何使用 php 将 html 转换为 pdf?
  6. 将 html 导出为 pdf 的工具
  7. 将 PHP 文件中的 HTML 转换为 PDF 文件

这篇关于在 php 中导出 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆