I am trying to install phpwkhtmltopdf on shared server (webhotel). The server has already composer installed, and I have SSH to server. But I am not too familiar with composer so I might be doing someting very basic wrong here..
So, I have downloaded the zip file from: https://github.com/mikehaertl/phpwkhtmltopdf and extracted the files on it to server to directory named as phpwkhtmltopdf. Then, opening SSH cd-ing to that dir and running composer require mikehaertl/phpwkhtmltopdf but I only get question marks to beginning of line. For the question marks I read that it could be a problem of detect unicode, so I placed to htaccess: php_flag detect_unicode Off and it seems that it is Off now locally.
But there is still the question marks and php wkhtmltopdf does not get installed. How to get it installed?
The problem is that you are fetching the package
mikehaertl/phpwkhtmltopdf
two times:Please decide how you want to install the package!
When you want to install the package with Composer, you just need to run
composer require mikehaertl/phpwkhtmltopdf
in a clean project folder.Composer will then fetch the package and place it into the
/vendor
folder.That's it.
Now, in order to use it you need two things:
you need to include Composers Autoloader during the bootstrap of your project. This enables that the Autoloader will load the library, when you access one the package/library classes.
Well, finally, you need to code something using the library:
Uhm, and you need the wkhtmltopdf binary... but i guess thats not the problem.
These are my steps:
c:\program files\wkhtmltopdf
now the executable resides in
c:\program files\wkhtmltopdf\bin
i created the folder
pdf-test
composer require mikehaertl/phpwkhtmltopdf
on the CLIi created a file
makepdf.php
with the following content:then i ran
php makepdf.php
page.pdf
was generatedAnd that's it... :)