}
if (isset($options['image-scale'])) {
$this->_image_scale = $options['image-scale'];
}
//set mime type
$this->_mime = 'application/pdf';
//set document type
$this->_type = 'pdf';
/*
* Create the pdf document
*/
// Default settings are a portrait layout with an A4 configuration using millimeters as units
if(!class_exists('TCPDF')) require(JPATH_ROOT.DS.'libraries'.DS.'tcpdf'.DS.'tcpdf.php');
$this->_engine = new TCPDF();
//set margins
$this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right);
//set auto page breaks
$this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom);
$this->_engine->SetHeaderMargin($this->_margin_header);
$this->_engine->SetFooterMargin($this->_margin_footer);
$this->_engine->setImageScale($this->_image_scale);
}
/**
* Sets the document name
*
* @param string $name Document name
* @access public
* @return void
*/
function setName($name = 'joomla') {
$this->_name = $name;
* Special case to deal with Fatal errors and the like.
*/
public function handleShutdown()
{
// If we reached this step, we are in shutdown handler.
// An exception thrown in a shutdown handler will not be propagated
// to the exception handler. Pass that information along.
$this->canThrowExceptions = false;
$error = $this->system->getLastError();
if ($error && Misc::isLevelFatal($error['type'])) {
// If there was a fatal error,
// it was not handled in handleError yet.
$this->allowQuit = false;
$this->handleError(
$error['type'],
$error['message'],
$error['file'],
$error['line']
);
}
}
/**
* In certain scenarios, like in shutdown handler, we can not throw exceptions
* @var bool
*/
private $canThrowExceptions = true;
/**
* Echo something to the browser
* @param string $output
* @return $this
*/
private function writeToOutputNow($output)
{
if ($this->sendHttpCode() && \Whoops\Util\Misc::canSendHeaders()) {
$this->system->setHttpResponseCode(
$this->sendHttpCode()
);
}
// Propagate error to the next handler.
if ($this->platformExceptionHandler) {
call_user_func_array($this->platformExceptionHandler, [&$exception]);
}
}
/**
* Special case to deal with Fatal errors and the like.
*/
public function handleShutdown()
{
$handler = $this->whoopsShutdownHandler;
$error = $this->getLastError();
// Ignore core warnings and errors.
if ($error && !($error['type'] & (E_CORE_WARNING | E_CORE_ERROR))) {
$handler();
}
}
}