2017 © Pedro Peláez
 

symfony-bundle pdf-generator-bundle

A WKHTMLTOPDF based PDF Generator

image

wucdbm/pdf-generator-bundle

A WKHTMLTOPDF based PDF Generator

  • Thursday, January 11, 2018
  • by wucdbm
  • Repository
  • 1 Watchers
  • 0 Stars
  • 323 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

pdf-generator-bundle

PDF Generator Bundle based on wkhtmltopdf, (*1)

Requirements

  • xvfb to be installed on your server (apt-get install xvfb on debian/ubuntu)

By default this bundle uses the h4cc/wkhtmltopdf-i386 package's binary. To use your system binary, add this to your parameters.yml.dist file and do a composer install, (*2)

    wucdbm_pdf_generator.binary: wkhtmltopdf

Register the bundle in your AppKernel

<?php
public function registerBundles() {
    $bundles = [
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        // Add WucdbmPdfGeneratorBundle to your AppKernel
        new \Wucdbm\Bundle\PdfGeneratorBundle\WucdbmPdfGeneratorBundle(),
    ];
}

Basic Usage

<?php 
/** @var \Wucdbm\Bundle\PdfGeneratorBundle\Generator\PdfGenerator $generator */
$generator = $container->get('wucdbm_pdf_generator.generator');
$filename = 'someFile.pdf';
// Get a PdfResult. The wkPrint and bootstrap methods both return a PdfResult
/** @var \Wucdbm\Bundle\PdfGeneratorBundle\Generator\PdfResult $result */
$result = $generator->wkPrint($html);
// The PdfResult is the result of the PDF generation. It has access to the temporary PDF file
$tempPdfPath = $result->realPath();
// return a Symfony Response
return $generator->bootstrap($html)->response($filename);
// return a Symfony Response and copy the file some place else
// The Generator does NOT save the files; it will unlink them as soon as the request is finished
// The copy() method returns PrintResult
return $generator->bootstrap($html)->copy('/some/location/someFile.pdf')->response($filename);
// And last, you can also get the PDF file contents as string
$contents = $generator->bootstrap($html)->contents();

TODO

  • https://www.npmjs.com/package/chrome-headless-render-pdf
  • http://weasyprint.readthedocs.io/en/latest/install.html

The Versions

11/01 2018

dev-master

9999999-dev

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

11/01 2018

v0.2.0

0.2.0.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

04/10 2017

v0.1.6

0.1.6.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

04/10 2017

v0.1.5

0.1.5.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

04/09 2017

v0.1.4

0.1.4.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

24/08 2017

v0.1.3

0.1.3.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

24/08 2017

v0.1.2

0.1.2.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

24/08 2017

v0.1.1

0.1.1.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf

23/08 2017

v0.1.0

0.1.0.0

A WKHTMLTOPDF based PDF Generator

  Sources   Download

GPL-3.0

The Requires

 

by Martin Kirilov

html to pdf pdf bundle wucdbm symfony pdf generator symfony html pdf