2017 © Pedro Peláez
 

library cakepdf

CakePHP plugin for converting HTML to PDF

image

guenbakku/cakepdf

CakePHP plugin for converting HTML to PDF

  • Wednesday, January 10, 2018
  • by guenbakku
  • Repository
  • 1 Watchers
  • 0 Stars
  • 304 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 62 % Grown

The README.md

Cakepdf

Easily generate PDFs from your HTML content., (*1)

This versatile tool can be used as:, (*2)

  • A CakePHP plugin: Seamlessly integrate PDF generation into your CakePHP 2.x and above applications.
  • A standalone library: Use it independently outside of CakePHP for maximum flexibility.

Powered by Snappy (https://github.com/KnpLabs/snappy)
I want to give a big thanks to the creators of the fantastic Snappy library, which makes this functionality possible., (*3)

Installation

You can install this library using composer., (*4)

composer require guenbakku/cakepdf

Usage

<?php

use Guenbakku\Cakepdf\Pdf;

// Instance object.
// Different with original Snappy, this libary comes with 
// wkhtmltopdf binary which is installed as composer dependencies. 
// So following setup also automatically set wkhtmltopdf binary's path 
// corresponding to current processor's structure (32 or 64 bit).
$pdf = new Pdf();

// Add html to render to pdf.
// Break page will be inserted automatically by wkhtmltopdf.
$html = '

Long html for long pdf, (*5)

'; $pdf->add($html); // Add each html as a seperated pdf page. $page = '

Page, (*6)

'; $pdf->addPage($page) ->addPage($page); // Render output to display in browser. header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="file.pdf"'); $result = $pdf->render(); echo $result; // Or render output to pdf file. $output = '/tmp/cakepdf.pdf'; $pdf->render($output); // Set options for wkhtmltopdf. // Basically same with Snappy's interface. $pdf = new Pdf(); $pdf->setOption('page-size', 'A4') ->setOption('orientation', 'Landscape');

The Versions

10/01 2018

dev-master

9999999-dev

CakePHP plugin for converting HTML to PDF

  Sources   Download

MIT

The Requires

 

The Development Requires

10/01 2018

0.2.0

0.2.0.0

CakePHP plugin for converting HTML to PDF

  Sources   Download

MIT

The Requires

 

The Development Requires

10/01 2018

dev-develop

dev-develop

CakePHP plugin for converting HTML to PDF

  Sources   Download

MIT

The Requires

 

The Development Requires

27/07 2017

0.1.1

0.1.1.0

Convert HTML to PDF plugin for CakePHP 2.x

  Sources   Download

MIT

The Requires

 

The Development Requires

02/07 2017

0.1.0

0.1.0.0

Convert HTML to PDF plugin for CakePHP 2.x

  Sources   Download

MIT

The Requires

 

The Development Requires