Download the PHP package mikehaertl/pdfable without Composer

On this page you can find all versions of the php package mikehaertl/pdfable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pdfable

PDFable

PDFable is a Yii extension to create PDFs from web pages with PHPWkHtmlToPdf (included).

Requirements

PDFable requires the wkhtmltopdf binary to be installed on your system.

Installation

Download the package file and unzip it to the extensions directory. Note, that you may want to rename the directory from pdfable-x.y.z to pdfable.

Example module

To try out the extension, you can configure the pdfable example module in your main.php:

The module should then be available from http://localhost/index.php?r=pdfable/demo or whatever you use as hostname. I recommend to have a look at this example module's code.

Basic configuration

PDFable comes as a controller behavior which gets attached through behaviors:

Basic use

To render single page PDFs from a view file you just call renderPdf() instead of render(). This will convert the view file to a PDF and display it inline in the browser:

Just as with render() you can of course also render more complex views with custom data. And if you want to open a download dialog, you can also pass the download filename as 4th argument:

The third parameter allows you to pass additional PDF page options to wkhtmltopdf. See advanced configuration below.

Advanced use

Multi-Page PDFs

PDFs with more than one page (=view) are also possible. Here you would use the createPdf() method. It returns a PdfFile object.

Use from console commands

You can also create PDFs from console commands through the low-level PdfFile class. The following example is taken from the example module:

If you want to try the example command you can add it to the commandMap in your console.php:

You then can create an example PDF with ./yiic demopdf --filename=/tmp/demo.pdf.

Advanced configuration

It's recommended to have a look at the PHPWkHtmlToPdf documentation. All the options described there are also available with PDFable.

Default page options

You can set default PDF options for the document and each page in the behaviors() method:

Override hardcoded page defaults

The behavior uses some hardcoded defaults for document and page options (see PdfFile). Your configuration above will always be merged with these defaults. If you don't like this and want complete freedom instead, then configure the behavior like this:

Custom page options

You can supply custom wkhtmltopdf page options along as third parameter to renderPdf(). The format is the same as for addPage() in PHPWkHtmlToPdf.


All versions of pdfable with dependencies

PHP Build Version
Package Version
Requires php Version >=5.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mikehaertl/pdfable contains the following files

Loading the files please wait ....