Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/OutputFilter/PdfLatex.php

Documentation is available at PdfLatex.php

  1. <?PHP
  2. /**
  3.  * patTemplate output filter that creates PDF files from latex
  4.  *
  5.  * $Id: PdfLatex.php 47 2005-09-15 02:55:27Z rhuk $
  6.  *
  7.  * @package        patTemplate
  8.  * @subpackage    Filters
  9.  * @author        Stephan Schmidt <[email protected]>
  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 47 2005-09-15 02:55:27Z rhuk $
  19.  *
  20.  * @package        patTemplate
  21.  * @subpackage    Filters
  22.  * @author        Stephan Schmidt <[email protected]>
  23.  */
  24. {
  25.    /**
  26.     * filter name
  27.     *
  28.     * This has to be set in the final
  29.     * filter classes.
  30.     *
  31.     * @var    string 
  32.     */
  33.     var    $_name    =    'PdfLatex';
  34.  
  35.     var $_params = array(
  36.                            'cacheFolder' => './'
  37.                        );
  38.  
  39.    /**
  40.     * tidy the data
  41.     *
  42.     * @access    public
  43.     * @param    string        data
  44.     * @return    string        compressed data
  45.     */
  46.     function apply$data )
  47.     {
  48.         $cacheFolder $this->getParam('cacheFolder');
  49.         $texFile     tempnam($cacheFolder'pt_tex_');
  50.         $fp fopen($texFile'w');
  51.         fwrite($fp$data);
  52.         fclose($fp);
  53.  
  54.         $command 'pdflatex '.$texFile;
  55.         exec($command);
  56.         exec($command);
  57.  
  58.         $pdf $texFile '.pdf';
  59.         $pdf file_get_contents($pdf);
  60.  
  61.         return $pdf;
  62.     }
  63. }
  64. ?>

Documentation generated on Mon, 05 Mar 2007 21:16:35 +0000 by phpDocumentor 1.3.1