0

Possible Duplicate:
How do I get WKHTMLTOPDF to execute via PHP?

I am using Wkhtmltopdf, Windows OS, Xampp to convert HTML into A4 PDF documents from the command line. This works fine. But how can I achieve this in PHP? The Windows command I use is:

D:\Program Files\wkhtmltopdf>wkhtmltopdf.exe http://www.google.com E:/d.pdf
Community
  • 1
  • 1
PHPDev
  • 139
  • 1
  • 3
  • 12
  • Easily done using the Exec commands. See here: [How do I get WKHTMLTOPDF to execute via PHP?][1] [1]: http://stackoverflow.com/questions/5663814/how-do-i-get-wkhtmltopdf-to-execute-via-php – nickhar Oct 12 '12 at 13:30
  • We used wkHTMLtoPDF a few years ago to generate PDF reports, so I know that the above SO answers work. – nickhar Oct 12 '12 at 13:36

2 Answers2

1

PHP provides multiple methods for running an external command-line string.

Which one you should use depends on exactly what you want to do -- ie whether you need to get a result back from the command to your PHP code or not; whether you want to output the result to the browser; whether you want the PHP program to wait for the external code to finish or not before proceeding...

You'll need to read the manual pages linked above to decide which of the options is best suited to your needs.

Hope that helps.

SDC
  • 14,192
  • 2
  • 35
  • 48
0

There also exists a project that provides PHP bindings for wkhtmltopdf:

It is actually linked on the wkhtmltopdf homepage

dualed
  • 10,262
  • 1
  • 26
  • 29