-1

Possible Duplicate:
Generate PDF report from php

Is it possible to generate a word or pdf document using php? I am making a web page that generates report ( an evaluation sheet to be exact that contains the rating per staff) and I'm wondering if it is possible to generate such documents.

Community
  • 1
  • 1
assehj
  • 7
  • 2
  • Sure, why shouldn't it not be possible to generate any kind of output? I mean PHP is a programming language. You can even generate a doc file *and* a pdf file in php. So two times yes as the answer to your question. What do you need to know more? – hakre Mar 14 '12 at 17:03
  • Would also like to know a good detailed and useful answer to this. Good question. It must be possible, but would love to know in detail – RSM Mar 14 '12 at 17:04
  • There are a lot of resources on how to do this. You should do some searching first before posting a new question. – jasonlfunk Mar 14 '12 at 17:05
  • 1
    @Ryan Murphy: Just search this site and the internet. – hakre Mar 14 '12 at 17:06

3 Answers3

0

Yes, you can either use some PDF generation library designed to work with PHP (maybe http://php.net/manual/en/book.pdf.php ?). IMO, these libraries can be tricky to use because you have to learn their own markup syntax.

You could also use an html -> pdf generator such as wkhtmltopdf or Princexml -- these are external commands that you would need to call after generating html/css with php. These are easier to use because the syntax is (presumably) familiar, but the styling can be trickier for things like cover pages, headers, footers, etc.

kclair
  • 2,124
  • 1
  • 14
  • 18
0

Check out PHPWord for generating .docx files via PHP

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
0

I would recommend making your document in HTML and styling it as you like it. Then use wkhtmltopdf to convert it to a pdf. Then you can execute this command from PHP like this:

shell_exec('wkhtmltopdf /path/to/document/document.html /path/to/document/document.pdf');
jeffery_the_wind
  • 17,048
  • 34
  • 98
  • 160