[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/pattemplate/patTemplate/OutputFilter/ -> PdfLatex.php (source)

   1  <?PHP
   2  /**
   3   * patTemplate output filter that creates PDF files from latex
   4   *
   5   * $Id: PdfLatex.php 10381 2008-06-01 03:35:53Z pasamio $
   6   *
   7   * @package        patTemplate
   8   * @subpackage    Filters
   9   * @author        Stephan Schmidt <schst@php.net>
  10   */
  11  
  12  // Check to ensure this file is within the rest of the framework
  13  defined('JPATH_BASE') or die();
  14  
  15  /**
  16   * patTemplate output filter that creates PDF files from latex
  17   *
  18   * $Id: PdfLatex.php 10381 2008-06-01 03:35:53Z pasamio $
  19   *
  20   * @package        patTemplate
  21   * @subpackage    Filters
  22   * @author        Stephan Schmidt <schst@php.net>
  23   */
  24  class patTemplate_OutputFilter_PdfLatex extends patTemplate_OutputFilter
  25  {
  26      /**
  27      * filter name
  28      *
  29      * This has to be set in the final
  30      * filter classes.
  31      *
  32      * @var    string
  33      */
  34      var    $_name    =    'PdfLatex';
  35  
  36      var $_params = array(
  37                             'cacheFolder' => './'
  38                         );
  39  
  40      /**
  41      * tidy the data
  42      *
  43      * @access    public
  44      * @param    string        data
  45      * @return    string        compressed data
  46      */
  47  	function apply( $data )
  48      {
  49          $cacheFolder = $this->getParam('cacheFolder');
  50          $texFile     = tempnam($cacheFolder, 'pt_tex_');
  51          $fp = fopen($texFile, 'w');
  52          fwrite($fp, $data);
  53          fclose($fp);
  54  
  55          $command = 'pdflatex '.$texFile;
  56          exec($command);
  57          exec($command);
  58  
  59          $pdf = $texFile . '.pdf';
  60          $pdf = file_get_contents($pdf);
  61  
  62          return $pdf;
  63      }
  64  }
  65  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1