Php – How To Install and Run wkhtmltopdf on Mac OsX 10.7.3 for use in a PHP Application

macosPHPwkhtmltopdf

I've written a PHP/MySQL application that utilizes wkhtmltopdf to generate reports from data entered into the database. The client asked that I also install it to run as a standalone on a Mac that he has. Currently have the PHP/MySQL portion running without difficulty using XAMMP, but am having incredible difficulty getting wkhtmltopdf even installed on the system.

I have zero experience with Macs, and despite five hours of Googling and trying different approaches, I cannot even copy the most recent wkhtmltopdf .i386 into the /usr folder. Oddly, the laptop doesn't have a /usr/local/bin folder.

Unless I've missed it, I can't find simple instructions on how to get this thing working and would greatly appreciate any help that could be offered.

Best Answer

Homebrew only has wkhtmltopdf-0,9,9 and it fails with QT patched options by default. So if you need HEAD version with fully suppoorted options just

  • Grab yourself a copy of fresh wkhtmltopdf
  • Open it and drag to Applications
  • Then cd /usr/local/bin && ln -s /Applications/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf wkhtmltopdf