Free Support Forum - aspose.com

Appears a blank page when stored in html format

Hi Aspose team,


I am using Aspose Word 17.3 to convert a Word file to a HTML file.
In the linux environment of the transfer results, the second page will be blank.

Java code:
License l = new License();
l.setLicense(“aspose.lic”);

try {
Document doc = null;
Document pageDoc;
LayoutCollector layoutCollector;
DocumentPageSplitter splitter;
ByteArrayOutputStream output = new ByteArrayOutputStream();
HtmlSaveOptions saveOp = new HtmlSaveOptions();
saveOp.setExportImagesAsBase64(true);
saveOp.setExportTextInputFormFieldAsText(false);
saveOp.setExportTocPageNumbers(true);
saveOp.setExportPageSetup(true);
saveOp.setExportDocumentProperties(true);
saveOp.setExportRelativeFontSize(false);

if (StringUtil.isNullOrEmpty(password)) {
doc = new Document(path);
} else {
LoadOptions loadOps = new LoadOptions(password);
doc = new Document(path, loadOps);
}
layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
splitter = new DocumentPageSplitter(layoutCollector);

String blockId = UUID.randomUUID().toString();

File outputDir = new File(blockId + “/”);
if (!outputDir.exists())
outputDir.mkdir();

for (int page = 1; page <= doc.getPageCount(); page++) {
System.out.println(“page:” + page);
pageDoc = splitter.getDocumentOfPage(page);

output.reset();
pageDoc.save(output, saveOp);

IOUtils.write(output.toByteArray(), new FileOutputStream(blockId + “/” + page + “.html”));
}
} catch (Exception e) {
}

I have uploaded the origin Word file and the result.
Please check the attachment, and help me solve this issue, thanks!
Hi Lai,

Thanks for your inquiry. Please make sure that you have installed all fonts that are used in your document on the machine where you are converting document. Please upgrade to the latest version of Aspose.Words for Java 17.4. Hope this helps you.

If you still face problem, please share following fonts here for testing. We will investigate the issue and provide you more information about your query.

  • 宋体
  • PMingLiU
  • 華康粗黑體
  • 黑体