We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word2Html including a favicon

Hi,
I am trying to convert a doc file into an html for displaying it in my webPage.
Is it possible to include a favicon inside the head of the html. Something like this:

<head>
... Stuff included by default by Aspose converter...
<link rel="shortcut icon" type="image/x-icon" href=http://myweb/favicon.ico"/>
</head>

My webPage uses dynamic favicon, so using the project default favicon is not an option. The html document itself should contain the favicon.

Thanks

@sballestero,

Thanks for your inquiry. Please ZIP and attach your input and expected output HTML here for our reference. We will then provide you more information about your query along with code.

Hello Tahir,
right now, the code to convert from doc to html is really simple:

@Override
	public void convertToHtml(String fileName, InputStream is, OutputStream os) throws Exception {
		Document doc = new Document(is);
		doc.getBuiltInDocumentProperties().setTitle(fileName);
		HtmlSaveOptions options = new HtmlSaveOptions();
		options.setPrettyFormat(true);
		options.setExportImagesAsBase64(true);
		options.setExportXhtmlTransitional(true);
		doc.save(os, options);
	}

This code produce something similar to:

 <html xmlns="http://www.w3.org/1999/xhtml">
 	<head>
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 		<meta http-equiv="Content-Style-Type" content="text/css" />
 		<meta name="generator" content="Aspose.Words for Java 16.2.0.0" />
 		<title>MI_FILE_TITLE.docx</title>
 	</head>
 	<body>
	RESULT OF THE CONVERSION
         </body>
</html>

But I expect to be able to add a new line with the favicon

<link rel="shortcut icon" type="image/x-icon" href="_LINK TO MY FAVICON_" />

to the code generated :

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta name="generator" content="Aspose.Words for Java 16.2.0.0" />
		<title>MI_FILE_TITLE.docx</title>
		<link rel="shortcut icon" type="image/x-icon" href="_LINK TO MY FAVICON_" />
	</head>
	<body>
	RESULT OF THE CONVERSION
	</body>
</html>

Until the moment I have only been able to set the page title, but no luck with the favicon.

Thank you

@sballestero,

Thanks for sharing the detail. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-16856 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@sballestero,

It is to update you that we have closed the issue (WORDSNET-16856) with “Won’t Fix” resolution. This is out of scope of the HTML converter. You can read the output HTML using Java code and insert the LINK tag inside head tag.