PHP Classes

WKHTMLTOPDF support

Recommend this page to a friend!

      WKHTMLTOPDF HTML to PDF creator  >  All threads  >  WKHTMLTOPDF support  >  (Un) Subscribe thread alerts  
Subject:WKHTMLTOPDF support
Summary:Support with installation and WK parameters
Messages:39
Author:PHP-4-Business
Date:2012-04-11 07:51:43
Update:2014-01-10 12:54:43
 
  1 - 10   11 - 20   21 - 30   31 - 39  

  11. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of Niek Reus Niek Reus - 2012-06-06 09:34:40 - In reply to message 10 from PHP-4-Business
I get

/usr/local/lib/libwkhtmltox.so
/tmp/lib/libwkhtmltox.so

  12. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of PHP-4-Business PHP-4-Business - 2012-06-06 19:42:40 - In reply to message 11 from Niek Reus
Ok, the file size should match mine:

ll /usr/local/lib/libwkhtmltox.so

-rwxr-xr-x 1 root root 43514985 Feb 20 17:25 /usr/local/lib/libwkhtmltox.so



  13. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of Niek Reus Niek Reus - 2012-06-06 20:06:10 - In reply to message 12 from PHP-4-Business
That is exactly the size of my /usr/local/lib/libwkhtmltox.so: 43.541.985.

  14. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of PHP-4-Business PHP-4-Business - 2012-06-06 20:58:30 - In reply to message 13 from Niek Reus
Ok try running:

./configure --with-phpwkhtmltox=/tmp/wkhtmltopdf-0.11.0_rc1 CFLAGS='-L/usr/local/lib' LDFLAGS='-L/usr/local/lib'


That should work but if it fails then look at config.log file (in the directory where you ran configure) and look (c. line 223) for something like

configure:3394: checking for libwkhtmltox support
configure:3437: result: yes, shared
configure:3448: result: found in /tmp/wkhtmltopdf-0.11.0_rc1
configure:3448: result: found in /usr/local
configure:3558: checking for wkhtmltopdf_init in -lwkhtmltox
configure:3588: cc -o conftest -g -O2 -Wl,-rpath,/usr/local/lib -L/usr/local/lib conftest.c -lwkhtmltox >&5
configure:3594: $? = 0
configure:3598: test -z
|| test ! -s conftest.err
configure:3601: $? = 0
configure:3604: test -s conftest
configure:3607: $? = 0
configure:3620: result: yes


The "cc" line shows where the compiler is looking for the library - it should show -L/usr/local/lib (there may be others but this is the one we want).



  15. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of Niek Reus Niek Reus - 2012-06-07 09:05:05 - In reply to message 14 from PHP-4-Business
Hi Geoff,

I ran the code you mentioned, but it failed again. In the config.log file I found the following. As you see it deviates from the code you mentioned.

configure:3394: checking for libwkhtmltox support
configure:3437: result: yes, shared
configure:3448: result: found in /tmp/wkhtmltopdf-0.11.0_rc1
configure:3448: result: found in /usr/local
configure:3558: checking for wkhtmltopdf_init in -lwkhtmltox
configure:3588: cc -o conftest -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib -L/usr/local/lib conftest.c -lwkhtmltox >&5
/usr/local/lib/libwkhtmltox.so: undefined reference to `FcFreeTypeQueryFace'
collect2: ld returned 1 exit status
configure:3594: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char wkhtmltopdf_init ();
| int
| main ()
| {
| wkhtmltopdf_init ();
| ;
| return 0;
| }
configure:3620: result: no
configure:3739: error: libwkhtmltox version 0.10 or later required

Any idea what goes wrong and where the undefined reference to `FcFreeTypeQueryFace' comes from? Thanks again for your help.

Niek

  16. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of PHP-4-Business PHP-4-Business - 2012-06-07 15:28:37 - In reply to message 15 from Niek Reus
Ah the penny drops ;-)

You need version >= 2.4.2 of the fontconfig package and >= 2.3.4 of the freetype package

These are pre-requisites for running the wkhtmltopdf program.


theitdepartment.wordpress.com/2009/ ...
code.google.com/p/wkhtmltopdf/issue ...

freedesktop.org/software/fontconfig ...
download.savannah.gnu.org/releases/ ...


  17. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of Niek Reus Niek Reus - 2012-06-27 08:42:16 - In reply to message 16 from PHP-4-Business
Hi Geoff,

Thanks for all your help. I did install the right versions of the fontconfig and freetype packages. After that I was able to compile and install the extention as mentioned in 5) of your instructions. I continued with 6) and 7). There I got stuck again with the command

php test_image.php

It gave the following result:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phpwkhtmltox.so' - libwkhtmltox.so.0: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Call to undefined function wkhtmltox_convert() in /tmp/mreiferson-php-wkhtmltox-fa6208e/test_image.php on line 3

'/usr/lib/php/modules/phpwkhtmltox.so' does exist. I hope you can still help me here.

Yours,
Niek

  18. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of PHP-4-Business PHP-4-Business - 2012-06-27 10:33:41 - In reply to message 17 from Niek Reus
try creating a symlink for your missing file

ln -s /usr/lib/php/modules/phpwkhtmltox.so /usr/lib/php/modules/phpwkhtmltox.so.0


  19. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of Niek Reus Niek Reus - 2012-06-28 07:57:21 - In reply to message 18 from PHP-4-Business
I created the link. But still

php test_image.php

gave as result

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phpwkhtmltox.so' - libwkhtmltox.so.0: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Call to undefined function wkhtmltox_convert() in /tmp/mreiferson-php-wkhtmltox-fa6208e/test_image.php on line 3

  20. Re: WKHTMLTOPDF support   Reply   Report abuse  
Picture of PHP-4-Business PHP-4-Business - 2012-06-28 10:28:04 - In reply to message 19 from Niek Reus
I can only offer general advice since the issue is with your system and not this PHP class.

- check the file /usr/lib/php/modules/phpwkhtmltox.so exists and it has execute permission
- check your /etc/php.ini for a line like extension=phpwkhtmltox.so
- check this line is not in there more than once!
- try the full path instead i.e. extension=/usr/lib/php/modules/phpwkhtmltox.so
- search Google for the error message!
google.co.uk/search?num=100&hl=en&s ...

 
  1 - 10   11 - 20   21 - 30   31 - 39