| View previous topic :: View next topic |
| Author |
Message |
elehenaff Power User

Joined: 16 Apr 2004 Posts: 76 Location: paris - france
|
Posted: Tue Aug 24, 2004 4:45 am Post subject: using openoffice headless ( macro, shell, php ) |
|
|
here is a very simple script to run openoffice headless.
it works on a debian sarge, you have to do this before :
# apt-get update && apt-get install xvfb
here is the code :
| Code: |
#!/bin/bash
echo -----------DEBUT
date
export PATH=$PATH:/usr/bin/X11
export LANG=fr_FR
export HOME=/var/www
xvfb-run -a /usr/bin/openoffice -invisible "macro:///Library.module1.go($1)"
date
|
it runs a macro with openoffice as the www-data user.
u have to prepare macro before.
see that u can pass a parameter to the macro via the shell script.
i call the shell script from a php script that looks like this :
| Code: |
// appeler ooo
$cmd=("/path/to/script.sh argument > /dev/null 2>&1");
exec($cmd);
|
echo and date are usefull for degugging the shell script before calling it from php.
i use those scripts in a web application. ooo is in charge of generating pdf files.
regards |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
elehenaff Power User

Joined: 16 Apr 2004 Posts: 76 Location: paris - france
|
Posted: Wed Aug 25, 2004 2:15 am Post subject: |
|
|
xvfb means X virtual frame buffer.
http://packages.debian.org/testing/x11/xvfb
| Quote: |
Package: xvfb (4.3.0.dfsg.1-4)
virtual framebuffer X server
xvfb provides an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory. The primary use of this server was intended to be server testing, but other novel uses for it have been found, including testing clients against unusual depths and screen configurations, doing batch processing with Xvfb as a background rendering engine, load testing, as an aid to porting the X server to a new platform, and providing an unobtrusive way to run applications that don't really need an X server but insist on having one anyway.
This package also contains a convenience script called xvfb-run which simplifies the automated execution of X clients in a virtual server environment. This convenience script requires the use of the xauth program from xbase-clients, hence the suggestion of xbase-clients.
|
ooo cant run without an x server. what i wanted was to use ooo as a pdf generating server. no user interface is needed. |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
jbotte Power User

Joined: 27 Jan 2004 Posts: 57 Location: NC, USA
|
Posted: Wed Oct 06, 2004 10:55 am Post subject: More "headless" references... |
|
|
If you want to run "headless" you can also check out:
Linux: Automated OOo User Installation
which describes a complete framework for doing "headless" installation (including running the Xvfb at startup and dynamically for a specific operation), and:
Comprehensive MailMerge for Flat Files
which is a macro package that is intended for "headless" operation on a remote server (or local workstation, invoked programatically rather than interactively). I will also be posting, relatively soon, a system for managing console I/O from a Basic macro as well as stateful operation and error reporting even when multiple OOo sessions are open by the same user on the same workstation (I'll update this post with a link to it when it's done). |
|
| Back to top |
|
 |
hol.sten Super User


Joined: 14 Nov 2004 Posts: 3533 Location: Hamburg, Germany
|
Posted: Sat Dec 18, 2004 10:07 am Post subject: Re: using openoffice headless ( macro, shell, php ) |
|
|
| elehenaff wrote: | | here is a very simple script to run openoffice headless. |
Regarding at least OOo 1.1.2 and 1.1.3, OOo still shows a dialog in headless mode, if it stumbles over an internal error: The crash report. And that's bad, because it's a little difficult to klick a dialog box inside Xvfb
Studying the OOo source code, I found a solution: The crash report determines BEFORE he shows the dialog, to which server he has to send the crash report. And if he can't find one, he doesn't display the annoying dialog. All you have to do is open "bootstrap.ini" (on Windows) or "bootstraprc" (on Solaris/Linux) and delete the ErrorReportServer.
At the end of "bootstrap*" you find this lines:
| Code: | [ErrorReport]
ErrorReportPort=80
ErrorReportServer=report.services.openoffice.org |
Simply change them to
| Code: | [ErrorReport]
ErrorReportPort=80
ErrorReportServer= |
and no crash report will bother you any longer. You find the "bootstrap*" files in the "program" folder of your OpenOffice.org installation folder.
I definitly don't understand why the crash report isn't disabled with "-headless". But the above worked for me.
With kind regards
hol.sten |
|
| Back to top |
|
 |
