lucasromanojf / laravel5-pdf by lucasromanojf
forked from ignited/laravel-pdf

Provides the HTML2PDF functionality using the wkhtmltopdf library (Laravel 5)
56,374
7
1
Package Data
Maintainer Username: lucasromanojf
Maintainer Contact: alexwhiteside@ignitedlabs.com.au (Alex Whiteside)
Package Create Date: 2015-02-12
Package Last Update: 2017-08-03
Language: PHP
License: MIT
Last Refreshed: 2020-10-24 03:16:13
Package Statistics
Total Downloads: 56,374
Monthly Downloads: 387
Daily Downloads: 20
Total Stars: 7
Total Watchers: 1
Total Forks: 5
Total Open Issues: 1

Laravel 5 HTML 2 PDF

Latest Stable Version Total Downloads Latest Unstable Version License

A simple Laravel 5 service provider for including the wkhtmltopdf library.

Installation

The Laravel PDF Service Provider can be installed via Composer by requiring the lucasromanojf/laravel5-pdf package in your project's composer.json.

{
    "require": {
        "lucasromanojf/laravel5-pdf": "1.0.*"
    }
}

Note (you must also include wkhtmltopdf binaries)

32-bit systems

{
    "require": {
        "h4cc/wkhtmltopdf-i386": "*"
    }
}

64-bit systems

{
    "require": {
        "h4cc/wkhtmltopdf-amd64": "*"
    }
}

You can include both of these if you need.

Configuration

To use the PDF Service Provider, you must register the provider when bootstrapping your Laravel application.

Create the config/laravel-pdf.php configuration file.

In the config/laravel-pdf.php file:

32-bit systems

return array(
	'bin' => base_path() . '/vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386'
)

64-bit systems

return array(
	'bin' => base_path() . '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'
)

Find the providers key in your config/app.php and register the Service Provider.

    'providers' => array(
        // ...
        'Ignited\Pdf\PdfServiceProvider',
    )

Find the aliases key in your app/config/app.php and add the AWS facade alias.

    'aliases' => array(
        // ...
        'PDF'			  => 'Ignited\Pdf\Facades\Pdf'
    )

Usage

In routes.php

Route::get('/', function() {
	$pdf = PDF::make();
	$pdf->addPage('<html><head></head><body><b>Hello World</b></body></html>');
	$pdf->send();
});