3

How do I generate PDF files with PHP. php.net says that pdflib needs to be installed to use functions such as new_pdf ().

However, pdflib is not free and the lite version is not allowed for commercial use. I am confused. I would have thought PHP would have some built-in functionality to create PDF files.

How do I get through this as I do not want to use libraries such as fpdf, etc.?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Barry Connolly
  • 663
  • 1
  • 6
  • 20

3 Answers3

5

You should try the following. They are some useful PHP libraries for PDF documents:

See Stack Overflow questions Generate PDF from HTML PHP and How to generate PDF files with PHP?.

It's your choice with which you feel more comfortable.

Community
  • 1
  • 1
dev.meghraj
  • 8,542
  • 5
  • 38
  • 76
1

If you don't want to use pdflib, you will have to use another third-party library.

Zend provides one as part of the Zend Framework. But the ones we have used for various purposes are:

  • DomPDF is great for taking HTML and producing PDF files
  • tcPDF is a more class-based drawing style approach, but it works great and gives loads of control.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
agough
  • 605
  • 1
  • 6
  • 7
1

PHP does not have any in-built functions, so you have to use libraries. TCPDF is the easiest modules and it's free.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ritesh Kumar Gupta
  • 5,055
  • 7
  • 45
  • 71
  • Thakyou Ritesh was just after confirmation iss try tcppdf – Barry Connolly Apr 02 '13 at 15:44
  • @BarryConnolly: :) . I had used **TCPDF** lot of times in several website that i had constructed.Its very easy to use. The best part is you can **modify** it as per your wish. You can **customize** it too. Also, stack-overflow.com have many answers/questions on TCPDF. – Ritesh Kumar Gupta Apr 02 '13 at 15:46