Free Support Forum - aspose.com

Missing chinese characters when writing text into a PDF

Can anyone please suggest me a way to store the chinese characters into the PDF without missing any characters?


I am currently using this code snippet to acheive that one

TextInfo ti = new TextInfo();
ti.FontName=“Arial Unicode MS”;
ti.IsTrueTypeFontBold = true;
Text resumeText = new Text(ResumeText,ti);
resumeText.IsHtmlTagSupported = true;
ResumeTextSection.Paragraphs.Add(resumeText);
pdf.SetUnicode();
pdf.Save(finalpdfpath);

Help on this is higly appreciatable.

Hi Yashwanth,<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as <span style=“font-family:“Arial”,“sans-serif””>PDFNEWNET-33952. We
will investigate this issue in details and will keep you updated on the status
of a correction.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””><span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

We
apologize for your inconvenience.


Hi Yashwanth,


Thanks for your patience.

In order to resolve your problem, please try calling pdf.SetUnicode(); before saving the PDF file. For your reference, I have also attached the resultant PDF file which I have generated with below code snippet.

[C#]

// Instantiate an object PDF class<o:p></o:p>

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Section sec = pdf.Sections.Add();

Text text = new Text("Sample Chinese text 汉字/漢字 ( / )");

text.TextInfo.IsTrueTypeFontBold = true;

text.TextInfo.FontName = "Arial Unicode MS";

text.TextInfo.FontSize = 10F;

text.Margin.Bottom = 16F;

sec.Paragraphs.Add(text);

// subset the true type font which supports Uicode characters

pdf.SetUnicode();

pdf.Save(“c:/pdftest/Chinese_Characters.pdf”);

The issues you have found earlier (filed as PDFNEWNET-33952) have been fixed in Aspose.Pdf for .NET 7.7.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.