Go Back   TechArena Community > Software > Windows Software
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links



Can't convert documents in Php script (via command line)

Windows Software


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-01-2010
Member
 
Join Date: Jan 2010
Posts: 2
Can't convert documents in Php script (via command line)

Hello Guys,

I have a quick question. I am using DocumentConverter.py with OpenOffice 3 in a windows environment. When i used command prompt to convert documents everything works perfectly, with no problem. However, when I attempt to convert from PHP on a webserver via command line, using exec() - see below, everything goes through but no conversion occurs. So, for example, the soffice.exe is started (soffice.bin & soffice.exe) with NO problem. However, in the second line, no document conversion happens. I am hoping that this is something simple. I have tried everything but to no avail. I have tried all sorts of variations but with no success. I am on Windows XP.

//Convert source to PDF...
//Start Service
exec('"c:\\Program Files\\OpenOffice.org 3\\program\\soffice.exe" -headless -nologo -norestore -accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager'); ----->THIS WORKS FINE

//Convert File
exec('"c:\\Program Files\\OpenOffice.org 3\\program\\python" c:/wamp/www/DocumentConverter.py xr2.doc xr2.pdf'); -------->THIS DOES NOT WORK: GIVES NO ERRORS BUT NO CONVERSION OCCURS

Thanks
Reply With Quote
  #2  
Old 20-01-2010
Sam.D's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,735
Re: Can't convert documents in Php script (via command line)

I think you need to generate PDF files through php script, I will suggest you to a basic macro Java code for this. Just install a PDF printer such as PDFCreator for Windows and use -pt command with the the first argument as the printer name and the second argument as the source document. For example :

Code:
"C:\Program Files\OpenOffice.org2.4\program\soffice" -norestore -nofirststartwizard -nologo -headless -pt PDFCreator sample.ppt
Reply With Quote
  #3  
Old 20-01-2010
Member
 
Join Date: Jan 2010
Posts: 2
Re: Can't convert documents in Php script (via command line)

Hello Sam.D,
First and foremost, thankyou for the prompt response. Unfortunately, I tried your suggestion but nothing happened. The soffice.exe and soffice.bin started, as they should have, but no PDF was produced and no error was given.

I typed the following:
"C:\Program Files\OpenOffice.org 3\program\soffice" -norestore -nofirststartwizard -nologo -headless -pt PDFCreator xr.doc

Note: I located xr.doc is the program directory of OpenOffice. I also tried putting a copy in the PDFCreator base directory etc. But no results. Note that, as you can see, I am using the professional version of OpenOffice 3 (3.1 to be exact). I also installed PDFCreator in standard mode and in server mode but neither produced results.

One more quick question. If I use this on my server in my network, and say two people attempt to convert documents at the same time, will this cause soffice to crash? I really appreciate any feed back.

Thanks,
Ethan-Anthony
Reply With Quote
Reply

  TechArena Community > Software > Windows Software


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Can't convert documents in Php script (via command line)"
Thread Thread Starter Forum Replies Last Post
xcopy command line together with wmplayer command line Aislinn Operating Systems 5 31-03-2010 01:13 PM
PROBLEM: COMMAND LINE OPTION SYNTAX ERROR. TYPE COMMAND /? FOR HEL FORTHELOVEOFGODPLEASEHELPME MediaCenter 3 03-09-2009 06:41 PM
Convert works documents to word documents Arzaan Tips & Tweaks 3 04-03-2009 06:46 PM
Command line tool to convert VC project files to Makefile Harman Software Development 3 25-10-2008 06:19 PM
autorun.inf - shell\..\command with command line parameter doesn'twork kakii Windows XP Support 1 18-05-2007 02:24 AM


All times are GMT +5.5. The time now is 01:56 AM.