In Linux OS I’m using aspose.words for java v11.10 to convert word documents to tiff or pdf formats, the word contains Chinese and English words and numbers. But When convert it into pdf, messy code occured in the pdf document. and the number will flow over the chinese words, please see the attached files.
But the problems above didn’t occur in windows operation. Can any export help me?
the codes is as follows:
public class TestWord {
public static void main(String[] args) throws Exception {
String input=“g:/wd/chinese.doc”;
String ouput=“g:/wd/output/”;
TestWord t=new TestWord();
t.execWd(input, ouput);
}
public void execWd(String word, String outfolder) throws Exception {
Document doc = new Document(word);
doc.save(outfolder + “result.pdf”);
doc.save(outfolder + “result.doc”);
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.TIFF);
options.setTiffCompression(TiffCompression.CCITT_4);
options.setResolution(300);
doc.save(outfolder + “resulst.tiff”, options);
int pgCount = doc.getPageCount();
for (int i = 0; i < pgCount; i++) {
options.setPageIndex(i);
options.setPageCount(1);
doc.save(outfolder + i + “.tif”, options);
}
}
}