This is a migrated thread and some comments may be shown as answers.

Common approach to remove illegal characters from PDF-prepared grid markup

1 Answer 664 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 25 Sep 2013, 04:52 PM
Hi,
I am curious to know what is the most common approach to remove non-ascii and to encode special characters to make PDF export work properly?

The matter is I have separate processing of client-side and server-side grids: changing text, cutting something with regexp, etc.

So, using
item[column].Text = HttpContext.Current.Server.Encode(item[column].Text)
in dozen of places of ItemDataBound event is not very comfortable. Besides, this Encode method does not help with non-ascii characters, for them I have to use
Regex.Replace(description.ToString(), @"[^\u001F-\u007F]"string.Empty)

I would prefer something like PdfExporting event and replace e.RawHTML. But it's tricky, cause I need to replace cell content,
not HTML tags...

Br-r-r, looks too clumsy.

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 30 Sep 2013, 06:45 AM
Hello Alexander,

I have already answered your support ticket and I will apply the answer here as well if somebody else have a similar requirement.
"Note that RadGrid's Pdf exporting engine supports an Unicode encoding. You could set a font to DefaultFontFamily property which contains all Unicode characters and this way the special characters will be represented into the exported file. Such common international font is Arial Unicode MS."
<ExportSettings>
    <Pdf DefaultFontFamily="Arial Unicode MS" />
</ExportSettings>


Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or