Я пытаюсь преобразовать файл DOC в PDF с помощью COM-класса, но его метания ошибкиPHP COM класс не найден
Fatal Error: Class COM not found
Я пытался раскомментирую необходимые расширения во всех файлах php.ini установленный на моем компьютере уже.
[COM_DOT_NET] extension=php_com_dotnet.dll
Я также изменил путь реж к расширениям
On windows: extension_dir ="c:/wamp64/bin/php/php5.6.25/ext/"
Ниже мой код: 1. Я спасенных апачский офис в папке PHP. 2.Using WAMP на win7 3. Я также освежил свой локальный сервер каждый раз я обновить свой файл php.ini
<?php
set_time_limit(0);
function MakePropertyValue($name,$value,$osm){
$oStruct = $osm->Bridge_GetStruct("com.sun.star.beans.PropertyValue");
$oStruct->Name = $name;
$oStruct->Value = $value;
return $oStruct;
}
function word2pdf($doc_url, $output_url){
//Invoke the OpenOffice.org service manager
$osm = new COM("com.sun.star.ServiceManager") or die ("Please be sure that OpenOffice.org is installed.\n");
//Set the application to remain hidden to avoid flashing the document onscreen
$args = array(MakePropertyValue("Hidden",true,$osm));
//Launch the desktop
$oDesktop = $osm->createInstance("com.sun.star.frame.Desktop");
//Load the .doc file, and pass in the "Hidden" property from above
$oWriterDoc = $oDesktop->loadComponentFromURL($doc_url,"_blank", 0, $args);
//Set up the arguments for the PDF output
$export_args = array(MakePropertyValue("FilterName","writer_pdf_Export",$osm));
//print_r($export_args);
//Write out the PDF
$oWriterDoc->storeToURL($output_url,$export_args);
$oWriterDoc->close(true);
}
$output_dir = "C:/wamp/www/";
$doc_file = "C:/wamp/www/reportdoc.docx";
$pdf_file = "reportpdf.pdf";
$output_file = $output_dir . $pdf_file;
$doc_file = "file:///" . $doc_file;
$output_file = "file:///" . $output_file;
word2pdf($doc_file,$output_file);
?>
Я пытался, возможно, каждое решение, но все же без посторонней помощи.