Source of file PdfControllerExtension.php
Size: 0,845 Bytes - Last Modified: 2021-12-23T10:25:45+00:00
/var/www/docs.ssmods.com/process/src/src/Extension/PdfControllerExtension.php
12345678910111213141516171819202122232425262728293031323334353637 | <?php namespace Symbiote\PdfRendition\Extension; use SilverStripe\Core\Extension; use Symbiote\PdfRendition\Service\PDFRenditionService; use SilverStripe\Control\Controller; /** * Action for converting a page to a pdf. * * @author marcus@silverstripe.com.au * @license http://silverstripe.org/bsd-license/ */ class PdfControllerExtension extends Extension { private static $allowed_actions = array( 'topdf', ); /** * Return a link to generate the current content item as a PDF * * @return string */ public function PdfLink() { return $this->owner->Link(Controller::join_links('topdf', $this->owner->data()->URLSegment.'.pdf')); } /** * Generates a PDF file for the current page */ public function topdf() { singleton(PDFRenditionService::class)->renderPage($this->owner->data(), '', 'browser'); return; } } |