0

I am having an issue where the Wkhtml pdf rendering engine is choking when it encounters View Helpers. It winds up throwing an internal server error and doesn't let you know that that is the code causing the problem this simple snippet of code in a .ctp file is enough for this error to occur

echo $this->Html->link( .... );

The only View Helper function that seems to work actually is this one:

echo $this->Html->css( ... );

The Helpers being used in the view are defined in the $helpers array of the controller containing the action. The view file is in the pdf folder of that controller. Is there special setup that is required within Cakepdf to use helpers in your files? Is there special setup for Wkhtml for this? Any help or direction that I could be pointed in is greatly appreciated. The code I am working with while cake is proprietary so I can't really post it exactly as is but if you need more information I can provide examples.

GatorGuy023
  • 297
  • 2
  • 3
  • 11
  • What does that code render? That's where I would start. wkhtmltopdf doesn't run inside PHP, it's an external c++ program and it only sees the HTML and knows nothing about the existance of PHP. That's why you should be able to replicate this with the pure HTML produced by the echo and cake. If not, the issue might be with the integration code. The error reporting for wkhtmltopdf is not the greatest... :p – Joel Peltonen Oct 21 '14 at 05:27
  • That is how this is working. Essentially the CakePdf plugin uses the features of cakephp to render the html that is then passed to wkhtmltopdf. One of the features of cakephp is that within your views which is where the html is generated you can use helper classes called Helpers. These classes just produce small snippets of Html like the link function up above returns an anchor tag. If an error occurs in the rendering process within cake which is where I am guessing the problem really is I don't have the foggiest how to find out. This could a be a problem with cake or CakePdf or both. – GatorGuy023 Oct 21 '14 at 12:19

0 Answers0