2017 © Pedro Peláez
 

library kohana-html2pdf

A Kohana module to convert HTML to a PDF document using wkhtmltopdf as the conversion backend

image

evanpurkhiser/kohana-html2pdf

A Kohana module to convert HTML to a PDF document using wkhtmltopdf as the conversion backend

  • Tuesday, May 6, 2014
  • by EvanPurkhiser
  • Repository
  • 2 Watchers
  • 8 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

HTML2PDF Document converter

HTML2PDF is a Kohana 3.x module that can be used to convert a HTML document into a PDF document. This module uses the wkhtmltopdf as a back-end to handle the conversions., (*1)

Requirements

You must have the wkhtmltopdf static binary (at least version 0.10 RC1) installed onto your machine and in the PATH read by the user executing the PHP application, (*2)

Usage

You can create a PDF document from HTML like so (Optionally specifying the HTML content), (*3)

$document = HTML2PDF::document($html)

From here you can apply some different formatting options to the document including, (*4)

  • $document->body($html) - Set the HTML body content of the PDF
  • $document->header($html) - Set the HTML to render at the top of each page
  • $document->header_spacing($spacing) - Set the spacing between the content and header
  • $document->margins($top, $left, $bottom, $right) - Set the margins for the document (in millimeters)

See the class itself for all the available methods., (*5)

Finally you can then render the document as a PDF two different ways. You can eaither save the PDF to a file on the file-system, or you can convert the PDF and have the PDF BLOB returned., (*6)

// Save to the filesystem
$document->save('/home/evan/document.pdf');

// Save to filesystem and return temporary file path
$temp_path = $document->save();

// Convert and put the BLOB into a variable
$pdf_blob = $document->convert();

The Versions

06/05 2014

dev-3.3/master

dev-3.3/master https://github.com/EvanPurkhiser/kohana-HTML2PDF

A Kohana module to convert HTML to a PDF document using wkhtmltopdf as the conversion backend

  Sources   Download

MIT

The Requires

 

by Evan Purkhiser

pdf wkhtmltopdf kohana