简体   繁体   English

如何通过一个下载按钮下载所有链接

[英]How to Download all the link by one download button

Iam writing a website with asp.net mvc4. 我用asp.net mvc4编写一个网站。 I have to write a module that user can download all the pdf file by click a download all button. 我必须编写一个模块,用户可以通过单击全部下载按钮下载所有pdf文件。

But the problem is all the pdf file are not already in server. 但问题是所有pdf文件都尚未在服务器中。 The process run when the action link was call, it export the pdf from html by Rotativa library in asp.net and send back to the browser. 该流程在调用动作链接时运行,它通过asp.net中的Rotativa库从html导出pdf pdf并将其发送回浏览器。

I have the action links were contained by a tags, which were list below the download all button. 我的动作链接包含在标签中,这些标签在“全部下载”按钮下方列出。 So what I want is when I click a download all button, it will call one by one action link to download the pdf. 所以我想要的是,当我单击全部下载按钮时,它将一个接一个的操作链接调用以下载pdf。

Is this possible at all? 这有可能吗? Any suggestions on how to go about it? 有什么建议吗?

Thanks 谢谢

It's not easy to download 'one by one', since the download procedure is handled by the browser, not your web page. “一对一”下载并不容易,因为下载过程是由浏览器而不是您的网页处理的。

You may try to 您可以尝试

  1. Package all the pdf files into a zip on server side. 将所有pdf文件打包到服务器端的zip中。
  2. Use some hack like Detect when browser receives file download 在浏览器收到文件下载时使用一些检测方法,例如检测

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM