antking/phantom-pdf

A Package for generating PDF files using PhantomJS, which fork from danielboendergaard/phantom-pdf
1,997
Install
composer require antking/phantom-pdf
Latest Version:v0.6.2
PHP:>=5.4.0
License:MIT
Last Updated:Jul 20, 2015
Links: GitHub  ·  Packagist
Maintainer: TrungVuAnt

Phantom PDF

A Package for generating PDF files using PhantomJS. The package is framework agnostic, but provides integration with Laravel 4/5.

Notice: This package only works on 64-bit Linux operating systems.

##Installation Run composer require antking/phantom-pdf

####Laravel 4 Installation (optional)

Add PhantomPdfServiceProvider in the providers array in app/config/app.php

'providers' => [
  ...
  'PhantomPdf\Laravel\PhantomPdfServiceProvider'
]

####Laravel 5 Installation (optional)

Add Laravel5ServiceProvider in the providers array in config/app.php

'providers' => [
  ...
  'PhantomPdf\Laravel\Laravel5ServiceProvider'
]
Laravel 4/5 Facade usage (optional)

Add the facade to the aliases array in app/config/app.php (optional)

'aliases' => [
  ...
  'PDF' => 'PhantomPdf\Laravel\PDFFacade'
]

##Usage with Laravel

class SampleController extends Controller {

  public function index()
  {
    $view = View::make('index');
    
    return PDF::createFromView($view, 'filename.pdf');
  }

  public function save()
  {
      $view = View::make('index');

      PDF::saveFromView($view, 'path/filename.pdf');
  }
}

##Usage outside Laravel


$pdf = new PdfGenerator;

// Set a writable path for temporary files
$pdf->setStoragePath('storage/path');

// Saves the PDF as a file
$pdf->saveFromView($html, 'filename.pdf');

// Returns a Symfony\Component\HttpFoundation\BinaryFileResponse
return $pdf->createFromView($html, 'filename.pdf');

Related Packages

danielboendergaard/phantom-pdf

A Package for generating PDF files using PhantomJS

494,780 72
clippings/phantom-pdf

A Package for generating PDF files using PhantomJS

87,565 4
eve/pdf-converter

Laravel package to convert HTML to PDF, supporting multiple drivers.

4,065 11
spatie/laravel-html

A fluent html builder

9,073,540 827
mc0de/laravel-html

A fluent html builder

2 0

Version History

Version Released PHP License
v0.6.2 >=5.4.0 MIT
v0.6.1 >=5.4.0 MIT
v0.6.0 >=5.4.0 MIT
v0.5.0 >=5.4.0 MIT
v0.4.0 >=5.4.0 MIT