Aspose.words java is adding times new roman as default font while conversion


#1

Hello,
when i use this following code to convert html text to rtf text the style in the html text is changing to times new roman as default. Can you please let me know how to fix this issue? Im using the latest aspose.words version aspose-words-19.4-jdk17.jar.

            HtmlLoadOptions options = new HtmlLoadOptions();
            options.setLoadFormat(LoadFormat.HTML);
            options.setPreserveIncludePictureField(true);
	ByteArrayInputStream is = new  ByteArrayInputStream(htmlString.getBytes(Charset.forName("UTF-8")));
	Document doc = new Document(is, options);
	 ByteArrayOutputStream os = new ByteArrayOutputStream();
	 com.aspose.words.SaveOptions saveOptions = 
            com.aspose.words.SaveOptions.createSaveOptions(SaveFormat.RTF);
	saveOptions.setSaveFormat(SaveFormat.RTF);
	doc.save(os, saveOptions);
	rtfString = new String(os.toByteArray(), StandardCharsets.UTF_8);

We are using java 7, 32-bit version and windows 10 Operating system. Please find the attachment of sample html text.htmltext.zip (330 Bytes)

Thanks


#2

@dineshreddydepa

We have test the scenario and have not found the shared issue. Please check the attached output document. output.zip (1.2 KB)

Please make sure that the fonts Impact, Charcoal, or sans-serif are installed on the system where you are converting HTML to RTF.