File_Convert_AbiToDocx/AbiToDocx.php
[pear-examples] / File_Convert_AbiToDocx / AbiToDocx.php
1 <?php
2 ini_set('include_path', __DIR__  . '/../pear:.');
3 require_once 'File/Convert/AbiToDocx.php';
4
5 //Example AbiWord file
6 $abiFileName = '/tmp/thumb3.abw';
7 $fn = '/tmp/thumb-3.docx';
8 $conv = new File_Convert_AbiToDocx($abiFileName);
9 $conv->save($fn);
10 //$xml = new XMLReader();
11
12 // Download the file for testing
13  
14 if (file_exists($fn)) {
15     echo 'Prepare for download!!';
16     header('Content-Description: File Transfer');
17     header('Content-Type: application/octet-stream');
18     header('Content-Disposition: attachment; filename='.basename($fn));
19     header('Content-Transfer-Encoding: binary');
20     header('Expires: 0');
21     header('Cache-Control: must-revalidate');
22     header('Pragma: public');
23     header('Content-Length: ' . filesize($fn));
24     ob_clean();
25     flush();
26     readfile($fn);
27     exit;
28 }
29
30
31 ?>