Problem with some character while converting .doc to .html

Hi!


I have a word document that need to be converted to html file. the problem is that the word file has a mathematical script small v that doesn’t show correctly. A middot appears instead. There is a way to take that character and convert it into a jpg/png file?

Hi,

Thanks for your inquiry. Please attach your input Word document and output HTML file showing the undesired behavior here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

The character with font Symbol and Cambria Math have the problem. It is possible to have them as images? thx!

Hi,


Thanks for your inquiry. The HTML file you attached was generated using Aspose.Words for Java 15.9.0.0; could you please upgrade to the latest version of Aspose.Words for Java i.e. 15.12.0 and see how it goes on your end? Hope, this helps. I have also successfully converted this .doc to .html and attached it here for your reference.

In case the problem still remains on your end, please tell us how are you generating this .html file from .doc? Please share piece of source code to reproduce this issue on our end. Please create comparison screenshot of .doc and .html which shows the problematic areas in Aspose.Words generated html and attach it here for our reference. We will investigate the issue further on our end and provide you more information.

Best regards,

What I really need is to have the letter v (Mathematical script small v) in a image. is it that possible? I attach an image of that letter.

Hi,


Thanks for your inquiry. I am afraid, there is no direct way in Aspose.Words for Java that you can use to convert Run of text to Image. However, you can implement the following workflow to meet this requirement:

1) Find Run node(s) where the specified character exists e.g.
Run run = ((Paragraph)doc.getLastSection().getBody().getLastParagraph().getPreviousSibling()).getRuns().get(0);
2) Find dimensions of this character as follows:
AffineTransform affinetransform = new AffineTransform();
FontRenderContext frc = new FontRenderContext(affinetransform,true,true);
Font font = new Font(run.getFont().getName(), Font.PLAIN, 12);
int textwidth = (int)(font.getStringBounds(run.getText(), frc).getWidth());
int textheight = (int)(font.getStringBounds(run.getText(), frc).getHeight());
3) Build a Graphics object and draw this character
4) Save the Graphics object to a PNG image stream in memory
5) Move the cursor to the current Run object that you want to replace with Image:
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveTo(run);
6) Insert the temporary image from stream using:
builder.insertImage(baos.toByteArray());
7) Remove the old Run as we don’t want text representation (run.remove())
8) Save the Word file to Html

Hope, this helps.

Best regards,