View Full Version : [CLOSED] PDF file result from MVC

May 14, 2015, 11:28 AM
Do you perhaps have an example of returning a PDF file from an MVC action on Direct Event button click?
I am struggling to make this.
It is a button on a window that should present a user with a PDF file.

THank you

May 14, 2015, 9:47 PM
Hi @registrator,

I was unable to find such an example. Though, it doesn't mean that it doesn't exist on the forums.

Anyways, this might help.

May 14, 2015, 10:02 PM
OK, thanks Daniil, let me try to put something together and I'll come back if I have some queries.

May 17, 2015, 6:36 PM
Can you please try this scenario:

I have used your 2013 V3 examples solution and in the example "Window_Basic/Hello_World" I have added a button on a window:

.Title("Hello World")
.BodyStyle("background-color: #fff;")
.Content(c => "This is my first <a target='_blank' href='http://www.ext.net/'> Ext.NET</a> Window.")
.DirectEvents(de =>
de.Click.Url = Url.Action("Save");


In the controller I had the following

public ActionResult Save()
string pdfFileName = Server.MapPath("~/PDFTempFiles/Test.pdf");
return this.File(pdfFileName, "application/pdf", "Test.pdf");

And got this:

Status Code: 200Status Text: BADRESPONSE: Unexpected token %

Seems like Ext.NET does not like this type of action result.

While in the window you can see that it is the PDF returned. See attachment.23979

May 19, 2015, 10:48 AM
At least, you should set

de.Click.IsUpload = true;

This might be helpful.

May 19, 2015, 12:12 PM
Hi Daniil

Thank you for answering. This is not upload I am referring to but a download of a pdf file.

May 19, 2015, 1:00 PM
Oh, sorry. This might help then.