This article describes the Linux PHP program to achieve the conversion of Word files to PDF files. Share to everyone for your reference, specific as follows:
<?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; The function word2pdf ($doc _url, $output _url) {$osm = new COM ("Com.sun.star.ServiceManager") or Die ("Please be sure that Ope
Noffice.org is installed.\n ");
$args = Array (Makepropertyvalue ("Hidden", True, $OSM)); $oDesktop = $osm->createinstance ("Com.sun.star. Frame.
Desktop ");
$oWriterDoc = $oDesktop->loadcomponentfromurl ($doc _url, "_blank", 0, $args);
$export _args = Array (Makepropertyvalue ("FilterName", "Writer_pdf_export", $OSM));
$oWriterDoc->storetourl ($output _url, $export _args);
$oWriterDoc->close (TRUE);
} $output _dir = "d:/lighttpd/htdocs/";
$doc _file = "D:/lighttpd/htdocs/2.doc";
$pdf _file = "2.pdf"; $output _file = $output _dir.
$pdf _file; $doc _file = "file:///".
$doc _file; $output _file = "file:///".
$output _file;
Word2pdf ($doc _file, $output _file);?>
PS: If you feel that the code layout is not beautiful, small series here recommend a site of the PHP format landscaping layout tools:
PHP Code online Format Landscaping tool:Http://tools.jb51.net/code/phpformat
For more information on PHP-related content readers can view the site topics: "PHP operation Office Document tips summary (including word,excel,access,ppt)", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course", "PHP string (string) Summary of usage, Getting Started tutorial on Php+mysql database operations, and summary of common PHP database operations techniques
I hope this article will help you with the PHP program design.