2017 © Pedro Peláez
 

symfony-bundle pdf-bundle

BushidoIOPDFBundle

image

bushidoio/pdf-bundle

BushidoIOPDFBundle

  • Saturday, February 17, 2018
  • by BushidoIO
  • Repository
  • 1 Watchers
  • 1 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

BushidoIOPDFBundle

The BushidoIOPDFBundle adds PDF file creation support in Symfony., (*1)

Features included:, (*2)

  • PDF creation from HTML string content
  • Symfony\Component\HttpFoundation\Response object encapsulation with application/pdf content type
  • Temporal data and fonts paths can be located inside or outside Symfony app folder tree

Installation

Step 1: Composer

Add the following require line to the composer.json file: ``` json { "require": { "bushidoio/pdf-bundle": "dev-master" } }, (*3)

And actually install it in your project using Composer:
``` bash
php composer.phar install

You can also do this in one step with this command: ``` bash $ php composer.phar require bushidoio/pdf-bundle "dev-master", (*4)


### Step 2: Enable the bundle Enable the bundle in the kernel: ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new BushidoIO\PDFBundle\BushidoIOPDFBundle(), ); }

Configuration

Temporal content folders can be configured in app/config/config.yml. By default both tmp and ttffontdatapath folder will be stored in app/cache. Be sure you have write permissions on both folders. ``` yaml bushidoio_pdf: tmp: ~ ttffontdatapath: ~, (*5)

Usage examples
--------------
You can transform any HTML string to PDF with the `bushidoio_pdf` service:
``` php
public function indexAction()
{
    ...
    $PDFService = $this->get('bushidoio_pdf');
    $html = '...';
    $pdf = $PDFService->createPDFFromHtml($html);
    ...
}

You can use Twig templates, or anything you like, to create the HTML string: ``` php public function indexAction() { ... $PDFService = $this->get('bushidoio_pdf'); $html = $this->get('twig')->render( 'default/index.html.twig', array( 'greeting' => 'Hi' ) ); $pdf = $PDFService->createPDFFromHtml($html); ... }, (*6)

With the `createResponse` method a `Symfony\Component\HttpFoundation\Response`
object is returned with `application/pdf` content type that will be directly
downloaded if returned in a controller action:
``` php
public function indexAction()
{
    $PDFService = $this->get('bushidoio_pdf');
    $html = $this->get('twig')->render(
        'default/index.html.twig',
        array(
            'greeting' => 'Hi'
        )
    );

    return $PDFService->createResponse($html);
}

The Versions

17/02 2018

dev-master

9999999-dev https://github.com/BushidoIO/PDFBundle

BushidoIOPDFBundle

  Sources   Download

MIT

The Requires

 

by Eneko

symfony pdf

17/02 2018

v2.0.0

2.0.0.0 https://github.com/BushidoIO/PDFBundle

BushidoIOPDFBundle

  Sources   Download

MIT

The Requires

 

by Eneko

symfony pdf

06/05 2016

v1.0.0

1.0.0.0 https://github.com/BushidoIO/PDFBundle

BushidoIOPDFBundle

  Sources   Download

MIT

The Requires

 

by Eneko

pdf