OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Using OpenOffice as a document converter for a linux server

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
radamanthus
Newbie
Newbie


Joined: 16 Jul 2004
Posts: 2
Location: Philippines

PostPosted: Fri Jul 16, 2004 2:42 am    Post subject: Using OpenOffice as a document converter for a linux server Reply with quote

I'm trying to use OOo as a document converter for an existing JBoss system.
My first approach was to install OOo on the console-only Linux server running JBoss.
When I try to run OOo on the linux server, it complains:

/usr/local/OpenOffice.org1.1.2/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)

(There is no X Windows running on the server).
Q: Is there a workaround to this?

Fortunately, this Linux server talks to a SQL Server 2000 database running on Windows 2003. So I install OOo there, and set it up to listen for requests from the linux server.

I've created a documentconverter class based on this:
http://api.openoffice.org/source/browse/api/odk/examples/java/DocumentConverter/Attic/
I'm using this to convert Word .doc files to HTML and manipulate the HTML to highlight certain words.

I can successfully the documents to HTML, but when I want to get the string contents of the HTML file using the getText() method of XTextDocument, I get the plain text contents, not the HTML. Is there a way to obtain the HTML string of an HTML document - without having to save the document to file and using the Java IO classes to read the file?

Thanks!
Back to top
View user's profile Send private message Yahoo Messenger
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Fri Jul 16, 2004 6:05 am    Post subject: Reply with quote

Getting the HTML

My first unsuccessful avenue of investigation was to create a new Web document...

oDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter/web", "_blank", 0, Array() )


And then look for a Dispatch command to effectively do the
View --> HTML - Source
command.

The problem with this approach is that in order to view the HTML source, the document must be saved.

(I was then going to see if in the HTML Source view, I could obtain the HTML text.)

If the document must be saved, then you might as well, just read the HTML out of the document file. Save the file as a Temp file, read its html, then delete the temp file.


X Window server and headless

Here is some past discussion that might be helpful.



X-Windows and headless
======================
http://www.oooforum.org/forum/viewtopic.php?t=4975

http://www.oooforum.org/forum/viewtopic.php?t=3600
http://www.oooforum.org/forum/viewtopic.php?t=2986
http://www.oooforum.org/forum/viewtopic.php?t=2977
http://www.oooforum.org/forum/viewtopic.php?t=2707
http://www.oooforum.org/forum/viewtopic.php?t=2403

http://www.oooforum.org/forum/viewtopic.php?t=4193

http://www.oooforum.org/forum/viewtopic.php?t=3929

http://www.oooforum.org/forum/viewtopic.php?t=6322

See "The Office Headless Mode" at this site...
http://framework.openoffice.org/servlets/ProjectDocumentList?folderID=151

Running second X session
http://www.oooforum.org/forum/viewtopic.php?p=21046#21046

Discussion of headless on XVfb on Solaris
http://www.oooforum.org/forum/viewtopic.php?t=5095


Windows headless or NT Service
==============================
http://www.oooforum.org/forum/viewtopic.php?t=4899
http://www.oooforum.org/forum/viewtopic.php?t=2977
http://www.oooforum.org/forum/viewtopic.php?t=2707

See "The Office Headless Mode" at this site...
http://framework.openoffice.org/servlets/ProjectDocumentList?folderID=151

The Office headless mode
http://framework.openoffice.org/servlets/ProjectDocumentList?folderID=151
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
radamanthus
Newbie
Newbie


Joined: 16 Jul 2004
Posts: 2
Location: Philippines

PostPosted: Sun Jul 18, 2004 10:36 pm    Post subject: Getting the HTML Reply with quote

I'm under the impression that even before saving the file, OOo (and consequently the Java API classes I use to interface to OOo), already have the HTML source and it might be accessible via a method or a property.

Anyway, saving the HTML to a temp file isn't that much difficult, so I'll just do that.

Thanks a lot, Danny![/b]
Back to top
View user's profile Send private message Yahoo Messenger
hthb
General User
General User


Joined: 11 Feb 2004
Posts: 6
Location: Iceland

PostPosted: Tue Jul 20, 2004 8:55 am    Post subject: X Display problem Reply with quote

Use the tool Xvfb. It sets up a virtual X window. I use this at my site www.doc2pdf.net to convert .doc to .pdf files.You can also use xvfb-run which is a wraparound script around Xvfb, but for me using Xvfb worked better.
_________________
Look at www.doc2pdf.net for instant,, free, no need to register, conversion of .doc to .pdf files.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group