3dgoo/silverstripe-dompdf

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

Silverstripe PDF Generation via DOMPDF Library

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 43

Type:silverstripe-module

1.0.0 2023-03-19 11:51 UTC

This package is auto-updated.

Last update: 2024-10-19 15:37:53 UTC


README

This module provides PDF generation through the dompdf library for Silverstripe 3.

This is a fork of:

Input:

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

Output

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

Installation (with composer)

$ composer require 3dgoo/silverstripe-dompdf

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