generate();
return $stream;
}
public static function from_template($source, $data, $return, $isHtml=true){
$htmlRaw = HtmlExport::from_template($source, $data, $return, $isHtml);
$stream = $return=='stream' ? $htmlRaw : file_get_contents($htmlRaw);
$pdf = new Pdf($stream);
$pdfStream = $pdf->generate();
$destination = File::dir().'tmp'.SLASH.'template.'.time().'-'.rand(0,100).'.pdf';
file_put_contents($destination, $pdfStream);
if($return!='stream') {
unlink($htmlRaw);
return $destination;
}
$stream = file_get_contents($destination);
unlink($destination);
return $stream;
}
}
?>