Export scheduler to PDF in new window. MVC5

9 posts, 0 answers
  1. JET
    JET avatar
    19 posts
    Member since:
    Dec 2012

    Posted 08 Jun 2015 Link to this post

    I'm using asp.net mvc 5 but I'm using the html5/js widgets though. I would like to have the scheduler open in PDF format in a new tab. Right now its currently opening a save file dialog to allow the user to download the file. I set the proxyTarget to "_blank" like the documentation says. The documentation also mentions setting the Content-Disposition header field but it doesn't really give much detail on that or give any examples. Can someone explain the full process of getting this to work?

     

    Thanks in advanced. 

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 10 Jun 2015 Link to this post

    Hi JET,

    The proxyTarget defines where to show the result of the used proxy. When the widget supports anchor ​download ​attribute, it will not use proxy service hence it will not honor the proxyTarget option. 

    For the time being, the only way to open the PDF export into another tab is to force the server proxy.

    I will forward this request to our team for further discussion.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. JET
    JET avatar
    19 posts
    Member since:
    Dec 2012

    Posted 12 Jun 2015 in reply to Georgi Krustev Link to this post

    Could someone outline the full process or at least provide a link to example of someone implementing this. I currently have the scheduler set up like this:

      pdf: {
                         fileName: "Calendar.pdf",
                         proxyUrl: "/Schedule/CalenderPdf",
                         proxyTarget: "_blank",
                         forceProxy: true
                     }

    What else do I need to do to get this to work?

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 16 Jun 2015 Link to this post

    Hello JET,

    You can review a working online demo here: In general, the setup you shared is correct and the only reason I can think of that could cause incorrect export is the remote service itself. Could you verify that the service you are using can export PDF file in new window?

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. JET
    JET avatar
    19 posts
    Member since:
    Dec 2012

    Posted 16 Jun 2015 in reply to Georgi Krustev Link to this post

    The service is the part I am the least clear about as the documentation that I have seen so far doesn't go into much detail about the service. Do I have it correct that the service should accept a post that contains the pdf file and then returns that same pdf file? Is a byte array what the widget is expecting?

    Thanks

  7. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 18 Jun 2015 Link to this post

    Hi JET,

    In general, the widget will send the exported value in base64 encoded format. The form data send to the server will have the following structure:
    fileName: [Name of the PDF] (i.e. Kendo UI Scheduler Export.pdf)
    contentType: application/pdf (the content type of the payload)
    base64: (the PDF itself)

    The server just needs to create a file from this payload and return it to the client.

    If you are interested in the our online implementation, here is a copy of the Action method (we use ASP.NET MVC):
    [HttpPost]
    public ActionResult Index(string contentType, string base64, string fileName)
    {
        if (Request.UrlReferrer.Host.EndsWith("telerik.com"))
        {
            var fileContents = Convert.FromBase64String(base64);
     
            return File(fileContents, contentType, fileName);
        }
     
        return new HttpStatusCodeResult(403, "Available only for demos.telerik.com");
    }

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. JET
    JET avatar
    19 posts
    Member since:
    Dec 2012

    Posted 18 Jun 2015 in reply to Georgi Krustev Link to this post

    That's exactly what I was looking for. Thanks. 
  9. Bartek
    Bartek avatar
    1 posts
    Member since:
    Dec 2015

    Posted 21 Apr in reply to Georgi Krustev Link to this post

    That's work for me in PHP.... my problem is I cant send this file to view in MOBILE....work for desktop but not for Ipad....
  10. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 25 Apr Link to this post

    Hello Bartek,

    I tested our online "Export to PDF" demo and the export functionality works just fine on iOS: I would suggest you open a separate support thread with more details about the issue you are experiencing. Thus the most appropriate support officer will be able to assist you.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready