We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to embed unicode characters

I’ve been converting our code from the older Generator namespace to DOM.

One of my problems is that it doesn’t appear to support embedding unicode characters any longer, i.e.:

    public static string CHECKBOX_UNCHECKED = "#$UNICODE(9744)";
    public static string CHECKBOX_CHECKED = "#$UNICODE(9745)";

            string checkBoxText = string.Empty;
            if (Checked == true)
                checkBoxText = CHECKBOX_CHECKED + FieldValueText;
                checkBoxText = CHECKBOX_UNCHECKED + FieldValueText;

            Cell cell21 = row22.Cells.Add(checkBoxText);

Instead of showing a checkbox, the unicode text is displayed instead. Is this a bug, or is there an alternate way now?

Thanks for your assistance.

The new DOM approach does not support all Replaceable symbols from legacy Aspose.Pdf for .NET, except $p and $P. We have logged an enhancement to add support of Unicode characters under the ticket ID PDFNET-43217 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Best Regards,
Imran Rafique


We would like to inform you that your issue has been resolved. You can add unicode symbols in the input string using .NET/C# string escaped sequences:

// Load source PDF document
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Aspose.Pdf.Page pdfPage = doc.Pages.Add();

// Initializes a new instance of the Table
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
// Set the table border color as LightGray
table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));
// Set the border for table cells
table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));

// Add row to table
Aspose.Pdf.Row row = table.Rows.Add();
// Add table cells
row.Cells.Add("page $p of $P \u25A1"); //White Square U+25A1 HTML:&#9633 

// Add table object to first page of input document

// Save updated document containing table object
doc.Save(dataDir + @"AddTable_out.pdf"); 

Please try above code snippet with Aspose.PDF for .NET 20.1 and in case you need further assistance, please feel free to let us know.