ignited / laravel-pdf by alexw23

Provides the HTML2PDF functionality using the wkhtmltopdf library
16,236
22
1
Package Data
Maintainer Username: alexw23
Maintainer Contact: alexwhiteside@ignitedlabs.com.au (Alex Whiteside)
Package Create Date: 2013-10-15
Package Last Update: 2015-07-17
Language: PHP
License: MIT
Last Refreshed: 2020-11-30 03:01:51
Package Statistics
Total Downloads: 16,236
Monthly Downloads: 139
Daily Downloads: 3
Total Stars: 22
Total Watchers: 1
Total Forks: 16
Total Open Issues: 5

Laravel HTML 2 PDF

Latest Stable Version Total Downloads

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

Installation

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

{
    "require": {
        "ignited/laravel-pdf": "1.*"
    }
}

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.

Publish the package configuration using Artisan.

php artisan config:publish ignited/laravel-pdf

Update your settings in the generated app/config/packages/ignited/laravel-pdf configuration file.

Uncomment the relevant binary.

32-bit systems

return array(
	# Uncomment for 32-bit systems
	'bin' => base_path() . '/vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386'

64-bit systems

return array(
	# Uncomment for 64-bit systems
	'bin' => base_path() . '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'

Find the providers key in your app/config/app.php and register the AWS 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();
});