We've moved! You can find modules, themes and widgets on http://addons.silverstripe.org.
This page will no longer be updated, and disappear soon. Module maintainers, please read our announcement to find out how to add your modules there.

PDFGenerator [v20091229]

Maintainer(s): Pike
Supported by: Not supported

The PDFGenerator module uses very good Open Source modified source from html2ps and html2pdf version 2.0.43. to generate PDFs from SilverStripe templates.
Warning: it is for php4, but works with php5 too.

To generate a PDF, you will first need to make an HTML/CSS template that will provide the content of the PDF.
In both of these examples, $Rendered is going to be rendered with your custom PDFTemplateName.ss.
Use this syntax to send a PDF file to the user. You could define this as a method on a controller, for example

Use this syntax to generate a PDF file from memory.

function PagePdf() {
$page_url = Controller::curr()->Link();
$page_url = str_replace("/",'', $page_url );
$filename = $page_url; // no extension ".pdf"
$Rendered = $this;
$Rendered = $this->customise( $Rendered )->renderWith( array('Page_print','Page' ) );
$pdf = new PDFGenerator();
$pdf->setData( $Rendered );
$pdf->setName( $filename );
$pdf->getPDF(1);
}

Use this syntax to save a PDF file to a location on the server.

function PagePdf() {
$page_url = Controller::curr()->Link();
$page_url = str_replace("/",'', $page_url );
$filename = $page_url; // no extension ".pdf"
$Rendered = $this;
$Rendered = $this->customise( $Rendered )->renderWith( array('Page_print','Page' ) );
$pdf = new PDFGenerator();
$pdf->setData( $Rendered );
$pdf->setName( $filename );
$pdf->getPDF(2);
}

Module screenshot

Release(s)

  • Latest release

    Version: [v20091229]
    Date: 2009-12-29
    Compatible with: SilverStripe 2.3.3
    Download: PDFGenerator20091229.zip

 
 

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.