开发者

send output to pdf php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

how can i send an output on the screen to a p开发者_StackOverflowdf? i am generating this report, which outputs html on the screen. i want the user to click a button, and save whats on the screen as a pdf file. i am running php 5.2 and i will like to know what kind of applications/software do i need to install to be able to use php pdf library?

many thanks.


You will need to use a library. Note that it is not as simple as "send output on screen to pdf". You will need to familiarize yourself with the structure of PDFs, and learn to use the library you choose.

Libraries include:

  • FPDF
  • Zend_Pdf


Try wkhtml2pdf, it worked for me and it generates pdf pretty fast


I agree with @hobodave here. Both PDF libraries are great, but it isn't easy to just convert HTML to a pdf file. I write custom reports for my company all the time and have a preview in HTML first and then just create the PDF from scratch after the preview is accepted.

The reason for this is that it's easier to just write out the PDF WITHOUT using any HTML input than it is to try and get it working WITH the HTML.

I in any case, I recommend FPDF to generate PDF files because it's fairly simple and super easy to extend. There are even ad-on's for doing HTML (although they suck).


Take a look at the List of HTML to PDF converters.

There are a number of libraries that will take HTML content and convert it to PDF. The best option for you really depends on your level of control of the server. Some are pure PHP classes, others require some form of binary installation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