php用openoffice转换csv为pdf乱码,请问怎么解决?
打开openoffice选好编码,能完成转换,没有乱码,但是用php就是乱码了,初步确定是没设置编码,请问在php中如何设置编码,php代码如下....
php codebridge_getstruct(com.sun.star.beans.propertyvalue); $ostruct->name = $name; $ostruct->value = $value; return $ostruct;}function word2pdf($doc_url, $output_url){ $fdoc_url = file:/// . $doc_url; $foutput_url = file:/// . $output_url; $osm = new com(com.sun.star.servicemanager) or die (please be sure that openoffice.org is installed.n); $args = array(makepropertyvalue(hidden,true,$osm)); $odesktop = $osm->createinstance(com.sun.star.frame.desktop); $owriterdoc = $odesktop->loadcomponentfromurl($fdoc_url,_blank, 0, $args); $export_args = array(makepropertyvalue(filtername,writer_pdf_export,$osm)); $owriterdoc->storetourl($foutput_url,$export_args); $owriterdoc->close(true);}$output_dir = f:/comsenzexp/wwwroot/;$doc_file = f:/comsenzexp/wwwroot/11.csv;$pdf_file = 513.pdf;$output_file = $output_dir . $pdf_file;if(!file_exists($output_file)){word2pdf($doc_file,$output_file);}?>
------解决方案--------------------
你不是 com 吗?那你看看 com.sun.star.servicemanager 是否提供了设置编码的方法就是了