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
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
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?
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
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
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
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