1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    54
    Vote Rating
    0
    leowyatt is on a distinguished road

      0  

    Default PDF file downloads instead of showing in window

    PDF file downloads instead of showing in window


    Hi,

    I'm trying to display a PDF in a new window and currently all my browser does is download the file. Here is the code I'm using;

    Code:
    			this.window = new Ext.ux.MediaWindow({
    			    id : 'PDFViewerWin',
    			    title : 'title',
    			    bodyCfg: {
    					tag: 'iframe',
    					src: '/path/to/file.pdf',
    					style: 'border: 0 none'
    				},
    			    width : 600,
    			    height : 400,
    			    bodyStyle : 'position:relative; padding:0px;'
    			});
    Am I going about this the wrong way? Is this not possible?

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    It's better to use an <object> or <embed> tag here instead of an <iframe> (also see the ux.Media user extension).

    You could also fix this by changing your server to set the Content-disposition response header to 'inline' instead of 'attachment'.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    54
    Vote Rating
    0
    leowyatt is on a distinguished road

      0  

    Default


    Cheers for the reply Condor

    When you say change the tag do you mean, tag: 'object' or tag : 'embed' ?

    I don't think I can change the Content-disposition I'm afraid.

    If I use embed I get an m is null on this.assert(m.height,height); which I'm assuming m is the PDF.

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Try:
    Code:
    {
      tag: 'object',
      type: 'application/pdf',
      data: '/path/to/file.pdf'
    }

  5. #5
    Sencha User
    Join Date
    Nov 2010
    Posts
    54
    Vote Rating
    0
    leowyatt is on a distinguished road

      0  

    Default


    Well I'm getting a window now but it is no bigger than the title bar so it is a start

    The file isn't downloading anymore

  6. #6
    Sencha User
    Join Date
    Nov 2010
    Posts
    54
    Vote Rating
    0
    leowyatt is on a distinguished road

      0  

    Default


    Right if I change from 'object' to 'embed' I get the window loads, is the correct size but the content is blank. I have checked taskmgr and I can see adobe running.


    EDIT: If I use;

    Code:
    window.open('path/to/file.pdf');
    The PDF opens in a new tab

  7. #7
    Sencha User
    Join Date
    May 2012
    Posts
    49
    Vote Rating
    0
    anmol is on a distinguished road

      0  

    Default


    Hi All,
    I am tring same thing using ExtJs 4.0
    i want to open a PDF in tab, following code works fine in FireFox and chrome.
    It embeds PDF but it in IE it opens the 'download window'.

    following is the code:
    /****************************************************************************/
    dashBoardTab.add({
    title: 'Admin Help',
    padding: '5',
    id: 'adminHelp',
    closable: true,
    html: '<iframe src="../../../../Content/Help/FitChallengeOverview.pdf" width="100%" height="800px" frameborder="0" ></iframe>'

    }).show();

    /****************************************************************************/

Similar Threads

  1. FYI: Very simple approach to JS-triggered file downloads
    By Eric24 in forum Community Discussion
    Replies: 9
    Last Post: 7 Jun 2012, 10:45 AM
  2. Dragging window without showing window proxy
    By joe1chen in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 15 Nov 2010, 5:39 PM
  3. [SOLVED] BrowseButton/UploadDialog issue: still showing file input button
    By dselkirk in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 1 Jun 2009, 5:18 AM
  4. Directory listing in data view causes file downloads
    By para in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 21 Feb 2008, 12:09 PM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar