| View previous topic :: View next topic |
| Author |
Message |
Beuss General User

Joined: 15 Sep 2006 Posts: 6
|
Posted: Fri Sep 15, 2006 12:56 am Post subject: Embeded images and HTML -> doc conversion |
|
|
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 |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
Beuss General User

Joined: 15 Sep 2006 Posts: 6
|
Posted: Mon Sep 18, 2006 5:25 am Post subject: |
|
|
Thank you so much, this was exactly what I was looking for !!!
I translated the C++ example into Java and it (almost) works
Thanks again |
|
| Back to top |
|
 |
Beuss General User

Joined: 15 Sep 2006 Posts: 6
|
Posted: Mon Sep 18, 2006 6:42 am Post subject: |
|
|
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 |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
Beuss General User

Joined: 15 Sep 2006 Posts: 6
|
Posted: Mon Sep 18, 2006 9:21 am Post subject: |
|
|
| Yes i guess, but is there some flag to check in order to know if the document is completely loaded ? |
|
| Back to top |
|
 |
j-rox General User

Joined: 14 May 2006 Posts: 30
|
Posted: Thu Sep 21, 2006 7:20 am Post subject: |
|
|
| Would you mind posintg your Java code here? Thanks. |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Sat Sep 23, 2006 5:36 am Post subject: |
|
|
| 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 |
|
 |
|