iTextSharp generated PDF: How to send the pdf to the client and add a prompt?

前端 未结 5 497
半阙折子戏
半阙折子戏 2020-12-01 17:25

I have generated a pdf using iTextSharp, when its created it saves automatically in the location provided in my code on the server not on the client side and of course witho

5条回答
  •  没有蜡笔的小新
    2020-12-01 18:01

    SOLVED

    The error is from the submit operation trying to interpret the response which it can not because it is not in a known format.

    I just set window.location to download files and this works fine.

    {
    xtype:'button',           
    text: 'Generate PDF',           
    handler: function () {
         window.location = '/AddData.ashx?action=pdf';                   
    }
    }
    

    Instead of setting the location you can also do window.open().

    Whether the file will be downloaded or opened depends on browser settings.

提交回复
热议问题