tags:

views:

54

answers:

3

I would want to print tickets in pdf. I was already able to retrieve the ticket details like customer name, order id, order items, and total bill. I would want to put this details in the .pdf file ready for printing. I'm using html and php tags in retrieving these ticket details from the database. How can I convert to .pdf all items echoed in .php file?

A: 

Try to use

http://pear.php.net/package/File_PDF

Alexander.Plutov
+1  A: 

You can use a library like dompdf.

Chathuranga Chandrasekara
I used dompdf but I can't display contents that are from the DB. Dompdf only uses html tags for pdf contents right? It won't work if i use <?php echo ...?> ?
anonymous123
DOMPDF will take a HTML document and transform it to PDF. If you generate a full HTML document representing your ticket and pass that to DOMPDF then it can render your PDF as desired.
BrianS
+1  A: 

I personally prefer TCPDF to create PDFs from PHP. It's still actively being developed and has a lot of features you don't find in other libs (yet). Just look at their examples page to see how easy it is to use.

wimvds