Hello Friends
i am developing the web site in which i need teh appilication from word to PDF
i will upload teh word doc and out put should be PDF .
Please send me any reference link or any guidlines how d i move ahead and do teh coding for it ...
Kindly revert back with you views
Regards
Raghu
convert word doc to PDF Dynimic in PHP
Moderator: General Moderators
Re: convert word doc to PDF Dynimic in PHP
Thanks for teh reply ...
its working fine when i convert from HTML to PDF , but i need to convert from word to PDF in PHP
i.e user will uplaod teh word files and we need to convert that to PDF and save that into teh DB ..
please let me know you have any sol for that ...
Reagrds
Raghu
its working fine when i convert from HTML to PDF , but i need to convert from word to PDF in PHP
i.e user will uplaod teh word files and we need to convert that to PDF and save that into teh DB ..
please let me know you have any sol for that ...
Reagrds
Raghu
Re: convert word doc to PDF Dynimic in PHP
Any update on this topic? I also need to do the same thing.
When user upload doc files to my php website, system need to convert to pdf automatically and store in server folder.
Please help!!!
When user upload doc files to my php website, system need to convert to pdf automatically and store in server folder.
Please help!!!
Re: convert word doc to PDF Dynimic in PHP
Hello All
I am using teh below code ...
and my server is dedicated linux server and installed open office ..
please run this link you can see teh error link : http://70.38.11.233/~feelgd/rd/wordtopdf.php
Please help
Thanks
Raghu
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?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("/usr/bin/openoffice.org/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 = "/home/feelgda/rd";
$doc_file = "/home/feelgda/rd/ben_email.doc";
$pdf_file = "DpmR5Reqv1.20.pdf";
$output_file = $output_dir . $pdf_file;
$doc_file = "file:///" . $doc_file;
$output_file = "file:///" . $output_file;
word2pdf($doc_file,$output_file);
?>
I am using teh below code ...
and my server is dedicated linux server and installed open office ..
please run this link you can see teh error link : http://70.38.11.233/~feelgd/rd/wordtopdf.php
Please help
Thanks
Raghu
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?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("/usr/bin/openoffice.org/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 = "/home/feelgda/rd";
$doc_file = "/home/feelgda/rd/ben_email.doc";
$pdf_file = "DpmR5Reqv1.20.pdf";
$output_file = $output_dir . $pdf_file;
$doc_file = "file:///" . $doc_file;
$output_file = "file:///" . $output_file;
word2pdf($doc_file,$output_file);
?>
-
leo.bonnafe
- Forum Newbie
- Posts: 2
- Joined: Thu Feb 05, 2009 1:01 am
Re: convert word doc to PDF Dynimic in PHP
Another approach would be with phpLiveDocx. Using these PHP5 components, you simply generate a template file in a word processor. In the template, you can specify any number of merge fields. In PHP you then assign data to these merge fields. The resulting document can be saved as a PDF (as you wish) or in any other supported format - currently: DOCX, DOC and RTF.
Here is a brief introduction:
http://www.phplivedocx.org/articles/bri ... plivedocx/
Regards
Leo
Here is a brief introduction:
http://www.phplivedocx.org/articles/bri ... plivedocx/
Regards
Leo