Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fawno/php-wkhtmltox
PHP/FFI class for wkhtmltox C library
https://github.com/fawno/php-wkhtmltox
ffi ffi-bindings ffi-wrapper php php-ffi wkhtmltoimage wkhtmltopdf wkhtmltox
Last synced: about 5 hours ago
JSON representation
PHP/FFI class for wkhtmltox C library
- Host: GitHub
- URL: https://github.com/fawno/php-wkhtmltox
- Owner: fawno
- License: mit
- Created: 2020-02-19T01:26:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-02-19T02:10:40.000Z (over 4 years ago)
- Last Synced: 2024-11-14T11:42:12.565Z (1 day ago)
- Topics: ffi, ffi-bindings, ffi-wrapper, php, php-ffi, wkhtmltoimage, wkhtmltopdf, wkhtmltox
- Language: PHP
- Size: 5.86 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP-wkhtmltox
[![GitHub license](https://img.shields.io/github/license/fawno/PHP-wkhtmltox)](https://github.com/fawno/PHP-wkhtmltox/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/fawno/PHP-wkhtmltox)](https://github.com/fawno/PHP-wkhtmltox/releases)
[![Packagist](https://img.shields.io/packagist/v/fawno/php-wkhtmltox)](https://packagist.org/packages/fawno/php-wkhtmltox)
[![PHP](https://img.shields.io/packagist/php-v/fawno/php-wkhtmltox)](https://php.net)PHP/FFI class for wkhtmltox C library
Render HTML into PDF and various image formats using the Qt WebKit rendering engine.## Requirements
- wkhtmltox C library: https://wkhtmltopdf.org/
- FFI PHP extension (bunded in PHP >= 7.4.0).## Installation
You can install this plugin into your application using
[composer](https://getcomposer.org):```
composer require fawno/php-wkhtmltox
```## Usage
```php
require 'vendor/autoload.php';use Fawno\PHPwkhtmltox\wkhtmltoimage;
// Create wkhtmltoimage object (on Windows)
//$wk = new wkhtmltoimage(__DIR__ . '/bin/wkhtmltox.dll');// Create wkhtmltoimage object (on Linux)
$wk = new wkhtmltoimage('/usr/local/lib/wkhtmltox.so');// Set screen Width
$wk->set_global_setting('screenWidth', '1200');// Set url to render
$wk->set_global_setting('in', 'https://wkhtmltopdf.org/');// Set output format to PNG
$wk->set_global_setting('fmt', 'png');// Render url and return image as string
$data = $wk->convert();// Set output filename
$wk->set_global_setting('out', 'wkhtmltopdf.png');// Render url
$wk->convert();
```