开发者

Download large PDF in javascript

I have a website which hosts large PDF documents, as well as some other file formats.

How can I open up a download-dialog box in javascript so that the user can save the document to their开发者_如何学运维 computer?


PDF always needs download (even for iframe / embed /object ) so do not use those as its then potential double overload on server, once to downlink and show then potentially a second time by the scripting (However if user selects the "save download as" button in viewer the download should be just once)

The answer is display a small image or icon to show the download content, then back that up with

<a href="file.pdf" download="filename.pdf"><Img src="cover.png"></a>

something like this:-

Download large PDF in javascript

<a href="https://africau.edu/images/default/sample.pdf" download="A Sample.pdf"><img src="https://www.freeiconspng.com/uploads/download-pdf-icon-png-icon-29.png" width="128" height="128"><a><br>right click icon to chose download options
note clicking the icon may show a blank page based on browser security, that is normal, hence the suggestion the user uses their discretion.

Download large PDF in javascript

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