Reputation: 87
Help me out here....
I have installed wkhtml2pdf 0.9.9 static for mac os and installed it in the /usr/bin. Wkhtml2pdf works fine from the terminal, with the wkhtmltopdf [source website][generated file to be saved].
Though I am unable to use it in Symfony 2.3.7, with the knpSnappy and knpSnappyBundle installed. I am sure I have entered everything correctly. I have checked it a million times and searched all of the google and yet couldnt find why it would do that (been searching for two days.
I have downloaded knpSnappy and knpSnappyBundle through composer and it is in the vendor and as well as enabled in the config.yml and added to appkernel.php, other than that Following is my configuration:
Composer:
"knplabs/knp-snappy-bundle": "dev-master",
"knplabs/knp-snappy": "*"
Appkernel:
new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
Controller:
public function generateAction($date)
{
$em = $this->getDoctrine()->getManager();
$publishedAds = $em->getRepository('pdfRenderAdBundle:Ads')
->getAllAds();
if (!$publishedAds) {
throw $this->createNotFoundException(
'No ads found for today!'
);
}
$html = $this->renderView('pdfRenderAdBundle:Application:generate.html.twig', array(
'publishedAds' => $publishedAds
));
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html),
400,
array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="file.pdf"'
)
);
}
Whenever I try to access the controller it gives the:
The process has been signaled with signal "5" - 500 Internal Server Error - RuntimeException
I will really appreciate it if any one of you can help out of this well..... Stuck here for a very long time now.
Upvotes: 2
Views: 4353
Reputation: 416
For anyone else that comes across this, here's the post on how to get this working:
http://oneqonea.blogspot.com/2012/04/why-does-wkhtmltopdf-work-via-terminal.html
Here's the short version:
Comment out the following line in /Applications/MAMP/Library/bin/envvars
#export DYLD_LIBRARY_PATH
And then add this line:
export PATH=/parent/path/of/wkhtmltopdf/executable:$PATH
Upvotes: 3
Reputation: 771
I had this problem as well, and if IIRC the solution was to use wkhtmltopdf version 0.9.6.
Upvotes: 1