; } /** * Sets the base path * * @param string $basePath * @return $this */ public function setBasePath(string $basePath) { $this->basePath = $basePath; return $this; } /** * @return string * @deprecated */ public function get_base_path() { return $this->getBasePath(); } /** * Returns the base path * * @return string */ public function getBasePath() { return $this->basePath; } /** * @param string $default_view The default document view * @param array $options The view's options * @return $this * @deprecated */ public function set_default_view($default_view, $options) { return $this->setDefaultView($default_view, $options); } /** * Sets the default view * * @param string $defaultView The default document view * @param array $options The view's options * @return $this */ public function setDefaultView($defaultView, $options) { $this->defaultView = $defaultView; $this->defaultViewOptions = $options; return $this; } /** * @param resource $http_context * @return $this * @deprecated */ public function set_http_context($http_context) { return $this->setHttpContext($http_context); } /** * Sets the HTTP context * * @param resource|array $httpContext * @return $this */ public function setHttpContext($httpContext) { $this->options->setHttpContext($httpContext); return $this; } /** * @return resource * @deprecated */ public function get_http_context() { return $this->getHttpContext(); } /** * Returns the HTTP context * * @return resource */ public function getHttpContext() { return $this->options->getHttpContext(); } /** * Set a custom `Canvas` instance to render the document to. * * Be aware that the instance will be replaced on render if the document * defines a paper size different from the canvas. * * @param Canvas $canvas * @return $this */ public function setCanvas(Canvas $canvas) { $this->canvas = $canvas; return $this; } /** * @return Canvas * @deprecated */ public function get_canvas() { return $this->getCanvas(); } /** * Return the underlying Canvas instance (e.g. Dompdf\Adapter\CPDF, Dompdf\Adapter\GD) * * @return Canvas */ public function getCanvas() { return $this->canvas; } /** * @param Stylesheet $css * @return $this */ public function setCss(Stylesheet $css) { $this->css = $css; return $this; } /** * @return Stylesheet * @deprecated */ public function get_css() { return $this->getCss(); } /** * Returns the stylesheet * * @return Stylesheet */ public function getCss() { return $this->css; } /** * @param DOMDocument $dom * @return $this */ public function setDom(DOMDocument $dom) { $this->dom = $dom; return $this; } /** * @return DOMDocument * @deprecated */ public function get_dom() { return $this->getDom(); } /** * @return DOMDocument */ public function getDom() { return $this->dom; } /** * @param Options $options * @return $this */ public function setOptions(Options $options) { // For backwards compatibility if ($this->options && $this->options->getHttpContext() && !$options->getHttpContext()) { $options->setHttpContext($this->options->getHttpContext()); } $this->options = $options; $fontMetrics = $this->fontMetrics; if (isset($fontMetrics)) { $fontMetrics->setOptions($options); } return $this; } /** * @return Options */ public function getOptions() { return $this->options; } /** * @return array * @deprecated */ public function get_callbacks() { return $this->getCallbacks(); } /** * Returns the callbacks array * * @return array */ public function getCallbacks() { return $this->callbacks; } /** * @param array $callbacks the set of callbacks to set * @return $this * @deprecated */ public function set_callbacks($callbacks) { return $this->setCallbacks($callbacks); } /** * Define callbacks that allow modifying the document during render. * * The callbacks array should contain arrays with `event` set to a callback * event name and `f` set to a function or any other callable. * * The available callback events are: * * `begin_page_reflow`: called before page reflow * * `begin_frame`: called before a frame is rendered * * `end_frame`: called after frame rendering is complete * * `begin_page_render`: called before a page is rendered * * `end_page_render`: called after page rendering is complete * * `end_document`: called for every page after rendering is complete * * The function `f` receives three arguments `Frame $frame`, `Canvas $canvas`, * and `FontMetrics $fontMetrics` for all events but `end_document`. For * `end_document`, the function receives four arguments `int $pageNumber`, * `int $pageCount`, `Canvas $canvas`, and `FontMetrics $fontMetrics` instead. * * @param array $callbacks The set of callbacks to set. * @return $this */ public function setCallbacks(array $callbacks): self { $this->callbacks = []; foreach ($callbacks as $c) { if (is_array($c) && isset($c["event"]) && isset($c["f"])) { $event = $c["event"]; $f = $c["f"]; if (is_string($event) && is_callable($f)) { $this->callbacks[$event][] = $f; } } } return $this; } /** * @return boolean * @deprecated */ public function get_quirksmode() { return $this->getQuirksmode(); } /** * Get the quirks mode * * @return boolean true if quirks mode is active */ public function getQuirksmode() { return $this->quirksmode; } /** * @param FontMetrics $fontMetrics * @return $this */ public function setFontMetrics(FontMetrics $fontMetrics) { $this->fontMetrics = $fontMetrics; return $this; } /** * @return FontMetrics */ public function getFontMetrics() { return $this->fontMetrics; } /** * PHP5 overloaded getter * Along with {@link Dompdf::__set()} __get() provides access to all * properties directly. Typically __get() is not called directly outside * of this class. * * @param string $prop * * @throws Exception * @return mixed */ function __get($prop) { switch ($prop) { case 'version': return $this->version; default: throw new Exception('Invalid property: ' . $prop); } } }