1

I have a *.ctp template with some HTML that's aimed to be converted into PDF with the CakePDF plugin. In the development phase I have set CakePHP debug level to 2 and that causes all DebugKig stuff to show up in the rendered view:

<link rel="stylesheet" type="text/css" href="/debug_kit/css/debug_toolbar.css" />
<script type="text/javascript">
//<![CDATA[
window.DEBUGKIT_JQUERY_URL = "/debug_kit/js/jquery.js";
//]]>
</script><script type="text/javascript" src="/debug_kit/js/js_debug_toolbar.js"></script>
<div id="debug-kit-toolbar">[...]</div>

I don't need it and most PDF engines go berserk with it. Is there a way to get rid of it, either in this specific view or in all PDF templates?

Álvaro González
  • 142,137
  • 41
  • 261
  • 360

2 Answers2

1

I eventually figured out a per-case solution. You can disable the component at the end of the action method inside the controller (anywhere before $this->render() gets called):

$this->Components->unload('DebugKit.Toolbar');
Álvaro González
  • 142,137
  • 41
  • 261
  • 360
1

You can also try to debug mode off for a particular pdf controller like this

 public function beforeFilter() { 
    parent::beforeFilter();
    Configure::write('debug', 0);
 }

You can also unload dubug component for particular controller or action try this

public function beforeFilter() {
    parent::beforeFilter();
    if(in_array($this->action, array('index'))) {
        $this->Components->unload('DebugKit.Toolbar');
    }
}

This will unload debug component in index function for particular controller

Akshay Sharma
  • 1,042
  • 1
  • 8
  • 21