Free Support Forum - aspose.com

Importing html extremely slow in linux

Hi,


We are evaluating the Aspose solution to convert HTML file to doc format. We find it takes less than 90 seconds to load the attached html file into document model in a windows environment. While we deploy it to a linux box, it takes more than 400 seconds doing the same.

In the beginning, we thought it might be the TrueType issue with linux, so we upload the whole windows truetype files to a folder and use code like FontSettings.getDefaultInstance().setFontsFolder(fontFolder,true); Unluckly, it doesn’t seem work. On the other hand, it is quite quick to load the generated doc file which is converted from the attached html file.

Code snippet is as below:

FontSettings.getDefaultInstance().setFontsFolder(fontFolder,true);
File file = new File(“456456test.html”);
FileInputStream fis = new FileInputStream(file);
Document doc = new Document(fis);
doc.save(fos, SaveFormat.DOC);

Thanks.

Hi there,


Thanks for your inquiry. Most probably, you are facing this issue due to following image link at linux. Please make sure that you have access to this link at your Linux system.
http://localhost:8080/WorkplaceFX//assets/upload/image/CPGSWF.jpg

You may use HtmlLoadOptions.WebRequestTimeout property to set the number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds (100 seconds).

HtmlLoadOptions options = new HtmlLoadOptions();

options.setWebRequestTimeout(
100);

Document doc = new Document(MyDir + , options);

doc.save(
MyDir + “Out v16.11.0.doc”);<o:p></o:p>

If you still face problem, please share the image (CPGSWF.jpg) here for testing. We will investigate the issue and provide you more information on this.

Thanks for the quick reply. But it seems not work. Furthermore,if I remove the “img” tag from the html text, it still takes the same amount of time to load.

I was wrong. The image url is the root cause. Thanks.

Hi there,

Thanks for your feedback. It is nice to hear from you that you have found the root cause of this issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.