Export to PDF have problem with polish chars

4 posts, 0 answers
  1. Janusz
    Janusz avatar
    20 posts
    Member since:
    Jul 2012

    Posted 23 Jan 2015 Link to this post

    From the version 2014.3.1119 we have got export to PDF.  This feature is really nice, but I cannot find a way to correctly display polish charactes in PDF. Probably in other languages it will be the same. Export to Excel from then same place works fine. I've tried on your demo (Kendo.Mvc.Demo) changing unit pdf_export.cshtml. below is the changed code and the screens.
    [code]@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.EmployeeViewModel>()
    .Name("grid")
    .HtmlAttributes(new { style = "width: 900px; font-family: Arial Unicode MS" })
    .Columns(columns =>
    {
    columns.Bound(e => e.EmployeeID).Width(140).Title("Zdjęcie");
    columns.Bound(e => e.Title).Width(400).Title("Szczegóły");
    ............................
    .ToolBar(tools => tools.Pdf())
    .Pdf(pdf => pdf
    .FileName("Kendo UI Grid Export.pdf")
    .ProxyURL(Url.Action("Pdf_Export_Save", "Grid"))
    )
    .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("Pdf_Export_Read", "Grid"))
    )
    ..............................[/code]
    Controler I've reminded unchanged. In webbrowse as well as in PDF Complete (and other pdf viewers) the polish characters are display wrong. Export to XLS  is OK. Is it possible in MVC to change default font name only for export to PDF.

  2. Janusz
    Janusz avatar
    20 posts
    Member since:
    Jul 2012

    Posted 23 Jan 2015 in reply to Janusz Link to this post

    Meanwhile I've found a solution. 
    ...............................
    <script>
        kendo.pdf.defineFont({
            "Verdana": "@Url.Content("~/Content/fonts/verdana.ttf")",
            "Verdana|Bold": "@Url.Content("~/Content/fonts/verdanab.ttf")",
            "Verdana|Bold|Italic": "@Url.Content("~/Content/fonts/verdanaz.ttf")",
            "Verdana|Italic": "@Url.Content("~/Content/fonts/verdanai.ttf")"
        });
    </script>
    ..........................
  3. Janusz
    Janusz avatar
    20 posts
    Member since:
    Jul 2012

    Posted 23 Jan 2015 in reply to Janusz Link to this post

    Second solution is using CSS attribute @font-face like below.
    ...................
    @font-face {
        font-family: "Segoe UI";
        src: url("fonts/segoeui.ttf") format("truetype");
    }

    @font-face {
        font-family: "Segoe UI";
        src: url("fonts/segoeuib.ttf") format("truetype");
        font-weight: bold;
    }

    @font-face {
        font-family: "Segoe UI";
        src: url("fonts/segoeuii.ttf") format("truetype");
        font-style: italic;
    }

    @font-face {
        font-family: "Segoe UI";
        src: url("fonts/segoeuiz.ttf") format("truetype");
        font-weight: bold;
        font-style: italic;
    }
    ................
    And ensure that kendo grid uses the proper font.
    ...............
        .k-grid {
            font-family: "Segoe UI", "Arial", sans-serif;
        }
    ...............
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 26 Jan 2015 Link to this post

    Hello Janusz,

    Yes, this is viable solution. The same is explained here as well:

    http://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom#custom-fonts-and-pdf

    Regards,
    Kiril Nikolov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top