OrgChart export to pdf special characters

8 posts, 0 answers
  1. Jan
    Jan avatar
    45 posts
    Member since:
    Oct 2007

    Posted 11 Aug Link to this post

    Hello,

    I have an OrgChart and a couple of labels and an image that I want to export to PDF using the RadClientExportManager.
    Code .aspx: 

    table id="exporttopdf">
        <tr>
            <td>
     
                <asp:image runat="server" imageurl="~/styles/images/logo.png" />
                <asp:panel runat="server" id="Panel1" visible="false">
                                <span class="content">
                                    GRUPP: <asp:Label runat="server" ID="Label1"></asp:Label><br />
                                    DATUM: <asp:Label runat="server" ID="Label2"></asp:Label>
                                </span>
                            </asp:panel>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadOrgChart ID="RadOrgChart2" runat="server" GroupColumnCount="1" DisableDefaultImage="true">
                    <GroupEnabledBinding>
                        <NodeBindingSettings DataFieldID="ID" DataFieldParentID="ParentID" />
                        <GroupItemBindingSettings DataFieldNodeID="NodeID" DataFieldID="ID" DataTextField="Text" />
                    </GroupEnabledBinding>
                </telerik:RadOrgChart>
            </td>
        </tr>
    </table>

    However my swedish special characters doesn't show properly in the PDF.
    I've been using this demo http://docs.telerik.com/devtools/aspnet-ajax/controls/clientexportmanager/how-to/exporting-special-characters
    and it works as expected.

    What do I need to do to get it to work with the orgChart?

    Any suggestions appreciated

    Regards

    Janne

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 16 Aug Link to this post

    Hi Jan,

    As it is explained in the Documentation article mentioned, you will have to load a Unicode font to the RadClientExportManager control:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadClientExportManager1.PdfSettings.Fonts.Add("Arial Unicode MS", "Fonts/ArialUnicodeMS.ttf");
    }

    and to assign the same font to be the font for the exported content:
    #exporttopdf {
        font-family: 'Arial Unicode MS';
    }

    Keep in mind that you may also have to first import the font to your CSS.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jan
    Jan avatar
    45 posts
    Member since:
    Oct 2007

    Posted 16 Aug in reply to Veselin Tsvetanov Link to this post

    Hello Vaselin,

    Thank you for your reply. I have done what you suggest. To verify that I included a <div> vid some swdish characters in the <table> I export and they come out ok but not the special characters in the OrgChart. Do you have a working sample?

    Best regards

    Jan

    #exporttopdf{
       font-family:'ARIALN';
    }

     

    <script type="text/javascript">
          function exportElement() {
               var exp = $find("RadClientExportManager1");
               exp.exportPDF($telerik.$("#exporttopdf"));
          }
    </script>

    <table id="exporttopdf">
        <tr>
            <td>
                <div>åäöÅÄÖ</div>
                <asp:image runat="server" imageurl="~/styles/images/logo.png" />
                <asp:panel runat="server" id="Panel1" visible="false">
                                <span class="content">
                                    GRUPP: <asp:Label runat="server" ID="Label1"></asp:Label><br />
                                    DATUM: <asp:Label runat="server" ID="Label2"></asp:Label>
                                </span>
                            </asp:panel>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadOrgChart ID="RadOrgChart2" runat="server" GroupColumnCount="1" DisableDefaultImage="true">
                    <GroupEnabledBinding>
                        <NodeBindingSettings DataFieldID="ID" DataFieldParentID="ParentID" />
                        <GroupItemBindingSettings DataFieldNodeID="NodeID" DataFieldID="ID" DataTextField="Text" />
                    </GroupEnabledBinding>
                </telerik:RadOrgChart>
            </td>
        </tr>
    </table>
  5. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 16 Aug Link to this post

    Hello Jan,

    Attached you will find the sample. In order to make the export functionality work properly, I had to specify the same font-family for the RadOrgChart too:
    #exporttopdf,
    html .RadOrgChart {
        font-family: 'ARIALN';
    }

    Please excuse me for the missing selector in my previous reply.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. Jan
    Jan avatar
    45 posts
    Member since:
    Oct 2007

    Posted 17 Aug in reply to Veselin Tsvetanov Link to this post

    Hello Vaselin,

    Thank you, your code sample works fine when I try it on my end too. However when I replace your OrgChart with my databound one it doesn't work and I haven't been able to reproduce my problem in a sample solution. I'll work on that and get back to you if and when I do!

    Best regards
    Jan

  7. Thomas
    Thomas avatar
    1 posts
    Member since:
    Nov 2016

    Posted 25 Nov in reply to Jan Link to this post

    Hey Jan,

    Did you find a solution for this issue when exporting with a databound control?
    In our browser the name ("Decaluwé") is displayed as it should be but in the PDF the "é" has been changed to an unknown character...

    Kind regards,
    Thomas

  8. Jan
    Jan avatar
    45 posts
    Member since:
    Oct 2007

    Posted 28 Nov in reply to Thomas Link to this post

    Hello Thomas,

    I'm afraid I haven't. But let's share it here if any of us find a solution!

    Thanks

    Jan

  9. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 4 days and 2 hours ago Link to this post

    Hi Jan, hi Thomas,

    I have tested the discussed scenario with a databound RadOrgChart, but I was not able to reproduce the issue observed. It seems, that there are some differences in the implementation I am testing with.

    As I mentioned, my best suggestion is to isolated the issue in a runnable sample, which you could submit in a Support ticket. This way we will have the full information needed to troubleshoot the problem.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017