Hello All,
I am unable to print Unicode characters(chinese) in the Crystal report (.rpt) once loaded in page using asp.net(.aspx).
Using below code its working for Non-unicode characters , but not working for Unicode characters and even I updated crystal report(.rpt) to font setting to Arial Unicode from the report end.
My code converting to PDF :
cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"\\**********\**\**\" + TextBox1.Text + "");
FileInfo fileinfo = new FileInfo(@"\\**********\**\**\" + TextBox1.Text + "");
Response.AddHeader("Content-Disposition", "inline;filenam=demo.pdf");
Response.ContentType = "application/pdf";
Response.WriteFile(fileinfo.FullName);Suggest any thing need to update this code to work on Unicode characthers to dispaly in the report.
Currently I am getting square boxes in the Unicode code using above code.
Please help in this to fix this issue.

Tuhin PaulRank #7 · 71.9K reputationPosted Mar 15, 2023, 9:18 PM EDT
Hello Anand,
The issue is with printing Unicode characters in Crystal report through ASP.NET.
To print Unicode characters in the Crystal report, you need to make sure that the appropriate font is installed on your system and that the font is specified in the Crystal report. Arial Unicode MS is a font that supports Unicode characters, but you need to make sure that it is installed on the system where the report is being generated and rendered. In your code, you are exporting the Crystal report to a PDF file and then displaying it in the browser. To ensure that the Unicode characters are displayed correctly, you can try setting the font of the exported PDF document to Arial Unicode MS. modify your code:
cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"\\**********\**\**\" + TextBox1.Text + ""); // Load the exported PDF document into a PdfDocument object PdfDocument pdfDoc = new PdfDocument(new PdfReader(@"\\**********\**\**\" + TextBox1.Text + "")); // Get the default font PdfFont defaultFont = PdfFontFactory.CreateFont(); // Get the Arial Unicode MS font PdfFont unicodeFont = PdfFontFactory.CreateFont("C:/Windows/Fonts/arialuni.ttf", PdfEncodings.IDENTITY_H); // Loop through all pages in the PDF document for (int i = 1; i fields = form.GetFormFields(); foreach (PdfFormField field in fields) { field.SetFont(unicodeFont); } } // Write the modified PDF document to the response stream MemoryStream ms = new MemoryStream(); pdfDoc.Save(ms); Response.ContentType = "application/pdf"; Response.BinaryWrite(ms.ToArray()); Response.End();we are using iTextSharp library to load the exported PDF document and then set the font of the page to Arial Unicode MS. We are also replacing the default font with Arial Unicode MS for all text and form fields in the PDF document.
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 16, 2023, 1:16 AM EDT
Hello Anand,
Please refer this one,
https://social.msdn.microsoft.com/Forums/en-US/d8ba426a-8086-4eb2-8d5f-fd710fd305df/showing-unicode-characters-in-crystal-report?forum=aspcrystalreports
anand mRank #4,053 · 369 reputationPosted Mar 16, 2023, 4:16 AM EDT
Hello Paul,
I am unable to get few of attributes on your code and I am using below itextsharp class version for this i am not getting few of issues
currently i am using Vs.net 2015
PdfDocument pdfDoc = new PdfDocument(new PdfReader(@"\\**********\**\**\" + TextBox1.Text + "")); (in this code PDFdocument is not getting constructor to declare here).
Please let me know which Itextsharp version to declare to gett all yourr code work.
itextsharp, Version=5.5.13.3(i am using this version).
Thanks for your help.