namespace Mpdf\Pdf\Protection; class UniqidGenerator { public function __construct() { if (!function_exists('random_int') || !function_exists('random_bytes')) { throw new \Mpdf\MpdfException( 'Unable to set PDF file protection, CSPRNG Functions are not available. ' . 'Use paragonie/random_compat polyfill or upgrade to PHP 7.' ); } } /** * @return string */
$fontFileFinder = new FontFileFinder($config['fontDir']); $cssManager = new CssManager($mpdf, $cache, $sizeConverter, $colorConverter); $otl = new Otl($mpdf, $fontCache); $protection = new Protection(new UniqidGenerator()); $writer = new BaseWriter($mpdf, $protection); $gradient = new Gradient($mpdf, $sizeConverter, $colorConverter, $writer); $formWriter = new FormWriter($mpdf, $writer);
$this->languageToFont, $this->scriptToLanguage, $this->fontDescriptor, $this->bmp, $this->directWrite, $this->wmf ); $this->services = []; foreach ($services as $key => $service) { $this->{$key} = $service; $this->services[] = $key;
$this->options['margin_header'] = $this->marginHeader; $this->options['margin_footer'] = $this->marginFooter; $this->options['orientation'] = $this->orientation; if (isset($this->tempPath) && is_dir($this->tempPath)) { $this->options['tempDir'] = $this->tempPath; } $this->_mpdf = new Mpdf($this->options); } /** * Fetches the content of the CSS file if supplied * * @return string
* * @return Mpdf */ public function getApi() { if (empty($this->_mpdf) || !$this->_mpdf instanceof Mpdf) { $this->setApi(); } return $this->_mpdf; } /** * Sets the Mpdf API instance
* * @return mixed * @throws InvalidConfigException */ public function output($content = '', $file = '', $dest = self::DEST_BROWSER) { $api = $this->getApi(); $css = $this->getCss(); $pdfAttachments = $this->getPdfAttachments(); if (!empty($this->methods)) { foreach ($this->methods as $method => $param) { $this->execute($method, $param); }
* * @return mixed * @throws InvalidConfigException */ public function render() { return $this->output($this->content, $this->filename, $this->destination); } /** * Validates and fetches the Mpdf API instance. * * @return Mpdf
'methods' => [ //'SetHeader'=>['UFAM'], 'SetFooter'=>['{PAGENO}'], ] ]); return $pdf->render(); } }
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii\web\Application($config))->run();
$_GET = [ 'r' => 'monografia/declaracao', 'id' => '6', ];