PHPackages                             gianksp/cakephp-dompdf - 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. gianksp/cakephp-dompdf

ActiveCakephp-plugin[PDF &amp; Document Generation](/categories/documents)

gianksp/cakephp-dompdf
======================

Dompdf Plugin for CakePHP

047PHP

Since Jun 5Pushed 9y ago1 watchersCompare

[ Source](https://github.com/gianksp/cakephp-dompdf)[ Packagist](https://packagist.org/packages/gianksp/cakephp-dompdf)[ RSS](/packages/gianksp-cakephp-dompdf/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PDF View for the CakePHP Framework
==================================

[](#pdf-view-for-the-cakephp-framework)

This plugin for the CakePHP Framework allows you to use the dompdf HTML to PDF converter to easily create PDF documents. It's tightly integrated with the CakePHP view renderer.

Requirements
------------

[](#requirements)

- [PHP 5+](http://www.php.net)
- [CakePHP 2+](http://www.cakephp.org)
- [dompdf 0.6+](http://code.google.com/p/dompdf)

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

[](#installation)

```
composer require gianksp/cakephp-dompdf:dev-master
```

### Vendor Files

[](#vendor-files)

Download [dompdf 0.6](http://code.google.com/p/dompdf/downloads/list) and move the content of the archive to `Plugin/Dompdf/Vendor/dompdf`.

### Cache Permissions

[](#cache-permissions)

Please create a cache folder for dompdf called `dompdf` in `APP/tmp/cache` and change the permissions to 777.

Usage
-----

[](#usage)

Because of the tight integration between this plugin and CakePHP, there's only a few things you have to do to get started.

1. Load the plugin by adding `CakePlugin::load('Dompdf', array('bootstrap' => true));` to `APP/Config/bootstrap.php`.
2. Instruct CakePHP to look for the PDF extension by adding `Router::parseExtensions('pdf');` to `APP/Config/routes.php`. If you already use `Router::parseExtensions` in your project, simply add 'pdf' to the list.
3. Finally, make sure that the RequestHandlerComponent is loaded for all controllers by adding `public $components = array('RequestHandler');` to `APP/Controller/AppController.php`.

### Configuration Options

[](#configuration-options)

Copy the `APP/Plugin/Dompdf/Config/dompdf.php` to `APP/Config` if you want to change any of the default configuration.

### Layout

[](#layout)

You'll need to create the default layout for your PDF documents by creating a file named `default.ctp` in `APP/View/Layouts/pdf`.

### Views

[](#views)

For each action that should return a PDF, simply create a `pdf` folder in the folder where the views for the controller reside and create a file with the name of the action inside the `pdf` folder.

For example, if your controller is named DocumentsController and the action is named view, you need to create the `view.ctp` file in `APP/View/Documents/pdf`.

### View Variables

[](#view-variables)

There are a few view variables that you can use to change the behaviour of the view.

- `download` Set to true to set a `Content-Disposition` header. This is ideal for file downloads.
- `name` The filename that will be sent to the user, specified with the extension.
- `paperOrientation` The paper orientation. Must be either 'landscape' or 'portrait'.
- `paperSize` The paper size. Acceptable values include 'letter', 'legal', 'a4', etc. See `CPDF_Adapter::$PAPER_SIZES`.

Example:

```
public function view($id)
{
    // ...

    $params = array(
        'download' => false,
        'name' => 'example.pdf',
        'paperOrientation' => 'portrait',
        'paperSize' => 'legal'
    );
    $this->set($params);
}

```

### URL

[](#url)

To access any action as a PDF, all you have to do is point your browser to the URL associated with the action in question and add '.pdf' at the end just like you would do for JSON or XML.

For example:

```
http://example.com/documents/view/100.pdf

```

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1526510?v=4)[Giancarlo Sanchez](/maintainers/gianksp)[@gianksp](https://github.com/gianksp)

---

Top Contributors

[![fdeschenes](https://avatars.githubusercontent.com/u/876332?v=4)](https://github.com/fdeschenes "fdeschenes (6 commits)")[![gsanchez-glofox](https://avatars.githubusercontent.com/u/21223778?v=4)](https://github.com/gsanchez-glofox "gsanchez-glofox (6 commits)")

### Embed Badge

![Health badge](/badges/gianksp-cakephp-dompdf/health.svg)

```
[![Health](https://phpackages.com/badges/gianksp-cakephp-dompdf/health.svg)](https://phpackages.com/packages/gianksp-cakephp-dompdf)
```

###  Alternatives

[rodenastyle/stream-parser

PHP Multiformat Streaming Parser

442206.4k2](/packages/rodenastyle-stream-parser)[davcpas1234/laravelpdfviewer

A Laravel Package for viewing PDF files or documents on Web App

2414.6k](/packages/davcpas1234-laravelpdfviewer)[akeneo-labs/excel-connector-bundle

Akeneo PIM Excel connector bundle

166.4k](/packages/akeneo-labs-excel-connector-bundle)

PHPackages © 2026

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