Page 1 of 1

Docx to HTML - Help Needed with ConversionImageHandler

PostPosted: Mon Jul 01, 2013 6:09 pm
by anshumanbhatia
Hi All,

So i have a requirement of creating a webservice for converting the docx files to html. I am able to do this without any problems.

What i am not sure on doing is how to handle the images. These images which are embedded in the docx need to be uploaded back to the system which is consuming the Docx to Html Conversion webservice using a imageupload webservice again.

The URI for the images need to be set according to the links that will be returned by the imageupload webservice. Once the URI's are set properly , this HTML will be sent back as a response to the Conversion webservice.

For this i thought of having an implementation of the AbstractConversionImageHandler's handleImage method but drew a blank on the ideas.

Could anyone help me with this ?

Re: Docx to HTML - Help Needed with ConversionImageHandler

PostPosted: Sat Jul 06, 2013 7:22 pm
by jason
Well here's the source code for https://github.com/plutext/docx4j/blob/ ... ndler.java

and here's https://github.com/plutext/docx4j/blob/ ... ndler.java

Let us know where you are running into difficulty?

Re: Docx to HTML - Help Needed with ConversionImageHandler

PostPosted: Sun Jul 07, 2013 4:29 pm
by anshumanbhatia
Thanks i had gone through the code for ImageHandlers already !!

Eh - the problem where i am stuck at is how to set the links for the uploaded image in the converted html.

Re: Docx to HTML - Help Needed with ConversionImageHandler

PostPosted: Sun Jul 07, 2013 7:06 pm
by jason
Override the image handler to do what you need, and be sure use yourImageHandler with:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
        HtmlSettings htmlSettings = new HtmlSettings();        
        htmlSettings.setImageHandler(yourImageHandler);
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4