2017 © Pedro Peláez
 

library phantom-pdf

A Package for generating PDF files using PhantomJS

image

danielboendergaard/phantom-pdf

A Package for generating PDF files using PhantomJS

  • Thursday, September 21, 2017
  • by danielboendergaard
  • Repository
  • 7 Watchers
  • 69 Stars
  • 121,484 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 19 Forks
  • 0 Open issues
  • 26 Versions
  • 7 % Grown

The README.md

Phantom PDF

A Package for generating PDF files using PhantomJS. The package is framework agnostic, but provides integration with Laravel., (*1)

Notice: This package only ships with the 64-bit Linux version of PhantomJS. If you want to use it with another version you can reference it in the configuration., (*2)

Installation

Run composer require danielboendergaard/phantom-pdf, (*3)

Usage

$pdf = new PdfGenerator;

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

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

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

PhantomJS Version

This package uses PhantomJS 1.9.8 x64 which is included in the package. If you want to use another version it's easy., (*4)

$pdf->setBinaryPath('/some/path/phantomjs');

Customizing the conversion script

If you want to use another script to execute with PhantomJS, this it how you do it., (*5)

$pdf->useScript('`/path/to/script');

Laravel integration

Installation

For Laravel 5.5 the package supports auto discovery and don't need any configuration.

For Laravel 4, use the 0.10.0 branch., (*6)

Add LaravelServiceProvider in the providers array in config/app.php, (*7)

'providers' => [
  PhantomPdf\Laravel\LaravelServiceProvider::class,
]

Facades (optional)

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

'aliases' => [
  'PDF' => PhantomPdf\Laravel\PDFFacade::class,
]

Usage

class SampleController extends Controller
{
  public function index()
  {
    return PDF::createFromView(view('index'), 'filename.pdf');
  }

  // Save the pdf to disk
  public function save()
  {
      PDF::saveFromView(view('index'), 'path/filename.pdf');
  }

  // Usa via injection
  public function foo(PdfGenerator $pdf)
  {
    return $pdf->createFromView(view('path'), 'filename.pdf');
  }
}

The Versions

21/09 2017

dev-master

9999999-dev

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

21/09 2017

v1.3.0

1.3.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

05/07 2016

v1.2.2

1.2.2.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

05/07 2016

v1.2.1

1.2.1.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

25/05 2016

v1.2.0

1.2.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

12/05 2016

v1.1.0

1.1.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

28/04 2016

v1.0.0

1.0.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

05/01 2016

0.10.0.x-dev

0.10.0.9999999-dev

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

05/01 2016

v0.10.0

0.10.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

16/09 2015

v0.9.0

0.9.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

14/09 2015

v0.8.0

0.8.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

26/08 2015

v0.7.2

0.7.2.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

20/07 2015

v0.7.1

0.7.1.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

20/07 2015

v0.7.0

0.7.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

07/06 2015

v0.6.2

0.6.2.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

18/03 2015

v0.6.1

0.6.1.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

09/03 2015

v0.6.0

0.6.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

09/03 2015

v0.5.0

0.5.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

09/03 2015

v0.4.0

0.4.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

19/02 2015

v0.3.1

0.3.1.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

19/02 2015

v0.3.0

0.3.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

19/02 2015

v0.2.1

0.2.1.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

14/09 2014

v0.2.0

0.2.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

03/06 2014

v0.1.0

0.1.0.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

28/05 2014

v0.0.2

0.0.2.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf

26/05 2014

v0.0.1

0.0.1.0

A Package for generating PDF files using PhantomJS

  Sources   Download

MIT

The Requires

 

by Daniel Bøndergaard

laravel html pdf