PDF Export issue

7 posts, 0 answers
  1. Xavier
    Xavier avatar
    4 posts
    Member since:
    May 2017

    Posted 17 May Link to this post

    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 ?

  2. Dimitar
    Admin
    Dimitar avatar
    134 posts

    Posted 19 May Link to this post

    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 visualization (charts) and form elements.
  3. Xavier
    Xavier avatar
    4 posts
    Member since:
    May 2017

    Posted 12 Jun in reply to Dimitar Link to this post

    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 ...
  4. Dimitar
    Admin
    Dimitar avatar
    134 posts

    Posted 14 Jun Link to this post

    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.
  5. Xavier
    Xavier avatar
    4 posts
    Member since:
    May 2017

    Posted 20 Jun in reply to Dimitar Link to this post

    Dimitar,

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

    Thank you for your time and effort

  6. Xavier
    Xavier avatar
    4 posts
    Member since:
    May 2017

    Posted 20 Jun in reply to Xavier Link to this post

    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 ?

  7. Dimitar
    Admin
    Dimitar avatar
    134 posts

    Posted 21 Jun Link to this post

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