tags:

views:

183

answers:

4

What would be the simplest, shortest way to turn a text file into a PDF file with PHP? With some basic example code if possible.

I've seen this but the examples don't show how to use a text file as input.

http://uk3.php.net/manual/en/book.pdf.php

Thanks

+1  A: 

You'll definitely need a library to write PDFs. I'd say try FPDF.

Pekka
+2  A: 

TCPDF is the best way to convert text or HTML to PDF.

http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf

Napolux
+4  A: 

TCPDF and FPDF can both render PDF output. If you're on a Linux system, you could also call the system's ghostscript to do it.

Gordon
+1 for using the OS, since he is asking for the *simplest and shortest* - I expected this quality answer from a Gordon ;)
Gordon
With his own definition of "simplest and shortest", we are just comparing apple and orange.
Jay Zeng
Stack Overflow's multiple screen names rule! :)
Pekka
@Jay true, but then again, it's up to the OP to provide proper requirements
Gordon
+1  A: 

Throwing Zend_Pdf into the ring as well.

And a somewhat old tutorial to get you started in addition to the extensive docs in the ZF manual:

Gordon