PHP Classes

File: compile_phpwkhtmltox.txt

Recommend this page to a friend!
  Classes of PHP-4-Business  >  WKHTMLTOPDF HTML to PDF creator  >  compile_phpwkhtmltox.txt  >  Download  
File: compile_phpwkhtmltox.txt
Role: Documentation
Content type: text/plain
Description: How to compile the PHP extension
Class: WKHTMLTOPDF HTML to PDF creator
Convert HTML to PDF using the Webkit engine
Author: By
Last change: Corrections to commands
Date: 9 years ago
Size: 1,831 bytes


Class file image Download
Here are some steps to compile and install the php-wkhtmltox PHP extension.

The paths below are valid for most standard Centos/RH installations - you should check and adapt them according to your flavour of Linux.

On your server:

1) Download the wkhtmltopdf src package

  cd  /tmp
  bunzip2  wkhtmltopdf-0.11.0_rc1.tar.bz2
  tar  -xvf  wkhtmltopdf-0.11.0_rc1.tar

2) Download the pre-compiled libwkhtmltox static library

  cd  /tmp
  bunzip2  libwkhtmltox-0.11.0_rc1-i386.tar.bz2
  tar  -xvf  libwkhtmltox-0.11.0_rc1-i386.tar

3) Copy the library to your libraries directory (probably /usr/local/lib )

  cp  -v /tmp/lib/   /usr/local/lib

3) Copy the library headers to your headers directory (probably /usr/local/include )

  cp  -vR  /tmp/include/wkhtmltox  /usr/local/include/wkhtmltox

4) Download the PHP extension source

  cd  /tmp
  wget  --no-check-certificate  
  tar  -xvzf  master

5) Compile and install the extension

  cd  /tmp/mreiferson-php-wkhtmltox-fa6208e
  ./configure  --with-phpwkhtmltox=/tmp/wkhtmltopdf-0.11.0_rc1
  make install

6) Edit your php.ini file to load the extension

  cp  /etc/php.ini  /etc/php.bak
  echo  ""  >> /etc/php.ini 

7) Reload your webserver and test

  apachectl  restart

- creates a test image file called  /tmp/test.jpg

  cd  /tmp/mreiferson-php-wkhtmltox-fa6208e
  php  test_image.php

- creates a test pdf files called  /tmp/test1.pdf

  cd  /tmp/mreiferson-php-wkhtmltox-fa6208e
  php  test_pdf.php

For more information send a message to info at phpclasses dot org.