Free Support Forum - aspose.com

Messy codes when converte word to pdf or tiff

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);
}

}

}

Hi liu,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (PDF, XPS or SWF). Make sure you have all the Fonts installed on the machine you're using to convert Word document to PDF format. I would suggest you please read the following article:
http://www.aspose.com/docs/display/wordsjava/How+Aspose.Words+Uses+True+Type+Fonts

I would suggest you please upgrade to the latest version (v13.1.0) from here and let us know how it goes on your side. Hope this helps you.

Moreover, our development team has recently fixed some bugs related to Asian font substitution which may solve your issue as well. The fix of these issues will be included in the next version of Aspose.Words (v13.2.0) which is planned to be released in a couple of days. We will inform you via this forum thread as soon as the new release is published.

Please let us know if you have any more queries.