"GET / HTTP/1.1" 200 737 "-" "Mozilla/5.0 (X11; U; Linux i686; C) AppleWebKit/533.3 (KHTML, like Gecko) Qt/4.7.0 Safari/533.3"
yum install git re2c --enablerepo=rpmforge yum install php-devel
configure: error: libwkhtmltox version 0.10 or later required config.log を見る less config.log ---- configure:3364: gcc -o conftest -g -O2 -Wl,-rpath,/usr/local/lib -L/usr/local/lib conftest.c -lwkhtmltox >&5 /usr/local/lib/libwkhtmltox.so: undefined reference to `FcFreeTypeQueryFace' ----
wget http://fontconfig.org/release/fontconfig-2.4.2.tar.gz tar xvfz fontconfig-2.4.2.tar.gz cd fontconfig-2.4.2 ./configure make make install
cat >> /etc/ld.so.conf << EOS /usr/local/lib EOS ldconfig
cd /usr/local/src/ wget "http://wkhtmltopdf.googlecode.com/files/libwkhtmltox-0.10.0_beta5-i386.tar.lzma" lzcat libwkhtmltox-0.10.0_beta5-i386.tar.lzma | tar xfv - mv lib/* /usr/local/lib/ mv include/* /usr/local/include/ git clone git://github.com/mreiferson/php-wkhtmltox.git cd php-wkhtmltox/ phpize ./configure make In file included from /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:8: /usr/local/src/php-wkhtmltox/phpwkhtmltox.h:15:7: warning: no newline at end of file /usr/local/src/php-wkhtmltox/phpwkhtmltox.c: In function 'zif_wkhtmltox_convert': /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:99: error: 'false' undeclared (first use in this function) /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:99: error: (Each undeclared identifier is reported only once /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:99: error: for each function it appears in.) /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:141: error: 'bool' undeclared (first use in this function) /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:141: error: expected ')' before 'ret' /usr/local/src/php-wkhtmltox/phpwkhtmltox.c:183:3: warning: no newline at end of file make: *** [phpwkhtmltox.lo] エラー 1 パッチを当てる patch -p1 < phpwkhtmltox.c.patch make make install cat > /etc/php.d/phpwkhtmltox.ini << EOS extension=phpwkhtmltox.so EOS service httpd restart php -m | grep phpwkhtmltox phpwkhtmltox
オプションは非常にたくさんあるので、Linuxコマンドライン版を「-H」付きで実行すると色々わかります。
<?php wkhtmltox_convert('pdf', array('out' => 'test.pdf', 'imageQuality' => '95'), // global settings array( array('page' => 'http://www.visionaryrenesis.com/'), array('page' => 'http://www.google.com/') )); // object settings
<?php wkhtmltox_convert('image', array('out' => 'test.jpg', 'in' => 'http://www.google.com/')); // global settings
<?php wkhtmltox_convert('pdf', array('out' => 'test.pdf'), // global settings array( array('page' => './index.html') )); // object settings
<?php wkhtmltox_convert('pdf', array( 'out' => 'test.pdf' , 'page-size' => 'A4' // ページサイズ , 'orientation' => 'Portrait' // 横:Landscape, 縦:Portrait ), // global settings array( array('page' => 'http://www.yahoo.co.jp/') ) ); // object settings