2017 © Pedro Peláez
 

symfony-bundle tcpdf-bundle

Integration of the tcpdf library with Symfony

image

acucchieri/tcpdf-bundle

Integration of the tcpdf library with Symfony

  • Friday, September 15, 2017
  • by acucchieri
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 5 % Grown

The README.md

ACTcpdfBundle

The ACTcpdfBundle integrates the TCPDF PHP library with Symfony. This means easy-to-implement and easy-to-ouptput PDF documents in your Symfony application., (*1)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

composer require acucchieri/tcpdf-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:, (*4)

``` php // app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = [ // ... new AC\TcpdfBundle\ACTcpdfBundle(), ];, (*5)

    // ...
}

}, (*6)


Usage ----- Use `AC\TcpdfBundle\Pdf\PdfBuider` to create your PDF document. This class extends TCPDF, see [TCPDF documentation](https://tcpdf.org) for more informations about PDF generation. ### PDF Output `ACTcpdfBundle` provide helpers to serve your PDF #### Display the PDF in the browser Return a Response with `Content-Disposition: inline` ``` php $myPdf->inline('my-pdf.doc');

Download the PDF

Return a Response with Content-Disposition: attachment, (*7)

``` php $myPdf->download('my-pdf.doc');, (*8)


#### Get the PDF as base64 mime multi-part email attachment (RFC 2045) ``` php $myPdf->attachment('my-pdf.doc');

Save the PDF on a filesystem

``` php $myPdf->save('/path/to/my-pdf.doc');, (*9)


#### Output the PDF as string ``` php $myPdf->toString();

MultiCell Helper

AC\TcpdfBundle\Pdf\PdfBuilder::addMultiCellRow($cells, $sameHeight, $nobr) allow you to build complex tables, based on MultiCell., (*10)

$cells is a multidimensional array. Each cell (array) contains : * The data (text or html) * The options. Available options : * height Cell height * width Cell width * border Draw the cell borders. Allowed values : 0 or 1. Default = 0 * align Horz alignment. Allowed values : 'L' (left), 'C' (center), 'R' (right) or 'J' (justify). Default = 'T' * valign Vert alignment. Allowed values 'T' (top), 'M' (middle) or 'B' (bottom). Default = 'T' * fill Indicates if the cell background must be painted. true or false. Default = false * is_html Indicate if the data is html. See TCDPF doc for the supported tags. Default = false, (*11)

$sameHeight If set to true all the row cells have the same height. Default = false., (*12)

$nobr If set to true the row is not break across 2 pages. Default = false., (*13)

Example, (*14)

``` php $data = [ ['foo' => 'AAA', 'bar' => 123, 'baz' => 'text'], ['foo' => 'BBB', 'bar' => 456, 'baz' => 'link'], ['foo' => 'CCC', 'bar' => 789, 'baz' => ', (*15)

  • line 1
  • line 2

'], ];, (*16)

foreach ($data as $row) { $pdf->addRowCell([ [$row['foo'], ['with' => 30]], [$row['bar'], ['width' => 40, 'align' => 'R']], [$row['baz'], ['width' => 50, 'is_html' => true]], ]); } ```, (*17)

License

This bundle is under the MIT license. See the complete license in the bundle, (*18)

The Versions

15/09 2017

dev-develop

dev-develop https://github.com/acucchieri/ACTcpdfBundle

Integration of the tcpdf library with Symfony

  Sources   Download

MIT

The Requires

 

symfony pdf tcpdf

08/07 2017

dev-master

9999999-dev https://github.com/acucchieri/ACTcpdfBundle

Integration of the tcpdf library with Symfony

  Sources   Download

MIT

The Requires

 

symfony pdf tcpdf

08/07 2017

v1.0.0

1.0.0.0 https://github.com/acucchieri/ACTcpdfBundle

Integration of the tcpdf library with Symfony

  Sources   Download

MIT

The Requires

 

symfony pdf tcpdf