Reputation: 2428
I am using the built in functionality of KendoUi Grid to export the grid data in pdf http://demos.telerik.com/kendo-ui/grid/pdf-export. It is working properly when data language is English. But when data language is right to left such as persian or arabic, in pdf export show letters separately and contrariwise. for example show "مان" instead of "نام". How can Solve it. My Code:
@(Html.Kendo().Grid<MyModel>()
.Name("GridName")
.ToolBar(toolbar =>
{
toolbar.Pdf().Text(" ").HtmlAttributes(new { @class = "excel-pdf-btn fa fa-file-pdf" });
})
.Pdf(pdf => pdf.AllPages().FileName("MyFileName.pdf").PaperSize("A4").ProxyURL(Url.Action("Pdf_Export_Save", "Grid")))
.Columns(columns =>
{
columns.Bound(t=> t.Id).Visible(false);
columns.Bound(t => t.Name).Title("نام");
.DataSource(t => t
.Ajax()
.Model(m => m.Id(i => i.Id))
.PageSize(15)
.Read(r => r.Action("FillGrid", "MyController"))
)
)
Update: I embed ttf font. but problem not solved.
<script>
kendo.pdf.defineFont({
'serif': 'MyFont',
'serif|bold': 'MyFont',
'serif|italic': 'MyFont',
'serif|bold|italic': 'MyFont',
'sans-serif': 'MyFont',
'sans-serif|bold': 'MyFont',
'sans-serif|italic': 'MyFont',
'sans-serif|bold|italic': 'MyFont',
'monospace': 'MyFont',
'monospace|bold': 'MyFont',
'monospace|italic': 'MyFont',
'monospace|bold|italic': 'MyFont',
"MyFont" : "@Url.Content("~/Content/fonts/MyFont.ttf")"
});
</script>
Upvotes: 3
Views: 1400
Reputation: 2168
Unfortunately - according to this: https://feedback.telerik.com/kendo-jquery-ui/1359291-add-right-to-left-pdf-support it doesn't look like it is supported in the PDF export as of yet.
There are some possible options listed here - no idea if they work though. Export to PDF using Kendo UI (issue with RTL languages)
Upvotes: 2