I have downloaded and tried your latest version but it still cannot render chinese characters. Does your software support this?
I have attached a file and you will see the images are ok as these are built first in .net then added but no chinese text appears.
Hi Martin,
Thanks for using our products.
In order to display Chinese (Non-English) characters in the resultant PDF file, try using the font which supports these characters during the PDF generation process. Please take a look at the following code snippet which I have used to generate a PDF document using Aspose.Pdf for .NET 7.2.0 and as per my observations, the resultant file shows the Chinese text. For your reference, I have also enclosed the resultant PDF file.
[C#]
// Instantiate Pdf instance by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
// Create section object and add it to sections collection of PDF
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// Create a text object
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text();
// Add text object to paragraphs collection of section
sec1.Paragraphs.Add(text1);
// Add sample text to segments collection of text object
text1.Segments.Add("This is a test for Chinese language 漢字 汉字 方彝");
// Specify the font for Text object
text1.TextInfo.FontName = "Arial Unicode MS";
// Include the subset of font in resultant PDF
pdf1.SetUnicode();
// Create the result PDF Document
pdf1.Save("d:/pdftest/ChineseText.pdf");
Thanks. That worked on my pc but when I tried it on the web server it did not work. Initially the font was not installed so I installed the font on the server and it still does not render Chinese text. Any ideas?
Hi Martin,
The server is Windows 2003.
Hi Martin,
Hi,
Any update on this yet? I have logged in as our client who has renewed their subscription adn are keen to resolve this. I tried the test project which has the latest dll and that worked but when I use the same dll in the client’s project I get this error:
Font ‘Arial Unicode MS’ not found. Please make sure the customer font file is correctly set.
It is installed otherwise the test project you sent would fail. Any ideas? The client has paid a lot of money to purchase your software and it still does not work!
Regards,
Martin
Hi Martin,
Sorry for a delayed response. I have setup Windows Server 2003 with .NET Framework 2.0 and as per my findings the code shared by Nayyer works fine with Aspose.Pdf for .NET v7.3. Actually, the issue is caused if I don’t have “Arial Unicode MS” installed on the machine. Also, as per my observation, I don’t get any error message even if the font is not installed. The PDF file does not show the Chinese characters in that case.
Please share your test application which you are running on Windows Server 2003 and let me know the .NET Framework version you are using. Also, please make sure that “Arial Unicode MS” is installed on your windows server 2003 (under C:\WINDOWS\Fonts). Please do let us know in case you still face any issue.
Sorry for the inconvenience,
I managed to get around the issue by removing the following 2 lines of code when rendering Chinese text:
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = Path.GetTempPath();
Not sure what these two lines are for.
It’s also worth noting that you have to specify the following (which was not available in the previous dll we had):
pdf.SetUnicode();
fingo:
I managed to get around the issue by removing the following 2 lines of code when rendering Chinese text:
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = Path.GetTempPath();
Not sure what these two lines are for.
pdf.TruetypeFontMapPath = “.”; code line. When using these code lines, please make sure you have access privileges to the path specified against TruetypeFontMapPath statement or set IsTruetypeFontMapCached to false to disable this function.
fingo:
It’s also worth noting that you have to specify the following (which was not available in the previous dll we had):
pdf.SetUnicode();