violet88/silverstripe-dompdf

There is no license information available for the latest version (dev-main) of this package.

SilverStripe PDF Generation via DOMPDF Library

Installs: 45

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 43

Type:silverstripe-vendormodule

dev-main 2024-02-20 12:49 UTC

This package is auto-updated.

Last update: 2024-04-20 13:06:44 UTC


README

This is a fork of https://github.com/burnbright/silverstripe-dompdf for use with Composer.

Maintainer: Jeremy Shipman (jeremy@burnbright.net)

Makes use of: https://github.com/dompdf/dompdf Dompdf websites: http://dompdf.github.com/, http://pxd.me/dompdf/www/

Input:

  • HTML string (which could be rendered template)
  • HTML File

Output

  • PDF File location
  • SS File
  • PDF binary stream to browser

Installation

###Composer

  • On the command line, cd into your sites root folder
  • Run composer require gdmedia/silverstripe-dompdf
  • Run dev/build?flush=all in your browser

###Manually

Example usage

	$pdf = new SS_DOMPDF();
	$pdf->setHTML($mydataobject->renderWith('MyTemplate'));
	$pdf->render();
	$pdf->toFile('mypdf.pdf');

Debugging

The $pdf->streamdebug(); function is useful for quickly viewing pdfs, particularly if your browser supports displaying pdfs, rather than downloading.

You can check your html before it is converted like this:

	echo $mydataobject->renderWith('MyTemplate');die();

Useful Tips