Skip to content

Easily create PDF files in SilverStripe with this module

Notifications You must be signed in to change notification settings

seppzzz/silverstripe-dompdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Generation via DOMPDF Library

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

Maintainer: Jeremy Shipman ([email protected])

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

About

Easily create PDF files in SilverStripe with this module

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%