unsavory General User

Joined: 26 Mar 2006 Posts: 7
|
Posted: Sun Mar 26, 2006 10:41 am Post subject: |
|
|
This may be a little OT, but does anyone know how I can get xvfb-run? We're running CentOs 4.3 and apparently the Xvfb that is packed with it does not include xvfb-run.
Thanks! |
|
| Back to top |
|
 |
hol.sten Super User


Joined: 14 Nov 2004 Posts: 3533 Location: Hamburg, Germany
|
Posted: Sun Mar 26, 2006 11:02 am Post subject: |
|
|
| unsavory wrote: | | This may be a little OT, but does anyone know how I can get xvfb-run? We're running CentOs 4.3 and apparently the Xvfb that is packed with it does not include xvfb-run. |
You have a package named "Xvfb" available? Look for a tool called "Xvfb". That may suffice. I wrote in this thread http://www.oooforum.org/forum/viewtopic.phtml?t=33890&highlight=xvfb (take a closer look at the forth post) how you can start OOo from a script with xvfb on a *nix system.
With kind regards
hol.sten |
|
| Back to top |
|
 |
bikram General User

Joined: 23 Aug 2006 Posts: 7
|
Posted: Wed Aug 23, 2006 10:08 pm Post subject: simple solution. PDF and Conversion needs SWX ODT DOC XLS |
|
|
I have sucessfully run openoffice from terminal -- PUTTY
on ooffice 1.1.3 FC3 and 2.0 FC5 (FC= Fedora Core)
first frame buffer
1) Xvfb :5 -screen 0 800x600x16 &
2) ooffice -invisible -nologo -display :5 -headless and what command u want to run
when this is run from putty does a beautiful job.....
but if i run from php..... nothing happens....
even the script calling didnt help
#!/bin/bash
ooffice -invisible -nologo -display :5 -headless
the exec(), system(), parse..... none came to the rescue....
as i am a admin not a developer.... i took my way... the solution not in php but in system...
after 7 day of fight day n night... left and right... here n there..... fidling with ooffice and its execuitables ......
ofcource some helep from this forum tooo.. (BIG THANX for that)
ouch.... came the result...... 3 lines.... thats all...
the findings r...
when run by apache / php / u login as apache.... a use who has no login rights...
therefore nothing to do with system..
no home, no path, no login permissions.... etc .. etc...
so i modified the script...
export HOME=/tmp
PATH=$PATH:/bin:/usr/bin/:
export PATH
export TEMP=/tmp
ooffice -invisible -nologo -display :5 -headless
PS... /tmp is chmod 777 world writable readable and execuatable
and work done dona done done .....
OUTPUS STARTING TO COME...... tried
-p for printing >> Successfull....
running macros for conversion......
ooffice -invisible -nologo -display :5 -headless "macro:///Standard.Module1.ConvertToPDF(full path to DOC, TXT, RTF, SWX, ODT, XLS ETC )"
Then .... what was my motive.... to get a PDF out put. which frees me of all the compatiability issues caused by different versions and types of offices.... so.......
so... I did a smart thing....
I installed cups-pdf printer..... u can find this here.... aproxx for all distributions customized downloads...
http://www.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/download.shtml
and that worked like charm....
ooffice -invisible -nologo -display :5 -headless -p /full/path/tp/file with extension
this worked great ..... SUPER GREAT
now i am able to print to pdf...
MS DOCS..... 97/2000/XP/2003
MS EXCEL .... 97/2000/XP/2003
All openoffice Docs
HTML files.....
RTFs........
what more......
I shared this linux pdf printer and now My whole office is Printing to pdf.......
made a site and php...... (OFCOURCE... the developers did that on my IDEA... remember i am a System Admin not a developer) my Branch offices now.... Uploads their docs and XLS and ODT ansd SWX files and ooffice converts it to pdf and further those r send by mail to respective departments....
This all eliminates the need of installind MS OFFICE and OOFFICE for compatiablity reasons....
We can now use what ever choice and version of office/openoffice we want and share the PDF Universally any where... irrespective of what the version and liking of office the reader is having....
REMEMBER OPEN SOURCE AND OPEN WILL
I gota a raise because of all this....
Thanx for the tips i got from all u people here....
So in return i am sharing this to help other get their raise....
thanx a zellions for all the help and
I BOW MY HEAD TO OPENOFFICE TEAM......
SUCH A GREAT SOLUTION AND THAT TO FREE.........
NOT EVEN A SINGLE PENNY I SPENT... BUT SAVED A FORTUNE IN RETURN......
THANX AGAIN......  |
|
| Back to top |
|
 |
