Results 1 to 3 of 3

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

  1. #1
    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

  2. #2
    Join Date
    Jan 2008
    Posts
    3,755

    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

  3. #3
    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

Similar Threads

  1. xcopy command line together with wmplayer command line
    By Aislinn in forum Operating Systems
    Replies: 5
    Last Post: 31-03-2010, 12:13 PM
  2. Replies: 3
    Last Post: 03-09-2009, 05:41 PM
  3. Convert works documents to word documents
    By Arzaan in forum Tips & Tweaks
    Replies: 3
    Last Post: 04-03-2009, 06:46 PM
  4. Command line tool to convert VC project files to Makefile
    By Harman in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 05:19 PM
  5. Replies: 1
    Last Post: 18-05-2007, 01:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,486,685.33633 seconds with 17 queries