PDF Generation Module ===================== The pdfgeneration module uses [css2xslfo](http://www.re.be/css2xslfo/index.xhtml) to generate PDFs from SilverStripe templates. Maintainer Contact ------------------ Sam Minnée (sam at silverstripe dot com) Requirements ------------ * Java must be callable from the command-line Installation Instructions ------------------------- 1. Unpack the module's archive into a directory called pdfgeneration. 2. Ensure that you have Java installed, and that the 'java' command is in the path. 3. You can visit dev/tasks/TestPDFGeneratorTask to check that the PDF generation is functioning correctly. Usage Overview -------------- 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, `$objToBeRendered` is going to be rendered with `MyTemplateName.ss`. Use this syntax to send a PDF file to the user. You could define this as a method on a controller, for example: function downloadpdf() { $objToBeRendered = $this; $pdf = new PDFGenerator($objToBeRendered, 'MyTemplateName', 'my-pdf-filename.pdf'); return $pdf->sendToBrowser(); } Alternatively, use this syntax to save a PDF file to a location on the server: $pdf = new PDFGenerator($objToBeRendered, 'MyTemplateName', "my-pdf-filename.pdf"); $pdf->generate("../assets/my-pdf-filename.pdf"); For more information on how to design your HTML/CSS, see the [css2xslfo manual](http://www.re.be/css2xslfo/1_6_1/manual.pdf). Specifying fonts ---------------- By default, `pdfgeneration/fonts` is used as the font directory. It contains a single font, DejaVuSans, including it's bold, italic, and bold italic forms. If you wish to specify your own fonts, you should create a directory containing the necessary TTF files. To specify normal, bold, italic, and bold-italic variations of a single font, you should name the files using the following pattern. * `MyFont.ttf` * `MyFont Bold.ttf` * `MyFont Italic.ttf` * `MyFont Bold Italic.ttf` You can then load the new font directory into your `PDFGenerator` object like so: $pdf->setFontDir('mysite/fonts');
seanpm2001/SilverStripe-Archive_SilverStripe-PDFGeneration
The pdfgeneration module uses css2xslfo to generate PDFs from SilverStripe templates.
PHPNOASSERTION