1. #1
    Ext User
    Join Date
    Apr 2008
    Location
    Lincoln, NE
    Posts
    235
    Vote Rating
    0
    jpnet is an unknown quantity at this point

      0  

    Default PDFs and AJAX Requests?

    PDFs and AJAX Requests?


    NOTE: I have posted in 'Open Discussion' instead of help because I see this more as a discussion on feasibility or technique. Moderators, if you feel this is not the case, please move it to the 'Help' forum. Thanks.

    I am sending an AJAX request (via RequestBuilder from a Button) to get a PDF. However, instead of the PDF being rendered/opened in a new browser tab, the PDF data is sent back to my GWT app via the 'onResponseRecieved' method of RequestCallBack(). I suppose this is to be expected. How can I then take this data and force the browser to send a prompt to allow my users to save the PDF? Any thoughts?

    Another approach that would work is if I could somehow call the PDF url via an anchor tag and the target set to '_blank'. But I'm not sure how my GWT app could set that up from a Button.

    Any thoughts on how I can solve this problem?

    Thanks,

    JP

  2. #2
    Sencha User
    Join Date
    Aug 2008
    Posts
    226
    Vote Rating
    2
    TheBuzzer is on a distinguished road

      0  

    Default


    well to fix it you would need to do this.

    If the data needs to be saved first you first send the data to save.

    After that make a widget that will open a new url window to a jsp that will display the pdf.

  3. #3
    Ext User
    Join Date
    Apr 2008
    Location
    Lincoln, NE
    Posts
    235
    Vote Rating
    0
    jpnet is an unknown quantity at this point

      0  

    Default


    well to fix it you would need to do this.

    If the data needs to be saved first you first send the data to save.

    After that make a widget that will open a new url window to a jsp that will display the pdf.
    That's essentially what I have done. I've created a new ContentPanel and called setUrl to the PDF url. It works adequately enough, however with the AJAX request at least I could use a progress indicator. Oh well.

  4. #4
    Ext User
    Join Date
    Oct 2008
    Location
    Warsaw(PL)/Cottbus(GER)
    Posts
    215
    Vote Rating
    0
    EagleEye666666 is on a distinguished road

      0  

    Default


    Quote Originally Posted by jpnet View Post
    NOTE: I have posted in 'Open Discussion' instead of help because I see this more as a discussion on feasibility or technique. Moderators, if you feel this is not the case, please move it to the 'Help' forum. Thanks.

    I am sending an AJAX request (via RequestBuilder from a Button) to get a PDF. However, instead of the PDF being rendered/opened in a new browser tab, the PDF data is sent back to my GWT app via the 'onResponseRecieved' method of RequestCallBack(). I suppose this is to be expected. How can I then take this data and force the browser to send a prompt to allow my users to save the PDF? Any thoughts?

    Another approach that would work is if I could somehow call the PDF url via an anchor tag and the target set to '_blank'. But I'm not sure how my GWT app could set that up from a Button.

    Any thoughts on how I can solve this problem?

    Thanks,

    JP
    This stuff you will have to do on the serverside... if you would use spring you could use it's Controller > View functionallities... but i guess it would also work with a normal servlet. I did not read neither did such things so i can just give my thoughts (maybe they are stupid )

Thread Participants: 2