PHPackages                             lukyrys/pdf-response - 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. lukyrys/pdf-response

AbandonedLibrary[PDF &amp; Document Generation](/categories/documents)

lukyrys/pdf-response
====================

Fork of pdf-response, Pdf response extension for Nette Framework

v2.2.8(5y ago)01.4kLGPL-3.0-onlyPHP

Since Feb 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/lukyrys/PdfResponse)[ Packagist](https://packagist.org/packages/lukyrys/pdf-response)[ RSS](/packages/lukyrys-pdf-response/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (16)Used By (0)

PDF Response for Nette 2
========================

[](#pdf-response-for-nette-2)

[![Build Status](https://camo.githubusercontent.com/6c9be6fee6bd780b62c752f38137f08ecd0c386b2feb1c841b5e436efcaf2ca3/68747470733a2f2f7472617669732d63692e6f72672f4a6f73656b692f506466526573706f6e73652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Joseki/PdfResponse)[![Latest Stable Version](https://camo.githubusercontent.com/0f26b0ea57301fc72d86dedb8ea4dd5b57a8e75f1991ec404e9b935ae479a93a/68747470733a2f2f706f7365722e707567782e6f72672f6a6f73656b692f7064662d726573706f6e73652f762f737461626c65)](https://packagist.org/packages/joseki/pdf-response)[![Total Downloads](https://camo.githubusercontent.com/51b2dea4622ba05fc441fb13c5e07b80c7ce94efdc24298dce0ddc4ded9f9cd0/68747470733a2f2f706f7365722e707567782e6f72672f6a6f73656b692f7064662d726573706f6e73652f646f776e6c6f616473)](https://packagist.org/packages/joseki/pdf-response)

- sends template as PDF output
- works fine with both Nette 2.0.\* and Nette 2.1.\* and even Nette 2.2.\*
- no js support
- nice api

Install
-------

[](#install)

Installation via Composer.

```
{
    "require":{
        "joseki/pdf-response": ">= 2.1"
    }
}

```

How to prepare PDF from template
--------------------------------

[](#how-to-prepare-pdf-from-template)

```
// in a Presenter
public function actionPdf()
{
    $template = $this->createTemplate();
    $template->setFile("/path/to/template.latte");
    $template->someValue = 123;
    // Tip: In template to make a new page use

    $pdf = new Joseki\Application\Responses\PdfResponse($template);

    // optional
    $pdf->documentTitle = date("Y-m-d") . " My super title"; // creates filename 2012-06-30-my-super-title.pdf
    $pdf->pageFormat = "A4-L"; // wide format
    $pdf->getMPDF()->setFooter("|© www.mysite.com|"); // footer
}
```

Save file to server
-------------------

[](#save-file-to-server)

```
public function actionPdf()
{
    $template = $this->createTemplate();
    $template->setFile("/path/to/template.latte");

    $pdf = new Joseki\Application\Responses\PdfResponse($template);

    $pdf->save("/path/to/directory"); // as a filename $this->documentTitle will be used
    $pdf->save("/path/to/directory", "filename"); // OR use a custom name
}
```

Attach file to an email
-----------------------

[](#attach-file-to-an-email)

```
public function actionPdf()
{
    $template = $this->createTemplate();
    $template->setFile("/path/to/template.latte");

    $pdf = new Joseki\Application\Responses\PdfResponse($template);

    $savedFile = $pdf->save("/path/to/directory");
    $mail = new Nette\Mail\Message;
    $mail->addTo("john@doe.com");
    $mail->addAttachment($savedFile);
    $mailer = new SendmailMailer();
    $mailer->send($mail);
}
```

Force file to download
----------------------

[](#force-file-to-download)

```
public function actionPdf()
{
    $template = $this->createTemplate();
    $template->setFile("/path/to/template.latte");

    $pdf = new Joseki\Application\Responses\PdfResponse($template);
    $pdf->setSaveMode(PdfResponse::DOWNLOAD); //default behavior
    $this->sendResponse($pdf);
}
```

Force file to display in a browser
----------------------------------

[](#force-file-to-display-in-a-browser)

```
public function actionPdf()
{
    $template = $this->createTemplate();
    $template->setFile("/path/to/template.latte");

    $pdf = new Joseki\Application\Responses\PdfResponse($template);
    $pdf->setSaveMode(PdfResponse::INLINE);
    $this->sendResponse($pdf);
}
```

Set a pdf background easily
---------------------------

[](#set-a-pdf-background-easily)

```
public function actionPdf()
{
    $pdf = new Joseki\Application\Responses\PdfResponse('');
    $pdf->setBackgroundTemplate("/path/to/an/existing/file.pdf");

    // to write into an existing document use the following statements
    $mpdf = $pdf->getMPDF();
    $mpdf->WriteFixedPosHTML('hello world', 1, 10, 10, 10);

    // to write to another page
    $mpdf->AddPage();

    // to move to exact page, use
    $mpdf->page = 3; // = move to 3rd page

    $this->sendResponse($pdf);
}
```

Create pdf with latte only
--------------------------

[](#create-pdf-with-latte-only)

```
public function actionPdf()
{
    $latte = new Latte\Engine;
    $latte->setTempDirectory('/path/to/cache');
    $latte->addFilter('money', function($val) { return ...; }); // formerly registerHelper()

    $latte->onCompile[] = function($latte) {
        $latte->addMacro(...); // when you want add some own macros, see http://goo.gl/d5A1u2
    };

    $template = $latte->renderToString("/path/to/template.latte");

    $pdf = new Joseki\Application\Responses\PdfResponse($template);
    $this->sendResponse($pdf);
}
```

See also
--------

[](#see-also)

- [Nette forum](http://forum.nette.org/cs/3726-addon-pdfresponse-pdfresponse) (czech)
- [Nette Addons](http://addons.nette.org/joseki/pdf-response)

###  Health Score

33

—

LowBetter than 76% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~208 days

Recently: every ~411 days

Total

15

Last Release

1870d ago

Major Versions

v1.2.0 → v2.0.02013-04-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/01e4841749ee2b4cf7211d784b093bf67523ed6489c6931401211b130df13884?d=identicon)[lukyrys](/maintainers/lukyrys)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (10 commits)")[![lukyrys](https://avatars.githubusercontent.com/u/2318346?v=4)](https://github.com/lukyrys "lukyrys (8 commits)")[![castamir](https://avatars.githubusercontent.com/u/1245190?v=4)](https://github.com/castamir "castamir (4 commits)")[![Ciki](https://avatars.githubusercontent.com/u/342730?v=4)](https://github.com/Ciki "Ciki (1 commits)")[![f3l1x](https://avatars.githubusercontent.com/u/538058?v=4)](https://github.com/f3l1x "f3l1x (1 commits)")[![AndrewHlavac](https://avatars.githubusercontent.com/u/7056816?v=4)](https://github.com/AndrewHlavac "AndrewHlavac (1 commits)")[![Pomezny](https://avatars.githubusercontent.com/u/4263174?v=4)](https://github.com/Pomezny "Pomezny (1 commits)")[![solcik](https://avatars.githubusercontent.com/u/1543737?v=4)](https://github.com/solcik "solcik (1 commits)")

### Embed Badge

![Health badge](/badges/lukyrys-pdf-response/health.svg)

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

###  Alternatives

[carlos-meneses/laravel-mpdf

Laravel Mpdf: Using Mpdf in Laravel to generate Pdfs.

4403.0M5](/packages/carlos-meneses-laravel-mpdf)[kartik-v/yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.

1745.4M81](/packages/kartik-v-yii2-mpdf)[contributte/pdf

Pdf response extension for Nette Framework

42939.4k2](/packages/contributte-pdf)[robregonm/yii2-pdf

Yii 2 PDF Response Formatter

4647.3k1](/packages/robregonm-yii2-pdf)[jkuchar/pdfresponse

PdfResponse is wrapper of mPDF for Nette.

10325.2k](/packages/jkuchar-pdfresponse)

PHPackages © 2026

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