Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

PDF or Portable Document Format is a popular file type that is often used for online documents. It's great for distributing downloadable written content, and is frequently used by governments and businesses alike. Because it's a format that's familiar to all, many applications allow the user to convert other document types to the PDF format. PHP is one programming language that has a built-in ability to convert to PDF. PHP scripts can be used to transform file types such as HTML into PDF files.

share|improve this question

closed as off topic by Mark Trapp, gnat, Walter, Matthieu, Yannis Sep 4 '12 at 6:23

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Try dompdf, it looks like what you need:

dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.

Also, one of the answers for This Stack Overflow question suggests wkhtmltopdf:

Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.

So your PHP code could call it. However, has some problems:

  • It needs a patched Qt for some features
  • It needs the stack in the server-side

Or you could combine html2ps (HTML to PostScript) and ps2pdf (PostScript to PDF).

share|improve this answer
+1 For wkhtmltopdf. – Anonymous Sep 3 '12 at 7:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.