dpsoft / php-html-to-pdf
Convert any url or html to pdf/image using google-chrome or chromium-browser
v1.1
2018-08-18 07:06 UTC
Requires
- php: ^7.0
- symfony/process: ^3.4
Requires (Dev)
- phpunit/phpunit: ^6.0
This package is auto-updated.
Last update: 2024-12-16 05:14:15 UTC
README
Convert any url or html to pdf/image using google-chrome or chromium-browser
Installation
$ composer require dpsoft/php-html-to-pdf
Requirement
This package uses google-chrome/chromium-browser. for example install chromium-browser on linux ubuntu:
~ sudo apt install chromium-browser
To verify requirement, run following test from package folder:
~ composer test
Implementation
Use url or html file to export:
require "vendor/autoload.php"; use Dpsoft\HtmlToPdf\Converter; $converter = new Converter(); // export to pdf $convertor->setUrl('http://google.com')->toPdf('pdf/file/name.pdf'); // or export to png $convertor->setUrl('http://google.com')->toPng('png/file/name.png'); // you can set window size for png export $convertor->setUrl('http://google.com')->setWindow(1280,960)->toPng('png/file/name.png');
Test
Run test:
~ composer test