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

Free Support Forum - aspose.com

93K WORD document is converted to 2.6M



As the file from 93K was converted to 2.6M lead to open in the WEB project is very slow. The following attachment is the source file. The core source code is as follows:

HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions();
try {
saveOptions.setShowPageBorder(false);
saveOptions.setPrettyFormat(true);
saveOptions.setExportEmbeddedCss(true);
saveOptions.setExportEmbeddedFonts(true);
saveOptions.setExportEmbeddedImages(true);
saveOptions.setExportEmbeddedSvg(true);
saveOptions.setWarningCallback(new IWarningCallback() {
@Override
public void warning(WarningInfo warningInfo) {
if (WarningType.FONT_EMBEDDING == warningInfo.getWarningType()
|| WarningType.FONT_SUBSTITUTION == warningInfo.getWarningType()) {
ConverterLogger.logInfo(getClass(), warningInfo.getDescription());
}
}
});
for (Field field : word.getRange().getFields()) {
if (FieldType.FIELD_HYPERLINK == field.getType()) {
((FieldHyperlink) field).setTarget("_blank");
}
}
saveOptions.setUpdateFields(false);
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath || throwable instanceof OutOfMemoryError) {
throw throwable;
} else {
throw new Exception("aspose_setting", throwable);
}
}
int htmlPageCount = 0;
try {
htmlPageCount = word.getPageCount();
viewerParam.put("htmlPageCount", htmlPageCount);
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath || throwable instanceof OutOfMemoryError) {
throw throwable;
} else {
throw new Exception("aspose_getPageCount", throwable);
}
}
String pageKey = "page-";
IConvertFile pageConvertFile = null;
OutputStream pageConvertStream = null;
for (int i = 1; i <= htmlPageCount; i++) {
try {
ConverterLogger.logDebug(getClass(), "文件-" + sourceFile.getFileName() + "-第" + i + "页转换HTML开始:\n"); //the no.page converts HTML to the beginning
saveOptions.setPageIndex(i - 1);
saveOptions.setPageCount(1);
try {
pageConvertFile = sourceFile.newConvertFile(pageKey + i + "-svg");
pageConvertStream = pageConvertFile.getOutputStream();
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath || throwable instanceof OutOfMemoryError) {
throw throwable;
} else {
throw new Exception("createConvertFile", throwable);
}
}
try {
word.save(pageConvertStream, saveOptions);
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath || throwable instanceof OutOfMemoryError) {
throw throwable;
} else {
throw new Exception("aspose_convert", throwable);
}
}
ConverterLogger.logDebug(getClass(), "文件-" + sourceFile.getFileName() + "-第" + i + "页转换HTML结束:\n"); //The no. page converts HTML to the end
} catch (Throwable throwable) {
throw throwable;
} finally {
if (pageConvertStream != null) {
try {
pageConvertStream.close();
} catch (Exception e) {
//
}
}
System.gc();
}
}

Hi Yongjun,


Thanks for your inquiry. We have tested the scenario with Aspose.Words for Java 17.3 and noticed the reported issue, so logged a ticket WORDSNET-15149 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as WORDSNET-15149) have been fixed in this Aspose.Words for .NET 17.5 update and this Aspose.Words for Java 17.5 update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.