We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document with Chinesse letter

I use Aspose.Words for Java 14.5 and use same code on 3 different computers

Computer A (Win 7 64x)
Computer A (RH 5.9 64x)
Computer A (RH 5.9 64x)

Part of my application is download of document in PDF or DOCX format. I use Aspose.Words to convert from HTML to PDF and DOCX.

When document is saved in Chinese I have 3 different behaviors on 3 computers:
Computer A: download of PDF and DOCX works fine
Computer B: download of PDF does NOT work, DOCX works fine
Computer C: download of PDF does not work, DOCX does not work

I’m attaching an document example.

My conclution is that code works, but someting extra need to be installed (for example fonts?). Can you please guide me and give me directions what else need to instal on my test environments Computer B, and Computer C, that I can support download of documents in Chinese


Hi Milan,

Thanks for your inquiry. Could you please install the following fonts on Computer B and C and see how it goes:

  • ‘MS Gothic’
  • ‘MingLiU’
  • ‘Calibri’
  • ‘Batang’

In case, the problem still remains, please share your piece of code you’re getting this problem with. Also, please attach Aspose.Words generated output PDF and DOCX files here for our reference. We will investigate the issue further on our end and provide you more information.

Best regards,

we installed rpm for msttcorefonts-2.5-1.
Now, computer B and C both work fine with DOCX and does not work with PDF. On windows computer (A) DOCX and PDF work fine.

Note: Do I need to copy fonts to /usr/lib/jvm/java-6-sun/jre/lib/fonts?

My code:

@RequestMapping(value = “/rest/documents/downloadFile/pdf/{id}”, method = RequestMethod.GET)
public void getPDFFile(@PathVariable Long id, HttpServletResponse response) throws IOException {
ByteArrayOutputStream out = null;
InputStream is = null;
InputStream input = null;
try {
DocumentCDO documentDomain = documentService.findOne(id);
input = new ByteArrayInputStream(documentDomain.getHtmlContent().getBytes(“UTF-8”));
String fileName = “download.pdf”;
com.aspose.words.LoadOptions loadOptions = new com.aspose.words.LoadOptions();
com.aspose.words.Document doc = new com.aspose.words.Document(input, loadOptions);
out = new ByteArrayOutputStream();
doc.save(out, com.aspose.words.SaveFormat.PDF);

// get your file as InputStream
is = new ByteArrayInputStream(out.toByteArray());
// copy it to response’s OutputStream
IOUtils.copy(is, response.getOutputStream());
response.setHeader(“Content-Disposition”, “attachment; filename=”" + fileName + “”");
response.setHeader(“Expires”, “0”);
response.setHeader(“Cache-Control”, “must-revalidate, post-check=0, pre-check=0”);
} catch (IOException ex) {
log.error(“Error writing file to output stream. Document was '” + id + “’”, ex);
throw new RuntimeException(“IOError writing file to output stream”);
} catch (Exception e) {
log.error(“Error while converting”, e);
} finally {
if (out != null) {
if (is != null) {

Hi Milan,

Thanks for your inquiry. Different Linux distributions store fonts in different folders. Aspose.Words looks for fonts in several well-known locations.

By default, Aspose.Words looks for the fonts in the following locations:

  • /usr/share/fonts
  • /usr/local/share/fonts
  • /usr/X11R6/lib/X11/fonts

This default behavior will work for most Linux distributions, but not guaranteed to work all of the time. You might need to specify the location of true type fonts explicitly. To do this, you need to know where TrueType fonts are installed on your Linux distribution.

Best regards,