عکس dpsoft-official
Convert any url or html to pdf/image using google-chrome or chromium-browser PHP
موضوع‌ها
۰
فورک‌ها
۰
ستاره‌ها
۶
تاریخ ایجاد
۲۵ مرداد ۱۳۹۷
آخرین بروزرسانی
حدود ۴ سال قبل
لایسنس
GNU General Public License v2.0

Url to Pdf/image export in Php

License: GPL v2

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