PHPackages                             discustecnologia/pdf-report-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. discustecnologia/pdf-report-bundle

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

discustecnologia/pdf-report-bundle
==================================

Symfony Bundle. Wrapper of wkhtmltopdf that uses twig templating to generate pdf files.

1.0.1(8y ago)118MITPHPPHP &gt;=5.5.9

Since May 18Pushed 8y agoCompare

[ Source](https://github.com/DiscusTecnologia/pdf-report-bundle)[ Packagist](https://packagist.org/packages/discustecnologia/pdf-report-bundle)[ RSS](/packages/discustecnologia-pdf-report-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

pdf-report-bundle
=================

[](#pdf-report-bundle)

[![logo Discus Tecnologia](https://camo.githubusercontent.com/f61601e97c1cc79a1ec9184c8a27b8a4e5aaff6f062ce78025d901a9f78a6daa/68747470733a2f2f7777772e6469736375737465636e6f6c6f6769612e636f6d2e62722f696d616765732f6c6f676f5f70712e706e67)](http://www.discustecnologia.com.br)

Symfony Bundle. Wrapper of wkhtmltopdf that uses twig templating to generate pdf files.

---

Dependencies
------------

[](#dependencies)

You need of wkhtmltopdf installed in your system.

Instalation
-----------

[](#instalation)

You need of the [wkhtmltopdf](https://wkhtmltopdf.org/) installed in your OS.

Require the bundle with composer:

```
composer require discustecnologia/pdf-report-bundle
```

Enable the bundle in the kernel:

```
public function registerBundles()
{
    $bundles = [
        // ...
        new DiscusTecnologia\PdfReportBundle\DiscusTecnologiaPdfReportBundle(),
        // ...
    ];
    ...
}
```

How to use
----------

[](#how-to-use)

In controllers instead of use:

```
return $this->render(...);
```

You should use:

```
$pdfReport = $this->get('discus-tecnologia.pdf-report');

$pdfReport->setHeader('default/header.twig');
$pdfReport->setFooter('default/footer.twig');
$pdfReport->setMargins(20, 20, 20, 20);
$pdfReport->addPages('default/testReport.twig', []);

return $pdfReport->generate();
```

Example of twig report based on records which shows 4 records per page:

```
{% for i in ((pdfReportPageNumber -1) * 4)..(((pdfReportPageNumber * 4)-1) < (obj|length - 1) ? ((pdfReportPageNumber * 4)-1) : obj|length-1) %}
{{ obj[i] }}
{% endfor %}
```

Example Symfony Controller
--------------------------

[](#example-symfony-controller)

```
namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use DiscusTecnologia\PdfReportBundle\Service\PdfReport;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        $pdfReport = $this->get('discus-tecnologia.pdf-report');

        $pdfReport->setSavePDF("/var/tmp/pdfreport.pdf");
        $pdfReport->setHeader('default/header.twig');
        $pdfReport->setFooter('default/footer.twig');
        $pdfReport->setMargins(20, 20, 20, 20);
        //Default size is A4. You can use A0, A1, A2, A3, A4, A5 or pass custom size array as [width, height]
        $pdfReport->setPageSize(PdfReport::A3);
        $pdfReport->setGrayscale(true);
        $pdfReport->setOrientationLandscape();
        $pdfReport->setTotalPages(2);
        $pdfReport->setHeaderHeight(40);
        $pdfReport->setFooterHeight(40);
        $pdfReport->setCss("#footer p {
            font-size: 10px;
            text-align: center;
            background: #ccc;
        }

        #content {
            width:      168mm;
            /*border: 1px #000000 solid;*/
        }

        p {
            /*border: 1px #FF0000 solid;*/
            max-width:      168mm;
            text-indent: 30px;
            margin-bottom: 15px;
            line-height: 20px;
            font-size: 14px;
            text-align: justify;
        }");
        $pdfReport->addPages('default/testeRel.twig', ['obj' => ['a', 'b', 'c', 'd', 'e', 'f', 'g'] ]);
        return $pdfReport->generate();
        //return $pdfReport->renderHTML(); //use for debug
    }
}
```

Licence
-------

[](#licence)

This bundle is under the MIT license. See the complete license in the bundle.

Credits
-------

[](#credits)

Author: **Rodrigo Ramos**

*Discus Tecnologia*

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~3 days

Total

2

Last Release

3276d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1013365264c3fc09e808eea0066f98850140d7f599b6c1c989301f0e09fe40e?d=identicon)[rodrigoramosrx2](/maintainers/rodrigoramosrx2)

---

Top Contributors

[![rodrigoramosrx2](https://avatars.githubusercontent.com/u/22638777?v=4)](https://github.com/rodrigoramosrx2 "rodrigoramosrx2 (2 commits)")

---

Tags

symfonybundlepdfreport

### Embed Badge

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

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

###  Alternatives

[nucleos/dompdf-bundle

This bundle provides a wrapper for using dompdf inside symfony.

54882.8k1](/packages/nucleos-dompdf-bundle)[sensiolabs/gotenberg-bundle

A Symfony bundle that provides seamless integration with Gotenberg for generating PDFs and screenshots from various sources (HTML, Markdown, Office documents, URLs) with a clean, builder-based API.

210210.4k2](/packages/sensiolabs-gotenberg-bundle)[ensepar/html2pdf-bundle

Use HTML2PDF as a Symfony Service

27669.3k](/packages/ensepar-html2pdf-bundle)[spraed/pdf-generator-bundle

This bundle creates (multiple) PDFs in Symfony from Twig/HTML templates.

52516.3k](/packages/spraed-pdf-generator-bundle)[bobv/latex-bundle

Latex and pdf generator for Symfony 2

2432.7k](/packages/bobv-latex-bundle)[onurb/excel-bundle

Symfony Bundle to read or write Excel file (including pdf, xlsx, odt), using phpoffice/phpspreadsheet library (replacement of phpoffice/phpexcel, abandonned)

15332.0k](/packages/onurb-excel-bundle)

PHPackages © 2026

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