<?php
   function FOP(&$xml, &$xsl)
    {
	    $this->xml = &$xml;
        $this->xsl = &$xsl;
	
        $fopcfg = dirname(__file__).'/fop_config.xml';
        $tmppdf = tempnam('/tmp', 'FOP');
        if(!extension_loaded('java')) {
            $tmpxml = tempnam('/tmp', 'FOP');
            $tmpxsl = tempnam('/tmp', 'FOP');
            file_put_contents($tmpxml, $this->xml);
            file_put_contents($tmpxsl, $this->xsl);
  
            exec("fop -c {$fopcfg} -xml {$tmpxml} -xsl {$tmpxsl} -pdf {$tmppdf} 2>&1");
            @unlink($tmpxml);
            @unlink($tmpxsl);
        } else {
$xh = xslt_create();           
$file=fopen("C:\Program Files\EasyPHP1-8\www\logement\fop-0.20.5\build\fop\CinemaFO.xml","r");
$xml=fread($file,50000);
fclose($file);
$file=fopen("C:\Program Files\EasyPHP1-8\www\logement\fop-0.20.5\build\fop\CinemaFO.xsl","r");
$xsl=fread($file,50000);
fclose($file);
$arguments = array(
  '/_xml' => $xml,
  '/_xsl' => $xsl
  );
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
            
                $j_fwc = new Java("FOPWrapper");
                $j_fw = $j_fwc->getInstance($fopcfg);
                $j_fw->run($result , $tmppdf);
          
        }
        return($tmppdf);
}
?>
<?php
$xml = file_get_contents("C:\Program Files\EasyPHP1-8\www\logement\fop-0.20.5\build\fop\logement.xml");
$xsl = file_get_contents("C:\Program Files\EasyPHP1-8\www\logement\fop-0.20.5\build\fop\pdf.xsl");
$pdf_filename =FOP($xml, $xsl);
echo $pdf_filename;
?>
			
		
 
	
Partager