doureng1083 2012-09-24 15:40
浏览 111
已采纳

在浏览器中自动保存PDF

I have a interesting question for you all.

My client wants a way to automatically save a PDF that is opened up in Chrome. Currently he achieves this by either clicking on the Save button in Acrobat (in the browser), or by right clicking, thus bringing up the context menu and clicking Save As --> PDF. He would like this process automated.

I did a lot of searching and I cannot find a solution to this question.

So I ask all of you, is there a way to automatically save a PDF that is embedded in a HTML page?

I'm assuming I would have to do some screen scraping to get the HTML page, which would include the link with the PDF but I'm not sure where to go from there.

Any help will be greatly appreciated.

Thank you very much, and have a great day.

  • 写回答

2条回答 默认 最新

  • dousenjue3214 2012-09-24 15:44
    关注

    Web pages require user interaction before writing files to the user's hard drive. This is a security measure to keep any ol' web page from putting files on your disk.

    It is possible to make file Save As dialog popup when the user clicks on something and ready to save a particular file to the disk, but in some browsers the user will still have to finish the operation. In other browsers, downloaded files can be pre-configured to go to a particular "downloads" directory and the user does not have to take another step after the browser initiates the save.

    If, when the browser requests a file, the response is given a header:

    Content-Disposition: attachment; filename="xxx.pdf"
    

    The browser will try to save it. I don't know what happens if the web server does this as one request of many in a web page. The way I've seen this used is the user clicks a download button and the browser requests a specific URL that indicates to the server that the user wants to save the file and then, and only then, the web server includes this header.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大