title: symfony 2.5 use ClassLoader to add Zend_pdf
body: <p>I'm working in Symfony 2.5 and want to use the zend framework for pdf (zend_pdf)</p>
  
  <p>I tried the classloader but I probably do something wrong because it doesn't work (of course)...</p>
  
  <p>I don't know where to add my classloader... I thought in autoload.php but I would not know how... this is my autoload.php, the standard one:</p>
  
  <pre><code>&lt;?php
   use Doctrine\Common\Annotations\AnnotationRegistry;
   use Composer\Autoload\ClassLoader; 
  /**
  * @var ClassLoader $loader
  */
  $loader = require __DIR__.'/../vendor/autoload.php';
  
  AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  
  return $loader;
  </code></pre>
  
  <p>I tried adding it in my controller like this:</p>
  
  <pre><code> use Symfony\Component\ClassLoader\ClassLoader;
  
  /**
   * @Template()
   */
  public function pdfAction()
  {
      $loader = new ClassLoader();
      $loader-&gt;addPrefix('Zend', __DIR__.'/vendor/zf/library');
      $loader-&gt;register();
  
      $pdf = new \Zend\Pdf\Zend_Pdf();
      ....
  </code></pre>
  
  <p>But then he says: </p>
  
  <blockquote>
    <p>Attempted to load class "Zend_Pdf" from namespace "Zend\Pdf".
    Did you forget a "use" statement for another namespace?</p>
  </blockquote>
  
  <p>How do I solve this?
  thanks.</p>