2017 © Pedro Peláez
 

lib php-htmltopdf-htmltoimage

transfer html to pdf or image

image

biaoqianwo/php-htmltopdf-htmltoimage

transfer html to pdf or image

  • Wednesday, August 30, 2017
  • by biaoqianwo
  • Repository
  • 0 Watchers
  • 0 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 41 % Grown

The README.md

php-htmltopdf-htmltoimage

Transfer html to pdf or image using wkhtmltopdf., (*1)

Requirements

PHP7

wkhtmltopdf

cd /tmp
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz && rm wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
ln -s -T /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf && \
chmod a+x /usr/local/bin/wkhtmltopdf &&  \
ln -s -T /tmp/wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage && \
chmod a+x /usr/local/bin/wkhtmltoimage

Check and get help by wkhtmltopdf -h or wkhtmltoimage -h
More information to see: https://wkhtmltopdf.org/, (*2)

Install

composer require biaoqianwo/php-htmltopdf-htmltoimage, (*3)

Quick Start and Examples

require __DIR__ . '/vendor/autoload.php';

use \Biaoqianwo\Html2Pdf\Html2Pdf;
use \Biaoqianwo\Html2Pdf\Html2Image;

$html = '<html><head><title>export</title>......';
// or 
// $html = file_get_contents('http://google.com');

// Pdf
$generator = new Html2Pdf('/usr/local/bin/wkhtmltopdf');
$options = ['header'=>'Centered header text','footer'=>'Left aligned footer text'];
$generator->getOutputFromHtml($html, $options)

// Image
$generator = new Html2Image('/usr/local/bin/wkhtmltoimage');
$options = ['format'=>'png','width'=>'300','height'=>'1000'];
$generator->getOutputFromHtml($html, $options)

More

You can improve getHeader()getFooter()., (*4)

The Versions

30/08 2017

dev-master

9999999-dev

transfer html to pdf or image

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar biaoqianwo

30/08 2017

1.1.2

1.1.2.0

transfer html to pdf or image

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar biaoqianwo

30/08 2017

dev-dev-master

dev-dev-master

transfer html to pdf or image

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar biaoqianwo