Skip to content
This repository

Home 

nyeholt edited this page · 5 revisions

Pages 2

Clone this wiki locally

PDF Renditions in SilverStripe (using XHTMLRenderer)

You must have java installed on the server where SilverStripe is installed, as the PDF Rendition module uses a java application to actually perform the translation from HTML to PDF.

For best results, you should have the PHP tidy module enabled. If this isn't possible, you will need to have the standalone tidy binary available.

Please check the official userguide when trying to figure out how to do something, or the main project page.

Note that the user guide can be downloaded in PDF form, so anything you see in the PDF can be figured out by looking at the HTML + CSS source of the userguide linked above (eg table of contents, headers and footers).

Quick PDFs

Add the following to your mysite/_config.php file

Object::add_extension('Page_Controller', 'PdfControllerExtension');

Now, add the following to themes//templates/Page.ss just below the $Layout variable

<a href="$PDFLink">PDF</a>

When you reload your frontend page, you should now have a link pointing to a pdf file; clicking that will generate a PDF version of the page and stream it to the browser.

Markup hints

Feel free to message me on github if you have any questions on how to achieve something.

Something went wrong with that request. Please try again.