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

PDF Export issue

6 Answers 90 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Xavier
Top achievements
Rank 1
Xavier asked on 17 May 2017, 09:53 AM

hello,

Recently I updated my Kendo version from 2014 to 2017 r2

I try to implemented the pdf export on my Scheduler but when I click on export I got a blank pdf file.

I have a view with style and script: 

<style>
    /*
        Use the DejaVu Sans font for display and embedding in the PDF file.
        The standard PDF fonts have no support for Unicode characters.
    */
    .k-scheduler {
        font-family: "DejaVu Sans", "Arial", sans-serif;
    }
 
    /* Hide toolbar, navigation and footer during export */
    .k-pdf-export .k-scheduler-toolbar,
    .k-pdf-export .k-scheduler-navigation .k-nav-today,
    .k-pdf-export .k-scheduler-navigation .k-nav-prev,
    .k-pdf-export .k-scheduler-navigation .k-nav-next,
    .k-pdf-export .k-scheduler-footer {
        display: none;
    }
</style>
 
<script src="@Url.Content("~/Scripts/pako.min.js")"></script>
 
<h1 class="titrePlanning">Planning Electro</h1>
@Html.Partial("ControlPanel")
<div class="wrapper">
    <div id="divScheduler">
        @(Html.Kendo().Scheduler<Ubaldi.Logisttique.PlanningRDV.Web.Controllers.EventViewModel>()
        .Name("scheduler")
        .DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd/MM')#</span>")
        .Selectable(false)
        .Timezone("Etc/UTC")
        .Width(1200)
         .Pdf(pdf => pdf
            .FileName("Export_PlanningRDV.pdf")
            .ProxyURL(Url.Action("Pdf_Export_Save", "Scheduler"))
    )
    .Toolbar(t => t.Pdf())

 

- I also imported Deja Vus font in \Content\fonts\DejaVu

In my contoller:

public ActionResult Pdf_Export_Save(string contentType, string base64, string fileName)
{
    var fileContents = Convert.FromBase64String(base64);
 
    return File(fileContents, contentType, fileName);
}

 

I try with and without ProxyUrl and I'm getting the same issue.Do I miss something ?

6 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 19 May 2017, 08:25 AM

Hello Xavier,

I used the exact same configuration, but I am afraid I did not manage to reproduce the issue.

In the attached file (TelerikMvcAppPdfExport.zip) you will find a working example, which correctly exports the data from the Scheduler. Can you confirm that this is working correctly on your end?

In case you are not having the same problem with the above example, may I ask you to provide additional details and update the attached project, so we could be able to locally replicate the issue and pin down the reason for it? 

I am looking forward to your reply.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Xavier
Top achievements
Rank 1
answered on 12 Jun 2017, 03:35 PM
Hello Dimitar,

Your example is working as expected.
But I didn't find any difference between your code and mine.

So I don't know what to provide ...
0
Dimitar
Telerik team
answered on 14 Jun 2017, 09:04 AM
Hello Xavier,

Try to isolate the issue by removing the third-party scripts that are running on the Scheduler view. This way you will be able to determine if there are any existing conflicts with other libraries.

In addition to the above, try removing any custom styles and fonts which are applied on the Scheduler. 

In case the problem continues to persist I would suggest you to send us an isolated sample project (replace all data dependencies with mocked data), that reproduces the issue. If the sample contains sensitive data/implementation you could open a new support ticket in our ticketing system. There we can continue our communication and decide what is the best approach to resolve the issue.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Xavier
Top achievements
Rank 1
answered on 20 Jun 2017, 07:54 AM

Dimitar,

I finally found the issue. It was just a problem with my scheduler name.

Thank you for your time and effort

0
Xavier
Top achievements
Rank 1
answered on 20 Jun 2017, 08:03 AM
Ij ust have another question,

Is it possible to use a different button instead of thr toolbar ?

I tried something like this, in a partial view called in my scheduler view.
<a href="@Url.Action("Pdf_Export_Save", "Scheduler")" class="btn btn-primary" data-toggle="tooltip" data-placement="bottom" title="export">
    <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
</a>

 

The method in my controller have an issue because I'm missing the file. There is a way to bypass the problem ?

0
Dimitar
Telerik team
answered on 21 Jun 2017, 01:33 PM
Hello Xavier,

You can achieve this by using the Scheduler's saveAsPdf() method as follows:
$("#export").click(function(e) {
  var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.saveAsPDF();
});

I am also attaching a modified version of the MVC project where the above is also demonstrated.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Xavier
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Xavier
Top achievements
Rank 1
Share this question
or