how to convert doc, ppt, img to pdf using codignator or simple php
Share
how to convert doc, ppt, img to pdf using codignator or simple php
The first thing you can learn HTML, whether you want to become a professional web developer or just want to learn more about how websites work. The basic language for developing web pages and web applications is HTML. A server ...
Asynchronous Javascript One of AJAX’s benefits is it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. However, using AJAX does not guarantee the user will not wait for the asynchronous JavaScript and ...
How To Make Cookie Free Domain An HTTP cookie (also known as a web cookie, Internet cookie, browser cookie, or simply cookie) is a small piece of data sent from a website and stored on the user’s computer by the ...
1) Ask your hosting provider ro enable the http://www.openoffice.org. http://www.openoffice.org/download/common/instructions.html
2) I have installed Open Office (from apache http://www.openoffice.org/download/) on my localhost
3) $output_dir = ”C:/xampp/htdocs/phpSupport/questions/doctopdf/”; this is my project folder where i want to create output file.
4) I have already placed my input file here ”C:/xampp/htdocs/phpSupport/questions/doctopdf/wordfile.docx”;
<?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){
$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));
//Write out the PDF
$oWriterDoc->storeToURL($output_url,$export_args);
$oWriterDoc->close(true);
}
$output_dir = ”C:/xampp/htdocs/phpSupport/questions/doctopdf/”;
$doc_file = ”C:/xampp/htdocs/phpSupport/questions/doctopdf/SERVICES OFFERED.docx”;
$pdf_file = ”SERVICES OFFERED.pdf”;
$output_file = $output_dir . $pdf_file;
$doc_file = ”file:///” . $doc_file;
$output_file = ”file:///” . $output_file;
word2pdf($doc_file,$output_file);
?>