AndrewZ Moderator


Joined: 21 Jun 2004 Posts: 4140 Location: Colorado, USA
|
Posted: Wed Feb 27, 2008 3:07 pm Post subject: Re: simple solution. PDF and Conversion needs SWX ODT DOC XL |
|
|
| bikram wrote: | | 1) Xvfb :5 -screen 0 800x600x16 & |
For the record, OpenOffice.org 2.3.0+ Linux no longer requires an X server (not even Xvfb) if you install the headless RPM package and use the -headless option.
Some people may be interested in the article Batch command line file conversion with PyODConverter which shows how to use both -headless and Xvfb, so you can choose the one you prefer. _________________ <signature>
* Did you solve your problem? Do others a favor: Post the solution
* OpenOffice.org Ninja
* BleachBit
</signature> |
|
| Back to top |
|
 |
elehenaff Power User

Joined: 16 Apr 2004 Posts: 76 Location: paris - france
|
Posted: Thu Feb 28, 2008 3:06 am Post subject: |
|
|
That is really good news. openOffice.org developpers keep on imroving their software every day. thanks to them.
the next great evolution will be the odf toolkit to build server software really without the UI. i'm looking forward to it. _________________ my box : ooo 2.4 french on winXPSP2
my home : ooo 3.0 beta on winXP
server : ooo 1.1.2 on a debian sarge box using ooo as a pdf generator for a web software
workstations : 150 windows XP workstations with ooo 2.4 |
|
| Back to top |
|
 |
ponkeymeat Newbie

Joined: 15 Apr 2008 Posts: 2
|
Posted: Tue Apr 15, 2008 8:38 am Post subject: Headless option / Openoffice as service |
|
|
# unset DISPLAY
# ./soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
I use the above commands but I keep getting the below error:
/usr/lib/openoffice.org/program/soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)
I'm running Fedora 8. Currently using Putty.
Since it's running as headless I wouldn't think you would need Xvfb installed, which it's not. Can someone let me know something/anything I can try.??  |
|
| Back to top |
|
 |
AndrewZ Moderator


Joined: 21 Jun 2004 Posts: 4140 Location: Colorado, USA
|
Posted: Tue Apr 15, 2008 9:05 am Post subject: |
|
|
Ponkeymeat,
1. Did you install the headless RPM?
2. Use the -headless command line option _________________ <signature>
* Did you solve your problem? Do others a favor: Post the solution
* OpenOffice.org Ninja
* BleachBit
</signature> |
|
| Back to top |
|
 |
hol.sten Super User


Joined: 14 Nov 2004 Posts: 3533 Location: Hamburg, Germany
|
|
| Back to top |
|
 |
ponkeymeat Newbie

Joined: 15 Apr 2008 Posts: 2
|
Posted: Tue Apr 15, 2008 11:43 am Post subject: Re: Headless option / Openoffice as service |
|
|
Ok, i read the post put up explaining that it's probably just a Fedora issue, so I uninstalled OO 2.3 and downloaded the 2.4 RPM from the OO.org and installed that. Now I do not get the X Display error, but now nothing happens. It just sits as if it's processing the request, but nothing ever happens.
# ./soffice -headless -accept="socket,port=8100;urp;"
I have to hit CTRL+C to get back to the prompt. I run netstat -na to see if actually did start listening on port 8100. No Dice.
package openoffice.org-headless-2.4.0-9286 is installed
package openoffice.org-core01-2.4.0-9286 is installed
package openoffice.org-pyuno-2.4.0-9286 is installed
Any ideas? |
|
| Back to top |
|
 |
|