Skip to content

krakjoe/wkhtmltox

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

wkhtmltox

Build Status Build status

This extension wraps libwkhtmltox for PHP 7.

Documentation

Documentation can be found in the PHP Manual

Hello World (PDF)

use wkhtmltox\PDF\Converter as PDFConverter;
use wkhtmltox\PDF\Object as PDFObject;

$converter = new PDFConverter([
	"out" => "test.pdf"
]);

$converter->add(new PDFObject(
	file_get_contents("http://www.google.co.uk")));

$converter->convert();

Hello World (Image)

use wkhtmltox\Image\Converter as ImageConverter;

$converter = new ImageConverter(null, [
	"fmt" => "png",
	"in" => "https://www.google.co.uk",
	"out" => "test.png"
]);

$converter->convert();

Notes

  • Warnings from libwkhtmltox raise ZE warnings
  • Errors from libwkhtmltox raise ZE exceptions (RuntimeException)
  • Settings are accessible read only as properties or dimensions after construction
  • It is not possible to change settings after object construction
  • Validation of the possible values for settings is not good