Exemplo n.º 1
0
 public function register(Container $app)
 {
     $app['prince.path'] = null;
     // the common installation dirs for PrinceXML in several OS
     $app['prince.default_paths'] = array('/usr/local/bin/prince', '/usr/bin/prince', 'C:\\Program Files\\Prince\\engine\\bin\\prince.exe');
     $app['prince'] = function () use($app) {
         $princePath = $app['prince.path'] ?: $app->findPrinceXmlExecutable();
         // ask the user about the location of the executable
         if (null === $princePath) {
             $princePath = $app->askForPrinceXMLExecutablePath();
             if (!file_exists($princePath)) {
                 throw new \RuntimeException(sprintf("We couldn't find the PrinceXML executable in the given directory (%s)", $princePath));
             }
         }
         $prince = new Prince($princePath);
         $prince->setHtml(true);
         return $prince;
     };
 }