Hi
I use Aspose Word 17.2 to save a Word into HTML format, with page splitter from Github.
In the result of this file, the image covers the text. This is different from the Word file.
Please check this issue and the attachment.
P.S. Here is my code
@Test
public void testForAspose()
{
String fileName = "CPCR.docx";
try
{
Document doc = new Document("input/" + fileName);
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);
//saveOp.setUpdateFields(true);
layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
splitter = new DocumentPageSplitter(layoutCollector);
byte[] outputContent;
String outputPath = "output/";
String dirName = fileName;
File outputDir = new File(outputPath + "/" + dirName + "/");
if (!outputDir.exists())
outputDir.mkdir();
ByteArrayOutputStream testOut = new ByteArrayOutputStream();
for (int page = 1; page <= doc.getPageCount(); page++)
{
System.out.println("page:" + page);
pageDoc = splitter.getDocumentOfPage(page);
testOut.reset();
output.reset();
pageDoc.save(output, saveOp);
outputContent = output.toByteArray();
IOUtils.write(outputContent, new FileOutputStream(outputPath + "/" + dirName + "/" + page + ".html"));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}