[CLOSED] PDF file result from MVC

  1. #1

    [CLOSED] PDF file result from MVC

    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
    Last edited by Daniil; May 26, 2015 at 4:50 PM. Reason: [CLOSED]
  2. #2
    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.
    http://stackoverflow.com/questions/1...browser-in-mvc
  3. #3
    OK, thanks Daniil, let me try to put something together and I'll come back if I have some queries.
  4. #4
    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:

    @(X.Window()
            .ID("Window1")
            .Title("Hello World")
            .Icon(Icon.Application)
            .Height(185)
            .Width(350)
            .BodyStyle("background-color: #fff;")
            .BodyPadding(5)
            .Modal(true)
            .Content(c => "This is my first <a target='_blank' href='http://www.ext.net/'> Ext.NET</a> Window.")
            .Buttons(
                    X.Button().Text("Save")
                                .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.Click image for larger version. 

Name:	Capture.PNG 
Views:	38 
Size:	36.0 KB 
ID:	23979
  5. #5
    At least, you should set
    de.Click.IsUpload = true;
    This might be helpful.
    http://forums.ext.net/showthread.php...ng-DirectEvent
  6. #6
    Hi Daniil

    Thank you for answering. This is not upload I am referring to but a download of a pdf file.
  7. #7
    Oh, sorry. This might help then.
    http://forums.ext.net/showthread.php?27575

Similar Threads

  1. Replies: 4
    Last Post: Jan 13, 2015, 8:21 AM
  2. [CLOSED] multiple file upload and file size at client side
    By mirwais in forum 1.x Legacy Premium Help
    Replies: 24
    Last Post: Dec 15, 2014, 5:44 AM
  3. Replies: 1
    Last Post: Mar 15, 2013, 1:38 AM
  4. [CLOSED] JSON Result Becomes "File Download" by IE9
    By cleve in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 02, 2012, 12:59 PM
  5. Replies: 3
    Last Post: Nov 27, 2008, 12:52 PM

Posting Permissions