用于 php 的 PDFlib,是否有替代方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4108361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 11:59:53  来源:igfitidea点击:

PDFlib for php, is there an alternative

phppdf

提问by kalpaitch

I looked at the PDFlib website and they seemed to be charging a hefty fee for use of the PDF libraries. Is there an alternative open source pdf extension to php???

我查看了 PDFlib 网站,他们似乎对使用 PDF 库收取高额费用。是否有替代的 php 开源 pdf 扩展????

回答by ircmaxell

There are tons out there.

那里有吨。

As some have mentioned, there are:

正如一些人提到的,有:

  1. TCPDF
  2. FPDF
  3. Zend_Pdf
  4. DOMPDF- CSS 2.1 compliant
  5. WKHtmlToPdf
  6. HTML2PDF
  1. TCPDF
  2. FPDF
  3. Zend_Pdf
  4. DOMPDF- 符合 CSS 2.1
  5. WKHtmlToPdf
  6. HTML2PDF

And there's a ton more out there if you look...

如果你看,那里还有更多……

If you include commercial, I've heard good things about Prince...

如果您包括商业广告,我听说过有关Prince...的好消息

Personally, I've had great luck with DomPDF... TCPDF tended to be VERY buggy, but had a VERY active developer (which turned out to be a mixed blessing since the releases often broke the API), but then again this was years ago, so it could have changed. My experience with FPDF was that it was very buggy as well, with little to no support. But again, that was several years ago as well and it could have changed since then.

就我个人而言,我在 DomPDF 方面很幸运...... TCPDF 往往有很多问题,但有一个非常活跃的开发人员(结果是喜忧参半,因为发布经常破坏 API),但是这又是多年以前,所以它可能会改变。我对 FPDF 的经验是它也有很多问题,几乎没有支持。但同样,那也是几年前的事情,从那时起它可能会发生变化。

回答by Sarfraz

The FPDFis free and popular alternative to go for :)

FPDF是免费的,流行的替代去:)

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF 是一个 PHP 类,它允许使用纯 PHP 生成 PDF 文件,也就是说不使用 PDFlib 库。FPDF 中的 F 代表免费:您可以将其用于任何类型的用途并对其进行修改以满足您的需要。

回答by Timo K?hk?nen

Phantomjsnow supports pdf output: http://we-love-php.blogspot.fi/2012/12/create-pdf-invoices-with-html5-and-phantomjs.html

Phantomjs现在支持 pdf 输出:http: //we-love-php.blogspot.fi/2012/12/create-pdf-invoices-with-html5-and-phantomjs.html

The problem with various libraries (PDFlib, FPDF etc.) is the rather long learning curve. PhantomJS uses html5+css3+svg+canvas, which have a long history and large user space and php people know html+css usually very well, so the learning curve with PhantomJS is short.

各种库(PDFlib、FPDF 等)的问题是学习曲线相当长。PhantomJS 使用 html5+css3+svg+canvas,历史悠久,用户空间大,php 人通常对 html+css 非常了解,所以 PhantomJS 的学习曲线很短。

PhantomJS has nothing to do with PHP, but if you have rather new server, it is very easy to install and use. The downside is that Centos5 is not supported, but fortunately Centos6 is.

PhantomJS 与 PHP 无关,但如果你有相当新的服务器,它很容易安装和使用。缺点是不支持Centos5,好在Centos6支持。

PhantomJS uses true browser engine (Webkit) for page rendering, so the result should be better than with various html2pdf libraries and support for new techniques (html5+css3+svg+canvas) is better. Support for svg opens new possibilities, that are before achieved only with the most advanced pdf generation libraries (eg. pdflib) and when PhantomJS starts to support eg. SVG filters fully, then the sky is limit.

PhantomJS 使用真正的浏览器引擎(Webkit)进行页面渲染,所以效果应该比使用各种 html2pdf 库更好,并且对新技术(html5+css3+svg+canvas)的支持更好。对 svg 的支持开辟了新的可能性,以前只有最先进的 pdf 生成库(例如 pdflib)才能实现,当 PhantomJS 开始支持例如。SVG过滤完全,那么天空是有限的。

回答by SorcyCat

TCPDFis an open source library for generating PDFs. Also on wikipedia.

TCPDF是一个用于生成 PDF 的开源库。也在维基百科上

回答by Spudley

TCPDFis one I've come across. Seems to be in active development (it shows up in Freshmeat.org very regularly)

TCPDF是我遇到的一个。似乎正在积极开发中(它经常出现在 Freshmeat.org 中)

FPDFalso comes up in Google.

FPDF也出现在 Google 中。

Both are free and open source.

两者都是免费和开源的。

回答by robjmills

Another option is Zend_Pdfwhich is part of Zend Framework

另一个选项是Zend_Pdf,它是Zend 框架的一部分