- A PHP extension, which convert HTML to pdf and image.
- This extension is based on wkhtmltopdf and inspired by zhtmltopdf
git clone https://github.com/KanTian/HtmlTox
cd Htmltox
phpize
./configure --with-wkhtmltox-dir=./
make
sudo make install
now,you will find the htmltox.so in
Htmltox/modules/
so you can also move it to your own php extension dir manually
in your php.ini file,add the following line,just as you install other php modules:
extension="htmltox.so"
php -m
if you can see htmltox
,it means that the htmltox module has been successfully installed,enjoy it!
<?php
$foo = new htmltox();
$global_settings_pdf = array('out'=>'hdoj.pdf','imageQuantity'=>'92');
$object_settings_pdf = array(
array('page' => 'acm.hdu.edu.cn'),
array('useLocalLinks' => true),
array('useExternalLinks' => true)
);
$foo->htmltopdf($global_settings_pdf,$object_settings_pdf);
<?php
$foo = new htmltox();
$global_settings_image = array('out'=>'hdoj.jpg','in'=>'acm.hdu.edu.cn');
$foo->htmltoimg($global_settings_image);
The above examples just provide a basic usage of this module,in order to make full use of it,you may refer to wkhtmltopdf docs to get more global settings and object settings -:)