Support Chinese

Dear Admin,

We are very interested to your aspose.excel and aspose.pdf .
And, we have downloaded the demos. So far, everything looks pretty good.
Except there is one problem(very important) which is we could see the aspose.pdf support chinese character. We have changed the data in Northwind and used Chinese Adobe Reader to view the result page. But the result pdf file still show garbage for the chinese character.

So does the aspose.pdf support chinese?

If yes, could you share how to do it?

Much Appreciated!

Kimmomo


Dear Kimmomo,

You’re coming here for the right thing at the right time: We’re working on the Unicode issue and it will be finished around mid-September. At that time, you can write Chinese characters into pdf files perfectly.

So can you be waiting for that? If not please let me know your expected availability schedule.

Dear Admin,

Thanks for your update!

Our project will start at the September, so if unicode version is on schedule.
We should be ok on that. ; )

We have another question.

If we decide to buy the standard version to begin with and upgrade to Corporate version later.
What will be the process? How long it will take?

Thanks,
Kim

Dear Kim.

The [Upgrade Policy](http://www.aspose.com/Purchase/Upgradepolicy.html) is quite simple: you pay the difference between Corporate and Standard. You can get the updated license file within minutes or hours after order.

Please let me know if you have further questions.

Dear Admin,

Is the unicode version of the Aspose.pdf still on schedule?

Thanks,
Kim

Hi Kim,

Yes. You can get it around mid-September.

Can you wait until then?

Hi Admin,

Because my company needs us to confirm which pdf tool to buy, just wondering is the unicode version of aspose.pdf ready? What will be the tentative schedule now?

If yes, could I have a evalution one for trial? I really like aspose.pdf, but I also need a tool to support chinese.

Much Appreciated!

Kimmomo

Dear Kimmomo,

This weekend we will publish new release 1.4, supporting Chinese.

Please keep an eye on aspose.com.

Thanks for your kindly tolerance.

Dear Admin,

What a great news! Will looking forward to your new release.

Cheers,
Kimmomo

Dear Kimmomo,

Thanks for your consideration.

Please download new release and examples here.


Hi Admin,

I can’t get the chinese sample working.
I have created a chineseexample.aspx which inherits the chineseexample.aspx.vb.
After starting the project, the following error occurs. Could you please let me know what wrong with my code.

In ChineseExample.aspx

<%@ Page CodeBehind=“ChineseExample.aspx.vb” Language=“vb” AutoEventWireup=“false” Inherits=“Aspose.Pdf.Demos.VisualBasic.ChineseExample” %>


Error Message

Line 56: "???"
Line 57:
Line 58: pdf.Save(Response)
Line 59: Response.End()
Line 60:

[ApplicationException: Resource category ‘FontAFM’ not found.]
Aspose.Pdf.PdfText.Z4.C27(A4 textWriter, String category, String resourcename, Boolean loadxml)
Aspose.Pdf.PdfText.X4.A25(A4 textWriter, String fontName, String encoding, Int32 embed, Boolean isBold, Boolean isItalic, String truetypeFileName, Boolean isUnicode)
Aspose.Pdf.PdfText.A4.g0(String editionName, String licenseName, String fontName, String encoding, Int32 embed, Boolean isBold, Boolean isItalic, String truetypeFileName, Boolean isUnicode)
Aspose.Pdf.Xml.h7.A35(Pdf doc, Section currentPart, Table table, Row row, Cell cell, Text text, String content, AssignInfo assignInfo, Z7 useType)
Aspose.Pdf.Xml.n7.B41(Pdf doc, Section currentPart, Table table, Row row, Cell cell, Text text, AssignInfo assignInfo, Z7 useType, Boolean isFirst)
Aspose.Pdf.Xml.e7.B32(Pdf doc, Section section, AssignInfo assignInfo)
Aspose.Pdf.Xml.I7.A8(Pdf doc)
Aspose.Pdf.Xml.K7.C12(G6 gen, Pdf doc)
Aspose.Pdf.Pdf.Save(HttpResponse response)
Aspose.Pdf.Demos.VisualBasic.ChineseExample.Page_Load(Object sender, EventArgs e) in C:\Program Files\Aspose\Aspose.Pdf\Demos\Aspose.Pdf.Demos.VisualBasic\ChineseExample.aspx.vb:58
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731


Thanks,
Kimmomo

Dear Kimmomo,

Thanks for your consideration.

Please make sure the needed truetype font is installed on your system(in the system’s font directory) and the ‘TruetypeFontFileName’ property in xml is set to right font file. If it still can’t work, replace the chinese words with your own words.

Hi Tommy,

I have replaced the word with own traditional chinese words, and my system has the “c:\winnt\fonts\mingliu.ttc” installed, but I still got the same error.
Could that be any other reason? I am using the VB sample, so no need to change the xml file. Right?

ChineseExample.aspx.vb
-----------------------------
Imports Aspose.Pdf

Public Class ChineseExample
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pdf As Pdf = New Pdf()

Dim section As Section = New Section(pdf)
pdf.Sections.Add(section)

Dim text1 As Text = New Text(section)
text1.IsAlignedByWord = False
text1.FirstLineIndent = 4
section.Paragraphs.Add(text1)

Dim segment1 As Segment = New Segment(text1)
text1.Segments.Add(segment1)
segment1.TextInfo.FontName = “???”
segment1.TextInfo.IsUnicode = True
segment1.TextInfo.TruetypeFontFileName = “c:/winnt/fonts/mingliu.ttc”
segment1.Content = “? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ; ? ?”

Dim text2 As Text = New Text(section)
text2.IsAlignedByWord = False
text2.FirstLineIndent = 4
text2.Margin.Top = 30
section.Paragraphs.Add(text2)

Dim segment2 As Segment = New Segment(text2)
text2.Segments.Add(segment2)
segment2.TextInfo.FontName = “???”
segment2.TextInfo.IsUnicode = True
segment2.TextInfo.TruetypeFontFileName = “c:/winnt/fonts/mingliu.ttc”
segment2.Content = “? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ; ? ?”

pdf.Save(Response)
Response.End()

End Sub

End Class


Error:
-------
Resource category ‘FontAFM’ not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ApplicationException: Resource category ‘FontAFM’ not found.

Source Error:


Line 50: segment2.Content = "? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? , ? ? ? ? ? ? ? ? ? ? ; ? ?"
Line 51:
Line 52: pdf.Save(Response)
Line 53: Response.End()
Line 54:


Source File: C:\Program Files\Aspose\Aspose.Pdf\Demos\Aspose.Pdf.Demos.VisualBasic\ChineseExample.aspx.vb Line: 52

Stack Trace:


[ApplicationException: Resource category ‘FontAFM’ not found.]
Aspose.Pdf.PdfText.Z4.C27(A4 textWriter, String category, String resourcename, Boolean loadxml)
Aspose.Pdf.PdfText.X4.A25(A4 textWriter, String fontName, String encoding, Int32 embed, Boolean isBold, Boolean isItalic, String truetypeFileName, Boolean isUnicode)
Aspose.Pdf.PdfText.A4.g0(String editionName, String licenseName, String fontName, String encoding, Int32 embed, Boolean isBold, Boolean isItalic, String truetypeFileName, Boolean isUnicode)
Aspose.Pdf.Xml.h7.A35(Pdf doc, Section currentPart, Table table, Row row, Cell cell, Text text, String content, AssignInfo assignInfo, Z7 useType)
Aspose.Pdf.Xml.n7.B41(Pdf doc, Section currentPart, Table table, Row row, Cell cell, Text text, AssignInfo assignInfo, Z7 useType, Boolean isFirst)
Aspose.Pdf.Xml.e7.B32(Pdf doc, Section section, AssignInfo assignInfo)
Aspose.Pdf.Xml.I7.A8(Pdf doc)
Aspose.Pdf.Xml.K7.C12(G6 gen, Pdf doc)
Aspose.Pdf.Pdf.Save(HttpResponse response)
Aspose.Pdf.Demos.VisualBasic.ChineseExample.Page_Load(Object sender, EventArgs e) in C:\Program Files\Aspose\Aspose.Pdf\Demos\Aspose.Pdf.Demos.VisualBasic\ChineseExample.aspx.vb:52
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731



Dear Kimmomo,

Thanks for your consideration.

There are two reasons.

1) The font name. Double click the font file mingliu.ttc, you can find the font name on the second line. The name is “MingLiU” on my system.

2) ttc files are truetype font collection files, that means there are more than one font in the file. So you should decide which font to use. If you want to use the first font, you should use “c:/winnt/fonts/mingliu.ttc,0” as TruetypeFontFileName.


I have changed the font name and font file name in your code and it worked well on my system.

Quick Question…

I am using Chinese Acrobat Reader, should I use English Version one?


Thanks,
Kimmomo

Dear Kimmomo,

Thanks for your consideration.

No,Not necessary. I have tested chinese language using chinese Acrobat and it worked well.

Hi Tommy,

Great! It works perfectly in my system now.

Thanks so much for your quick response and solution!

Looking forward to confirming it is the right product for us.

Cheers,
Kimmomo