33 $this->domPdf->load_html($html);
35 $this->domPdf->render();
36 $data = $this->domPdf->output();
37 return $filename ? file_put_contents($filename,$data) : $data;
44 \Rsi\File::unlink($target = $filename ?: \
Rsi\File::tempFile(
'pdf'));
45 shell_exec(strtr($this->webKitHtmlToPdfPath,[
46 '[options]' =>
'--' . \
Rsi\Record::implode(array_merge([
'page-size' =>
$paper,
'orientation' =>
$orientation],$options ?: []),
' --',
' '),
47 '[source]' => $source = \
Rsi\File::tempFile(
'pdf',$html),
50 if(!is_file($target))
return false;
51 if($filename)
return filesize($filename);
52 $data = file_get_contents($target);
66 return call_user_func([$this,
'create' . ucfirst($this->defaultBackEnd)],$html,$filename,
$paper,
$orientation,$options);
70 if($this->_backEnds === null){
71 $this->_backEnds = [];
72 foreach(get_class_methods($this) as $method)
if((strlen($method) > 6) && (substr($method,0,6) ==
'create'))
73 $this->_backEnds[] = lcfirst(substr($method,6));
79 if(!$this->_domPdf) $this->_domPdf = new \Dompdf\Dompdf();
create($html, $filename=null, $paper=null, $orientation=null, $options=null)
Create a PDF file using the default back-end.
createWebKit($html, $filename=null, $paper=null, $orientation=null, $options=null)
Create a PDF file using WebKit.
createDomPdf($html, $filename=null, $paper=null, $orientation=null, $options=null)
Create a PDF file using DomPdf.
$paper
Default paper size.
const ORIENTATION_LANDSCAPE
$webKitHtmlToPdfPath
wkHTMLtoPDF command-line, with placeholders voor [options] [source] en [target].
$orientation
Default paper orientation.
const ORIENTATION_PORTRAIT