Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yii2tech/html2pdf

Yii2 component for HTML to PDF conversion
https://github.com/yii2tech/html2pdf

html pdf template yii yii2 yii2-extension

Last synced: about 2 hours ago
JSON representation

Yii2 component for HTML to PDF conversion

Awesome Lists containing this project

README

        





HTML to PDF conversion extension for Yii2



This extension provides basic support for HTML to PDF and PHP to PDF conversion.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://img.shields.io/packagist/v/yii2tech/html2pdf.svg)](https://packagist.org/packages/yii2tech/html2pdf)
[![Total Downloads](https://img.shields.io/packagist/dt/yii2tech/html2pdf.svg)](https://packagist.org/packages/yii2tech/html2pdf)
[![Build Status](https://travis-ci.org/yii2tech/html2pdf.svg?branch=master)](https://travis-ci.org/yii2tech/html2pdf)

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

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yii2tech/html2pdf
```

or add

```json
"yii2tech/html2pdf": "*"
```

to the require section of your composer.json.

> Note: you'll have to install software for the actual HTML to PDF conversion separately, depending on the
particular converter, you would like to use.

Usage
-----

This extension provides support for HTML to PDF and PHP to PDF conversion. It allows composition of the PDF files
from HTML and via rendering PHP templates.

Extension functionality is aggregated into `\yii2tech\html2pdf\Manager` application component.
Application configuration example:

```php
[
'html2pdf' => [
'class' => 'yii2tech\html2pdf\Manager',
'viewPath' => '@app/views/pdf',
'converter' => 'wkhtmltopdf',
],
],
...
];
```

For the simple conversion you can use `\yii2tech\html2pdf\Manager::convert()` and `\yii2tech\html2pdf\Manager::convertFile()` methods:

```php

Simple Content