Dear All,
I am testing Aspose.words in java.
I modified the demo program, so that it is connected to Sybase table with chinese characters. (UTF-8 encoding). Overall, the program can export doc, docx and html documents with correct chinese chars. But I found the output pdf cannot display chinese. The chinese char is displayed rectangle box.
So, please help.
For information: Program run in Chinese MS Windows XP Service Pack 2003, Aspose.words is download from web (evaluation version; Aspose.Words.jdk16.jar) and I used JDK 1.6 to test.
Thanks
Hi
Thanks for your request.
Aspose.Words needs fonts to convert Word documents to PDF. If Aspose.Words cannot read any fonts, conversion to PDF will not work.
Could you please try specifying TrueTypeFontFolder. Try using the following code:
public static void main(String[] args)
{
Document doc;
try
{
PdfOptions pdfOpts = new PdfOptions();
pdfOpts.setTrueTypeFontsFolder("usr/fonts");
doc = new Document("test.doc");
doc.saveToPdf(0, doc.getPageCount(), " test.pdf", pdfOpts);
}
catch (Exception e)
{
e.printStackTrace();
}
Note, TrueTypeFontFolder should contain fonts, which are using in your document.
Please make sure the font which you have used is installed on the PC where you perform conversion to PDF. If not, please try to install this font.
Also could you please also attach your input and output documents here for testing? I will investigate the issue and provide you more information.
Hi,
Thanks for prompt response.
In details, I add recommended java code, which read a word document (sMailingLabelsDemo.doc)contains chinese chars, and refer fonts folder to c:\windows\fonts and output pdf file say test.pdf.
But the generated pdf still cannot see chinese chars.
On the other hand, I used sample code from Aspose.word, which read a template winword file (Src_MailingLabelsDemo.doc), and output MailingLabelsDemo.doc and MailingLabelsDemo.pdf.
MailingLabelsDemo.doc can display chinese chars while MailingLabelsDemo.pdf cannot display chinese chars.
So, please help and looking forward for your kindness reply.
FYI: program run in Chinese MS Windows XP Service Pack 2003, Aspose.words is download from web (evaluation version; Aspose.Words.jdk16.jar)
Hello
Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed. This problem does not occur in .NET version of Aspose.Words. Currently we are working on synchronizing Java and .NET versions of Aspose.Words. Once we finish this work all functionality which is supported in, NET version will be supported in Java version. Also you should note, converting to PDF is in beta at the moment. I will notify you as soon as converting to PDF in Aspose.Words for Java is out of beta.
Best regards,
Thanks
Hi Andrey Noskov,
May I know when the problem of display chinese in pdf can be fixed. It is because our team will soon deploy application to user with this function.
Thanks for your reply and looking forward to receive your reply.
Hi
Thanks for your inquiry. Currently we are working on synchronizing .NET and Java versions of Aspose.Words. You can check progress here:
https://blog.aspose.com/2011/02/24/autoporting-aspose.words-for-java-progress-24th-feb-2011
Hopefully the new version of Aspose.Words for Java will be released somewhere in March. You will be notified as soon as it is released.
Best regards,
We are happy to inform you that the first auto-ported version of Aspose.Words for Java is ready. This version supports converting documents to PDF. You can get it from here.
Best regards,
Aspose.Words team
(104)