[PHP][XSL] Transformation d'un fichier xml en pdf avec xsl~fo , xslt , php
	
	
		Salut,
Je veux faire une application php qui génère des documents xml.
A partir de ces documents xml, j'utilise xsl pour créer des documents xsl:fo.
A partir de ces documents xsl:fo, j'utilise fop pour générer du pdf .
Comment installer  l'apache Fop avec EasyPhp?
Pouvez vous m'aider par un exemple 
Je vous remercie beaucoup,
	 
	
	
	
		Je transforme le code php à version 4.3
	
	
		Merci valal
Je transforme le code php à version 4.3
voilâ le code php
	Citation:
	
		
		
			<?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;
?>
			
		
	
 et je ne modifie pas le code java
code java
	Citation:
	
		
		
			import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Options;
import java.io.File;
import java.io.FileOutputStream;
import java.io.StringReader;
import org.xml.sax.InputSource;
public class FOPWrapper {
    private static FOPWrapper _wrapper = null;
    private Driver _driver = null;
    private Options _options = null;
    private FOPWrapper(String config_file) throws Exception {
        this._options = new Options(new File(config_file));
        this._driver = new Driver();
        this._driver.setRenderer(Driver.RENDER_PDF);
        System.out.println("FOP Initialized...");
    }
    public static FOPWrapper getInstance(String config_file) throws Exception {
        if(FOPWrapper._wrapper == null) FOPWrapper._wrapper = new FOPWrapper(config_file);
        return FOPWrapper._wrapper;
    }
    public void run(String xml_input, String output_file) throws Exception {
        this._driver.setInputSource(new InputSource(new StringReader(xml_input)));
        this._driver.setOutputStream(new FileOutputStream(output_file));
        this._driver.run();
    }
}
			
		
	
 
Mais ce code affiche  le résultat suivant :
	Citation:
	
		
		
			C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\FOPBF.tmp
			
		
	
 j'ouvrire le fichier FOPBF.tmp et je trouve le message suivant 
	Citation:
	
		
		
			%PDF-1.3
%ª«¬*
4 0 obj
<< /Type /Info
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
<< /Length 86 /Filter /FlateDecode 
 >>
stream
xœs
áÒw3T04Ò3PIã2 QÉ\
é\†
@h¨`j*g¢`nl¨gna¢’«*ᑚ““¯©*kdnT®ž_”“¢©«âÅåÂ Ãø
endstream
endobj
6 0 obj
<< /Type /Page
/Parent 1 0 R
/MediaBox [ 0 0 612 792 ]
/Resources 3 0 R
/Contents 5 0 R
>>
endobj
7 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding >>
endobj
1 0 obj
<< /Type /Pages
/Count 1
/Kids [6 0 R ] >>
endobj
2 0 obj
<< /Type /Catalog
/Pages 1 0 R
 >>
endobj
3 0 obj
<< 
/Font << /F1 7 0 R >> 
/ProcSet [ /PDF /ImageC /Text ] >> 
endobj
xref
0 8
0000000000 65535 f 
0000000442 00000 n 
0000000500 00000 n 
0000000550 00000 n 
0000000015 00000 n 
0000000071 00000 n 
0000000229 00000 n 
0000000335 00000 n 
trailer
<<
/Size 8
/Root 2 0 R
/Info 4 0 R
>>
startxref
628
%%EOF
			
		
	
 Ma question: Comment modifier ce code pour trouver une bonne resultat? 
Merci.....