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

Embeded images and HTML -> doc conversion

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


Joined: 15 Sep 2006
Posts: 6

PostPosted: Fri Sep 15, 2006 12:56 am    Post subject: Embeded images and HTML -> doc conversion Reply with quote

Hi,
I'm currently working on a converter using UNO and Java. I successfuly exported .html to .odt or .doc but there is still a little (but annoying) problem : all images are linked to external files, as in HTML. How can I have embedded images ? Is there a property value to set (if yes, wich ?) or should I handle each image one by one (if yes how).
Regards
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Fri Sep 15, 2006 7:43 am    Post subject: Reply with quote

Perhaps a start here :
Inserting an image copy (not a linked image)
http://www.oooforum.org/forum/viewtopic.phtml?t=13251&highlight=
Turning linked images into embedded images in oo http://www.oooforum.org/forum/viewtopic.phtml?t=10731&highlight=
How to insert a graphic into a documenthttp://www.oooforum.org/forum/viewtopic.phtml?t=14979
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Beuss
General User
General User


Joined: 15 Sep 2006
Posts: 6

PostPosted: Mon Sep 18, 2006 5:25 am    Post subject: Reply with quote

Thank you so much, this was exactly what I was looking for !!!
I translated the C++ example into Java and it (almost) works Smile
Thanks again
Back to top
View user's profile Send private message
Beuss
General User
General User


Joined: 15 Sep 2006
Posts: 6

PostPosted: Mon Sep 18, 2006 6:42 am    Post subject: Reply with quote

OK, conversion is fine but I have still one little problem
When I load the document, if it is a very huge one (let's say an HTML document of 55 pages with about 20 images), not all images are converted. It is due to the fact that loadComponentFromURL returns before the document is actually loaded. Is there a way to be sure that the document is loaded before continuing ?
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Sep 18, 2006 9:01 am    Post subject: Reply with quote

Sorry, I don't see an other way than waiting with a loop !
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Beuss
General User
General User


Joined: 15 Sep 2006
Posts: 6

PostPosted: Mon Sep 18, 2006 9:21 am    Post subject: Reply with quote

Yes i guess, but is there some flag to check in order to know if the document is completely loaded ?
Back to top
View user's profile Send private message
j-rox
General User
General User


Joined: 14 May 2006
Posts: 30

PostPosted: Thu Sep 21, 2006 7:20 am    Post subject: Reply with quote

Would you mind posintg your Java code here? Thanks.
Back to top
View user's profile Send private message
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Sat Sep 23, 2006 5:36 am    Post subject: Reply with quote

Beuss wrote:
OK, conversion is fine but I have still one little problem
When I load the document, if it is a very huge one (let's say an HTML document of 55 pages with about 20 images), not all images are converted. It is due to the fact that loadComponentFromURL returns before the document is actually loaded. Is there a way to be sure that the document is loaded before continuing ?

Hi,

you can wait for the OnLoadFinished event ...

Good luck,

ms777

Code:
private boFinished as Boolean

Sub Main
'remove the first two lines from that document so that OO recognizes as html
sUrl     = ConvertToUrl("C:\Programme\OpenOffice.org_2.0_SDK\docs2\DevelopersGuide\BasicAndDialogs\BasicAndDialogs-mod.html")
sDestUrl = ConvertToUrl("C:\Dokumente und Einstellungen\Schnuff\Desktop\test.pdf")

oListener = CreateUnoListener( "DocListener_","com.sun.star.document.XEventListener" )

Dim loadProps(1) as new com.sun.star.beans.PropertyValue
loadProps(0).Name = "Hidden"
loadProps(0).Value = true

boFinished = False

oDoc = StarDesktop.loadComponentFromURL(sUrl, "_default", 0, loadProps())
oDoc.com_sun_star_document_XEventBroadcaster_addEventListener( oListener )

while not boFinished
  wait(100)
  wend

Dim storeProps(0) as new com.sun.star.beans.PropertyValue
storeProps(0).Name = "FilterName"
storeProps(0).Value = "writer_web_pdf_Export"
oDoc.storeToURL(sDestUrl, storeProps())
oDoc.close(true)

End Sub

Sub DocListener_notifyEvent( o as object )
if o.EventName="OnLoadFinished" then boFinished = true
end sub

Sub DocListener_disposing()
End Sub
Back to top
View user's profile Send private message
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