elvisfabiane / jodconverter

Automatically exported from code.google.com/p/jodconverter
0 stars 0 forks source link

Images are not embedded when converting from HTML to ODT or DOC format #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download the attached HTML file and place an image of your choice in the 
same directory. Update the HTML content to point to your image or rename your 
image to "image.jpg".
2. Convert the HTML file to ODT format.
3. Open the ODT file. The image is displayed.
4. Close the ODT file, rename or delete the image file and open the ODT file 
again. The image is broken because it is a link to the file system image 
instead of being embedded in the ODT document.

What is the expected output? What do you see instead?

At step 4. the image should have been visible even if the file system image was 
renamed or deleted.

Please use labels and text to provide additional information.

I'm using jodconverter-core-3.0-beta-3. I found this OpenOffice extension 
http://extensions.services.openoffice.org/project/ImagesEmbedder that allows 
you to embed images from the current document. I managed to rewrite the 
StarBasic code of the extension in Java and I patched 
AbstractConversionTask.java . It might not be the right place to put the code 
from an architectural point of view but it works for me. I hope you can 
integrate this code. See the attached patch.

Original issue reported on code.google.com by zmeuld...@gmail.com on 4 May 2011 at 8:37

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch, but I'm not going to integrate it sorry.

This is a case where you don't like the way OpenOffice.org does the conversion 
by default and you want to customise it a little bit. There are many possible 
cases like this, with different users having possible conflicting needs.

I'm not going to add code for all these special cases to JODConverter. The idea 
is that JODConverter by default does whatever OpenOffice.org does, and let 
users do customisations in their own code if they need to.

That's what AbstractConversionTask is for. If you look at the code in trunk it 
has a modifyDocument() so you can write your own class extending 
AbstractConversionTask and override modifyDocument() with your code.

Original comment by mirko.na...@gmail.com on 7 May 2011 at 10:20

GoogleCodeExporter commented 9 years ago
I don't have access to the OfficeContext in modifyDocument(XComponent). I need 
for instance to get a service like GraphicProvider from the context.

Original comment by mariusdu...@xwiki.com on 18 Aug 2011 at 1:37

GoogleCodeExporter commented 9 years ago
Cannot extend AbstractConversionTask if OfficeDocumentUtils class isn't public.
If I want to implement getStoreProperties similar like in 
StandardConversionTask in other package - OfficeDocumentUtils should be 
public...

Original comment by klemenzi...@gmail.com on 5 Sep 2011 at 9:13

GoogleCodeExporter commented 9 years ago
Also another question: how can I get "OfficeContext context" - I would need it 
if I should make some modifications to openDocument changes.

Original comment by klemenzi...@gmail.com on 5 Sep 2011 at 9:26

GoogleCodeExporter commented 9 years ago
did u solve this issue? base64 pics are not embedded in doc, odt...

Original comment by g.dilemb...@gmail.com on 25 Feb 2015 at 6:07