PHPackages                             fbeen/pdf-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. fbeen/pdf-bundle

ActiveSymfony-bundle[PDF &amp; Document Generation](/categories/documents)

fbeen/pdf-bundle
================

This bundle is the same as psliwa/pdf-bundle but works with Symfony 3.3.

1.0.3(10y ago)04.7kMITPHPPHP &gt;=5.3.0

Since Dec 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Fbeen/PdfBundle)[ Packagist](https://packagist.org/packages/fbeen/pdf-bundle)[ RSS](/packages/fbeen-pdf-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

PsPdfBundle
===========

[](#pspdfbundle)

[![Build Status](https://camo.githubusercontent.com/aac1e5142213b8f0133b5586fee4e42bdcc749b4c7ab98dc93e8f62f6a46879d/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f70736c6977612f50646642756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/psliwa/PdfBundle)

This bundle integrates Symfony2 with [PHPPdf](https://github.com/psliwa/PHPPdf) library. Thanks to this bundle you can easily generate PDF or image (png, jpg) files.

Documentation of [PHPPdf](https://github.com/psliwa/PHPPdf) you can find on github (README file).

Installation
------------

[](#installation)

1. Use composer. PsPdfBundle requires "minimum-stability" equals to dev. Run this command:

    composer require fbeen/pdf-bundle dev-master
2. Register bundle in AppKernel:

    ```
     //app/AppKernel.php
     public function registerBundles()
     {
         return array(
             // ..
             new Ps\PdfBundle\PsPdfBundle(),
             // ..
         );
     }

    ```

Configuration
-------------

[](#configuration)

All options are optional.

```
# app/config/config.yml
ps_pdf:
    nodes_file: ~
    fonts_file: ~
    complex_attributes_file: ~
    colors_file: ~
    use_cache_in_stylesheet: ~
    cache:
      type: ~
      options: ~
    markdown_stylesheet_filepath: ~
    markdown_document_template_filepath: ~
    document_parser_type: ~

```

- nodes\_file - path to file with nodes/tags definitions, internal nodes.xml file from PHPPdf library is used by default
- fonts\_file - path to file with fonts definitions, internal fonts.xml file from PHPPdf library is used by default
- complex\_attributes\_file - path to file with complex attributes definitions, internal complex-attributes.xml file from PHPPdf library is used by default
- colors\_file - path to file with default palette of colors, internal colors.xml file from PHPPdf library is used by default
- cache.type - type of cache, supported are all backend cache from Zend\_Cache component (for instance File, Apc, Memcached, Sqlite etc.). File engine is used by default.
- cache.options - specyfic options for cache engine (for instance "cache\_dir" for File engine). cache\_dir by default is as same as kernel.cache\_dir.
- use\_cache\_in\_stylesheet - stylesheet maching rules will be cache, if this option is set. In complex stylesheet cache significantly improves performance. Default is true, but **in dev environment cache should be off**.
- markdown\_stylesheet\_filepath - filepath of stylesheet for markdown parser
- markdown\_document\_template\_filepath - xml document template form output of markdown parser
- document\_parser\_type - default parser type: xml or markdown

Images in source document
-------------------------

[](#images-in-source-document)

If you want to display image, you must provide absolute path to image file via "src" attribute of image tag. Asset Twig function dosn't work, because it converts image path to relative path according to web directory. To make using of images easier, bundle provides Twig function, that converts image logical name to real, absolute path.

Example:

```

```

Bundle based paths in fonts and document xml file
-------------------------------------------------

[](#bundle-based-paths-in-fonts-and-document-xml-file)

If you want to use custom fonts, you should create your own fonts.xml config file (default fonts filepath is PHPPdf\\Resources\\config\\fonts.xml). To make easier defining fonts paths, bundle based paths are supported. Example:

```

```

"%SomeBundle:file.ttf%" will be replaced by "path/to/SomeBundle/Resources/file.ttf"

Example
-------

[](#example)

```
// In controller
//...
use Ps\PdfBundle\Annotation\Pdf;
//...

/**
 * @Pdf()
 */
public function helloAction($name)
{
    $format = $this->get('request')->get('_format');

    return $this->render(sprintf('SomeBundle:SomeController:helloAction.%s.twig', $format), array(
        'name' => $name,
    ));
}

// in helloAction.html.twig
Hello {{ name }}!

// in helloAction.pdf.twig

        Hello {{ name }}!

```

Bundle automatically detects pdf format (via \_format) request and create pdf document from response.

Pdf annotation has four optional properties:

- headers - associative array of specyfic headers
- stylesheet - pdf stylesheet template file in standard Symfony2 notation ("Bundle:Controller:file.format.engine")
- documentParserType - type of parser: xml or markdown
- enableCache - pdf output should by cached? True or false, default: false. Hash (md5) from template and stylesheet content is a cache key, only PHPPdf invocation is cached, controller is always called.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 87.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~239 days

Total

4

Last Release

3813d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1cc8c2d6ff35eeecef4931e636ffd89fc2e84dd772a0168f506ae23d4e5720e7?d=identicon)[fbeen](/maintainers/fbeen)

---

Top Contributors

[![psliwa](https://avatars.githubusercontent.com/u/438063?v=4)](https://github.com/psliwa "psliwa (83 commits)")[![Fbeen](https://avatars.githubusercontent.com/u/2814747?v=4)](https://github.com/Fbeen "Fbeen (5 commits)")[![gido](https://avatars.githubusercontent.com/u/101859?v=4)](https://github.com/gido "gido (1 commits)")[![marphi](https://avatars.githubusercontent.com/u/57309?v=4)](https://github.com/marphi "marphi (1 commits)")[![mcg-web](https://avatars.githubusercontent.com/u/1496283?v=4)](https://github.com/mcg-web "mcg-web (1 commits)")[![phansys](https://avatars.githubusercontent.com/u/1231441?v=4)](https://github.com/phansys "phansys (1 commits)")[![doppynl](https://avatars.githubusercontent.com/u/814475?v=4)](https://github.com/doppynl "doppynl (1 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (1 commits)")[![Ghkuijer](https://avatars.githubusercontent.com/u/1204636?v=4)](https://github.com/Ghkuijer "Ghkuijer (1 commits)")

---

Tags

pdfPHPPdf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fbeen-pdf-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/fbeen-pdf-bundle/health.svg)](https://phpackages.com/packages/fbeen-pdf-bundle)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[tecnickcom/tcpdf

TCPDF is a PHP class for generating PDF documents and barcodes.

4.5k101.8M473](/packages/tecnickcom-tcpdf)[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/packages/mpdf-mpdf)[knplabs/knp-snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.

4.5k68.3M56](/packages/knplabs-knp-snappy)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
