PHP code example of amonger / wkhtmltopdf-api

1. Go to this page and download the library: Download amonger/wkhtmltopdf-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amonger / wkhtmltopdf-api example snippets




use GuzzleHttp\Client;
use PDFGenerator\PDFGenerator;
use PDFGenerator\Implementation\RemotePDF;

$client = new Client([
  'base_uri' => 'http://192.168.0.1:8080',
  'headers'  => ['auth' => '123456789']
]);
$generator = new PDFGenerator(new RemotePDF($client));

header("Content-type:application/pdf");

echo $generator->fromURL('http://www.google.co.uk');