Landray RDM 171780 Convert Effect

words source code:
src.zip (4.8 KB)

origin doc:
函.doc.zip (14.0 KB)

before converted:
image.png (357.0 KB)

after converted:
image.jpg (492.3 KB)

It could not display year after converted,please have a check.

@hucq_landray_com_cn As I can see from your code you are using some old version of Aspose.Words for Java. I tested the scenario using the latest 22.8 version of Aspose.Words for Java and was unable to reproduce the problem. Here is the output produce on my side: out.zip (51.7 KB)

The code was modified to work with the latest version:

Document doc = new Document("C:\\Temp\\in.doc");
doc.setTrackRevisions(false);
doc.acceptAllRevisions();
doc.getChildNodes(NodeType.COMMENT, true).clear();
doc.setWarningCallback(new FontSubstitutionWarningCollector());

for (Field field : doc.getRange().getFields())
{
    if (FieldType.FIELD_HYPERLINK == field.getType())
    {
        ((FieldHyperlink)field).setTarget("_blank");
    }
}

int pageCount = doc.getPageCount();

// save html
HtmlFixedSaveOptions htmlOptions = new HtmlFixedSaveOptions();
htmlOptions.setShowPageBorder(false);
htmlOptions.setPrettyFormat(true);
htmlOptions.setExportEmbeddedCss(true);
htmlOptions.setExportEmbeddedFonts(true);
htmlOptions.setExportEmbeddedImages(true);
htmlOptions.setExportEmbeddedSvg(true);
htmlOptions.setUpdateFields(false);
for (int i = 0; i < pageCount; i++)
{
    htmlOptions.setPageSet(new PageSet(i));
    doc.save("C:\\Temp\\out_" + i + ".html", htmlOptions);
    System.gc();
}

// save pic
int resolution = 76;// or more for high resolution ratio;
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.PNG);
saveOptions.setUseHighQualityRendering(true);
saveOptions.setResolution(resolution);
saveOptions.setScale(1.0f);
saveOptions.setPrettyFormat(true);
saveOptions.setUpdateFields(false);
for (int i = 0; i < pageCount; i++)
{
    htmlOptions.setPageSet(new PageSet(i));
    doc.save("C:\\Temp\\out_" + i + ".png", saveOptions);
}

image.jpg (404.4 KB)

I used the latest version,but don’t have this class.

@hucq_landray_com_cn FontSubstitutionWarningCollector is an implementation of IWarningCallback used to get a notification when font substitution is performed.

private static class FontSubstitutionWarningCollector implements IWarningCallback {
     public void warning(WarningInfo info) {
        if (info.getWarningType() == WarningType.FONT_SUBSTITUTION)
            System.out.println(info.getDescription());
    }
}