Free Support Forum - aspose.com

Special characters in PDF

Hi,

I am generating a PDF with aspose object model, in some places i recive some special charaters that are part of a name of a user.

when I generate the pdf from aspose i cant see those characters.

for example the name: ÀàÁÂÃÄÇŧŤţŢťṫMI, in the pdf I see: ÀàÁÂÃÄÇ MI, as you see there is a space between the Ç and M the special characters are ŧŤţŢťṫ.

Aspose dll suport that characters?

Thanks in advice for you Help

Hi Mauricio,


Thanks for using our products.

When using Aspose.Pdf for .NET, please try using the font which supports the special characters and embed the font when saving the document. For further information, please visit Fonts embedding while creating PDF

In case you still face the same problem, please share the code snippet so that we can test the scenario at our end. We are sorry for this inconvenience.

Hi Nayyer,

I’ve tried with the TextInfo.IsUnicode = true, it work partially now in the pdf i see this: ÀàÁÂÃÄÇŤť MI
remember that my Original text is in a web form, and the value is ÀàÁÂÃÄÇŧŤţŢťṫMI

This is my code:

TableLabelText lblName = new TableLabelText("User Name: ");
TableContentText value = new TableContentText("ÀàÁÂÃÄÇŧŤţŢťṫMI ");
value.TextInfo.IsUnicode = true;
this.AddCell(row, lblName, vale);

public Cell AddCell(Row row, TableLabelText label, TableContentText value)
{
Cell newCell = row.Cells.Add();
Text txt = new Text();
txt.Segments.Add(label);
txt.Segments.Add(value);
newCell.Paragraphs.Add(txt);
return newCell
}
Thanks in advice.

Mauricio

Hi All, I have the same issue, any solution about this?

Regards,

Hi Mauricio,


Thanks for sharing the details and sorry for the delayed response.

I have tested the scenario using following code snippet while using Aspose.Pdf for .NET 7.6.0 over Windows 7(X64) in VisualStudio 2010 application and I am unable to notice any issue. The resultant PDF file is properly showing the string in table cell.

For your reference, I have also attached the resultant PDF file which I have generated.

[C#]

Pdf pdf = new Pdf();<o:p></o:p>

Section sec = pdf.Sections.Add();

Segment lblName = new Segment("User Name: ");

Segment value = new Segment("ÀàÁÂÃÄÇŧŤţŢťṫMI ");

value.TextInfo.IsUnicode = true;

Aspose.Pdf.Generator.Table table1 = new Aspose.Pdf.Generator.Table();

//Set with column widths of the table

table1.ColumnWidths = "200 50 50";

//Set default cell border using BorderInfo object

table1.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 0.1F);

//Set table border using another customized BorderInfo object

table1.Border = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 1F);

Aspose.Pdf.Generator.Row row = table1.Rows.Add();

row.FixedRowHeight = 35;

Aspose.Pdf.Generator.Cell newCell = row.Cells.Add();

newCell.VerticalAlignment = Aspose.Pdf.Generator.VerticalAlignmentType.Center;

Text txt = new Text(sec);

txt.Segments.Add(lblName);

txt.Segments.Add(value);

newCell.Paragraphs.Add(txt);

sec.Paragraphs.Add(table1);

// include the subset of true type font in PDF file

pdf.SetUnicode();

pdf.Save("C:/PDFTEST/UnicodeCharacters.pdf");