Chinese character not displaying in PDF.net version 3.3.2.0

Hello,

I found the article below saying that version 1.3 supports Chinese characters. I am using 3.3.2.0 and the Chinese character still not displaying in the PDFs - they are just blank spaces in the PDFs.

https://forum.aspose.com/t/138114

Can you please show me how to fix this problem?

Hello Susan,

Thanks for using our products.

Can you please share the code snippet/sample project, so that we can test the scenario at our end. We apologize for your inconvenience.

OK. below is my code. This same code works fine in English. It would be greatly appreciated if you can show me how to fix my problem!

protected void DownloadInvoiceToPDF(string SaveAsFileName)
{
string _SaveAsFileName = SaveAsFileName + ".pdf";
Pdf pdf1 = new Pdf();
pdf1.PageSetup.Margin.Top = 1;
pdf1.PageSetup.Margin.Left = 5;
pdf1.Creator = Resources.ResourceBillPDF.BillPDF_Author;
pdf1.Author = Resources.ResourceBillPDF.BillPDF_Author;

//=============section Note==================================
Section sectionNote = pdf1.Sections.Add();
sectionNote.TextInfo.FontName = "Arial Unicode MS";

sectionNote.IsNewPage = false;
sectionNote.PageInfo.Margin.Left = 10;
sectionNote.PageInfo.Margin.Top = 10;
string strNote = Resources.ResourceBillPDF.BillPDF_Notepay;
Text txtNote = Bill.PdfFunctions.AddStringToPDFTextObject(strNote, "", true);
sectionNote.Paragraphs.Add(txtNote);

//=============Save the Pdf ===============================
pdf1.IsPageNumberForDocument = true;
pdf1.Title = Resources.ResourceBillPDF.BillPDF_PDFTitle;
// pdf1.Save(_SaveAsFileName, Aspose.Pdf.SaveType.OpenInAcrobat, this.Response);
//Saves file to memory
MemoryStream stream = new MemoryStream();

pdf1.Save(stream);

//download PDF
this.TransmitToResponseObject(stream, _SaveAsFileName, TransmitFileType.PDF);
}

Hi,

Is there any update on this issue?

Hi Susan,

Thanks for using our products.

In order to display the Chinese characters properly, please specify the FontName information for the text object i.e. txtNote.TextInfo.FontName = "Arial Unicode MS";.

I have tested the scenario with a sample string Text txtNote = new Text("草书 / 草書 cǎoshū - 楷书 / 楷書 kǎishū - 篆书 / 篆書 zhuànshū"); and as per my observations with Aspose.Pdf for .NET 5.0.0, the Chinese characters are properly being displayed. For your reference, I have attached the resultant PDF that I have generated. Please take a look.

In case you still encounter any issue, please share the source Chinese text that you are using so that we can test that particular scenario at our end. We apologize for your inconvenience.

Thanks for responding to my inquery. As you can see from my original code submitted in my last post, I did set the FontName="Arial Unicode MS". However, I am not using version 5.0.0.

Can you please show me how to fix in version 3.3.2.0? As I mentioned in my first post, the article I found on your forum said it supports Chinese going back to version 1.3. (am I correct with this information??)

For your information, here are some of the Chinese characters I am trying to export to a PDF - 月租费,帐单日期,手机号码

Hi Susan,

Thanks for sharing the information.

The product version that you are using is quite old and currently I can only track version 2.9.2.0 and 3.5.8.7 but I am afraid I don't have that specific release version that you are using. More along, we might not be able to fix this problem in older release. Can you please try using Aspose.Pdf for .NET 5.0.0 and see if it can resolve this problem.

In case you still face any problem or you have any further query, please feel free to contact. We are really sorry for this inconvenience.

Thanks for responding.

Since you can track back to version 2.9.2.0, can you please show me the code to export Chinese characters in version 2.9.2.0 That may help figuring out my problem.

Can you please tell me which was the very first version(version number) of Aspose.PDF that the Chinese characters are supported?

Hi Susan,

I have tested the scenario with Aspose.Pdf for .NET 2.9.2.0 and also with 3.4.0.0 and as per my observations, the Chinese text is not being displayed. I am afraid I am not entirely certain about the exact release version in which Chinese text was supported because, there have been numerous releases since version 3.3.0. As I have shared earlier, when I have tested the scenario using following code snippet with Aspose.Pdf for .NET 5.0.0, Chinese text is properly being displayed.

I would again request you to please try using Aspose.Pdf for .NET 5.0.0 and in case you encounter any problem, please feel free to contact. We will try our level best to get it resolved.

[C#]

Pdf pdf1 = new Pdf();
pdf1.PageSetup.Margin.Top = 1;
pdf1.PageSetup.Margin.Left = 5;
pdf1.Creator = "Resources.ResourceBillPDF.BillPDF_Author";
pdf1.Author = "Resources.ResourceBillPDF.BillPDF_Author";

//=============section Note==================================
Section sectionNote = pdf1.Sections.Add();
sectionNote.IsNewPage = false;
sectionNote.PageInfo.Margin.Left = 10;
sectionNote.PageInfo.Margin.Top = 10;

//string strNote = Resources.ResourceBillPDF.BillPDF_Notepay;
Text txtNote = new Text("月租费,帐单日期,手机号码");
sectionNote.Paragraphs.Add(txtNote);

txtNote.TextInfo.FontName = "Arial Unicode MS";
txtNote.TextInfo.TruetypeFontFileName = @"c:/windows/fonts/ARIALUNI.TTF";
//txtNote.TextInfo.IsFontEmbedded = true;

//embed the font subset inside the PDF document
pdf1.SetUnicode();
//=============Save the Pdf ===============================
pdf1.IsPageNumberForDocument = true;
pdf1.Title = "Resources.ResourceBillPDF.BillPDF_PDFTitle";
//Saves the PDF file
pdf1.Save(@"d:/pdftest/Chinese_Characters_Issue_5.0.0.pdf");

thanks again for your help.

I downloaded the Aspose.PDF 5.0.0 DLL/XML for .Net 4.0 and placed them in the Bin\ directory as you can see in the attached screenshot. Please help. Attached is a screen shot of code used for testing and the error message it threw. Can you please tell me what am I missing here? I am using VS 2010. It would be very helpful if you could send me a sample project in VS2010.

Hello,

Is there any update on this issue? My team is waiting on a soultion for this problem.It would be greately appreciated it if you can get to back to me ASAP.

thanks!

Hi Susan,

Sorry for replying you late.

I am afraid the latest product version is not working in Visual Studio 2010 with .NET Framework 4.0. The issue is already logged in our issue tracking system as PDFNET-23065. Our development team is working hard to get it resolved. Please be patient and spare us little time. As soon as the solution becomes available, we would be more than happy to update you with the status of correction.

We apologize for your inconvenience.

Nayyer,

Thanks for looking into the problem. When do you think the fix will be available?

Can you please notify me once the fix is available?

Hi Susan,

I am afraid currently I am not entirely certain about the dates when the HotFix will become available. However, I have requested the development team to share the ETA regarding its resolution. As soon as I have the requested information, I would be pleased to share the information with you. Please be patient and spare us little time.

You patience and comprehension is greatly appreciated in this regard. We are sorry for your inconvenience.

OK. I await the good news from you.

The issues you have found earlier (filed as 23065) have been fixed in this update.


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