@adelia
It seems there is a misunderstanding in my previous response. wkhtmltopdf is a command line tool and not intended to run through XAMPP or any other web server. Here’s how you can install and use wkhtmltopdf separately:
- Download the appropriate version of wkhtmltopdf from the official website: https://wkhtmltopdf.org/downloads.html. Choose the version that matches your operating system (Windows, Linux, or macOS).
- After downloading, follow the installation instructions for your operating system.
- Once installed, you can use wkhtmltopdf by running commands in your terminal or command prompt. For example, to convert an HTML file to PDF, you would run a command like:
wkhtmltopdf input.html output.pdf
- You can also use wkhtmltopdf with PHP by calling the command using exec() or shell_exec() functions. Here's a simple example:
$inputHtml = "input.html";
$outputPdf = "output.pdf";
$command = "wkhtmltopdf $inputHtml $outputPdf";
exec($command);
- Make sure that the path to the wkhtmltopdf executable is set in your system’s PATH environment variable or provide the full path in your PHP script.
It is important to note that installing wkhtmltopdf on a server (such as XAMPP) is not recommended due to security risks and potential performance issues. It is better to install and use wkhtmltopdf on the local machine where it is needed.