Download the PHP package pieceofcake2/cakepdf without Composer

On this page you can find all versions of the php package pieceofcake2/cakepdf. 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 cakepdf

CakePdf plugin

Packagist Version PHP CakePHP CI Codecov

This is forked for CakePHP2.

Plugin containing CakePdf lib which will use a PDF engine to convert HTML to PDF.

Current engines:

Requirements

Installation

In your app directory type

Setup

In app/Config/bootstrap.php add:

Configuration

Use Configure::write('CakePdf', $config); or set Controller property $pdfConfig (only when used with PdfView) You need to define at least $config['engine']. When using CakePdf directly you can also pass the config array to constructor. The value for engine should have the Plugin.ClassName format without the Engine suffix

Configuration options:

Example:

Usage

You can use CakePdf in 2 ways, read carefully which one you actually need. Many people mix both ways and dont get the expected results.

1: Render as PDF (including forced download) in the browser with PdfView

You can create PDF view and layout files for your controller actions and have them automatically rendered. Place the view templates in a 'pdf' subdir, for instance app/View/Invoices/pdf/view.ctp Layouts will be in app/View/Layouts/pdf/default.ctp

Make sure your InvoicesController has RequestHandler Component in the $components array. Browse to http://localhost/invoices/view/1.pdf

Additionally you can map resources by adding Router::mapResources(array('Invoices')); to your routes file and you can access the same document at http://localhost/invoices/1.pdf

2: Create PDF for email attachment, file storage etc.

You can use CakePdf lib to create raw PDF data with a view template. The view file path would look like app/View/Pdf/newsletter.ctp. Layout file path would be like app/View/Layouts/pdf/default.ctp Note that layouts for both usage types are within same directory, but the view templates use different file paths Optionally you can also write the raw data to file.

Example:

Encryption

You can optionally encrypt the PDF with permissions

To use encryption you first need to select a crypto engine. Currently we support the following crypto engines:

Usage

Add the following in your bootstrap.

Options in pdfConfig:

Permissions:

By default, we deny all permissions.

To allow all permissions:

Set 'permission' to true

To allow specific permissions:

Set 'permissions' to an array with a combination of the following available permissions:

Note about static assets

Use absolute URLs for static assets in your view templates for PDFs. If you use HtmlHelper::image(), HtmlHelper::script() or HtmlHelper::css() make sure you have $options['fullBase'] = true

Another solution would be to create a AppHelper of which it would force $options['fullBase'] = true for PDF requests. e.g:

Thanks

Many thanks to Kim Biesbjerg and Jelle Henkens for their contributions. Want your name here as well? Create a pull request for improvements/other PDF engines.


All versions of cakepdf with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
composer/installers Version ^1.0 || ^2.0
pieceofcake2/cakephp Version ^2.12
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 pieceofcake2/cakepdf contains the following files

Loading the files please wait ...