public function __construct()
{
if (Yii::app()->params['wkhtmltopdf_path']) {
if (!file_exists(Yii::app()->params['wkhtmltopdf_path'])) {
if (!($this->wkhtmltopdf = trim(`which wkhtmltopdf`))) {
throw new Exception('wkhtmltopdf not found in the current path.');
}
} else {
$this->wkhtmltopdf = Yii::app()->params['wkhtmltopdf_path'];
}
}
$banner = $this->execute($this->wkhtmltopdf . ' 2>&1');
if (preg_match('/reduced functionality/i', $banner)) {
throw new Exception('wkhtmltopdf has not been compiled with patched QT and so cannot be used.');
}
$this->left = Yii::app()->params['wkhtmltopdf_footer_left'];
$this->middle = Yii::app()->params['wkhtmltopdf_footer_middle'];
$this->right = Yii::app()->params['wkhtmltopdf_footer_right'];
$this->top_margin = Yii::app()->params['wkhtmltopdf_top_margin'];
$this->bottom_margin = Yii::app()->params['wkhtmltopdf_bottom_margin'];
$this->left_margin = Yii::app()->params['wkhtmltopdf_left_margin'];
$this->right_margin = Yii::app()->params['wkhtmltopdf_right_margin'];
}