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

2 posts, 0 answers
  1. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 25 Sep 2013 Link to this post

    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.
  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 30 Sep 2013 Link to this post

    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."
        <Pdf DefaultFontFamily="Arial Unicode MS" />

    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.
Back to Top