2017 © Pedro Peláez
 

symfony-bundle fop-pdf-bundle

Symfony 2 Apache FOP integration

image

m4t1t0/fop-pdf-bundle

Symfony 2 Apache FOP integration

  • Friday, December 13, 2013
  • by m4t1t0
  • Repository
  • 0 Watchers
  • 2 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

Apache FOP Symfony2 Integration Bundle

This bundle provides integration with Apache FOP (http://xmlgraphics.apache.org/fop/) for Symfony2, (*1)

Installation and configuration

Get the bundle

Add to your composer.json, (*2)

{
    "require": {
        "m4t1t0/fop-pdf-bundle": "dev-master"
    }
}

Use composer to download the new requirement, (*3)

$ php composer.phar update m4t1t0/fop-pdf-bundle

Add FopPdfBundle to your application kernel

``` php <?php, (*4)

// app/AppKernel.php public function registerBundles() { return array( // ... new m4t1t0\FopPdfBundle\FopPdfBundle(),
// ... ); }, (*5)


## Configure the bundle If the fop executable is different than /usr/bin/fop you need to configure this in your config.yml file

FopPdfBundle Configuration

fop_pdf: fop: /usr/local/bin/fop, (*6)


# Usage Use the Pdf annotation in your action ``` php <?php /** * @Route("/download-pdf") * @Pdf() */ public function downloadPdfAction() { return array( 'name' => 'Rafa', ); }

Create the view downloadPdf.fo.twig inside your Resources directory, (*7)

{% extends "FopPdfBundle::basea4.fo.twig" %}

{% block content %}
    <fo:block>
        Hello {{ name }}!
    </fo:block>
{% endblock %}

Options

The Pdf annotation suport these options:, (*8)

  • output: the name of the output file. You can use the PHP strftime function format, more info: http://es1.php.net/manual/en/function.strftime.php If you need more conrol over the output file name, you can use _pdf_output variable in your return, (*9)

  • template: Indicates the template to render instead the guesser one., (*10)

php <?php /** * @Route("/download") * @Pdf() */ public function downloadPdfAction() { return array( 'name' => 'Rafa', '_pdf_output' => 'custom_pdf_output_filename.pdf', ); }, (*11)

TODO

  • Support PHP templates, at this moment only twig is supported.
  • Create a service to render the XSL-FO template instead of annotation.
  • Create twig extensions to help the creation of XSL-FO templates.
  • Create more base templates.

Bitdeli Badge, (*12)

The Versions

13/12 2013

dev-master

9999999-dev https://github.com/m4t1t0/FopPdfBundle.git

Symfony 2 Apache FOP integration

  Sources   Download

GPL v2

The Requires

 

by Rafael Matito Matito

pdf fop