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

Export scheduler to PDF in new window. MVC5

8 Answers 236 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 08 Jun 2015, 05:01 PM

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. 

8 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 10 Jun 2015, 09:16 AM
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!
 
0
Eric
Top achievements
Rank 1
answered on 12 Jun 2015, 10:20 PM

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?

0
Georgi Krustev
Telerik team
answered on 16 Jun 2015, 02:15 PM
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!
 
0
Eric
Top achievements
Rank 1
answered on 16 Jun 2015, 04:33 PM

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

0
Georgi Krustev
Telerik team
answered on 18 Jun 2015, 01:20 PM
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!
 
0
Eric
Top achievements
Rank 1
answered on 18 Jun 2015, 03:34 PM
That's exactly what I was looking for. Thanks. 
0
Bartek
Top achievements
Rank 1
answered on 21 Apr 2016, 01:23 PM
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....
0
Georgi Krustev
Telerik team
answered on 25 Apr 2016, 08:04 AM
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!
 
Tags
Scheduler
Asked by
Eric
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Eric
Top achievements
Rank 1
Bartek
Top achievements
Rank 1
Share this question
or