Here's my code that is copied from another working codebase.
What I get is an empty 0 byte PDF and a boolean false for $result.
Any ideas of what's going wrong here? Thanks!
$reportFileName = 'Test - ' . date('His') . '.pdf';
$prince = new Prince($this->config->prince->path);
$prince->setHTML(true);
$pdfPath = "/tmp/". $reportFileName;
$this->view->pdfContent = $content;
$pdfView = $this->view->render('reports/PDFwrapper.phtml'); // intercept the view and capture it as a string
//*********** Just a real simple html string for testing. The stuff above results in the same conclusion **/
$pdfView = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
This is Test
</body>
</html>';
//send the html string to prince
header('Content-Type: application/pdf');
if($inline){
header('Content-Disposition: inline; filename="'. $reportFileName .'"'); // show in browser
}else{
header('Content-Disposition: attachment; filename="'. $reportFileName .'"');
}
header('Pragma: private');
$result = $prince->convert_string_to_passthru($pdfView, $pdfPath);
What I get is an empty 0 byte PDF and a boolean false for $result.
Any ideas of what's going wrong here? Thanks!