将 PDF 流式传输到浏览器并利用 Adobe PDF 参数,例如 #search、#zoom、#page
这个人快要死我了!在 ASP Classic 中,我试图向用户传输 pdf 文件,到目前为止我已经得到以下代码:
Response.Buffer = False
'This is download
Response.ContentType = ContentTypeFromFile(DownloadFileName)
'Set file name
Response.AddHeader "Content-Disposition", "inline; filename=myfile.pdf#search=fox"
Response.binarywrite "c:/myfile.pdf"
但是它不起作用,并且?和 # 更改为 _ 当我运行它时,这会导致文件下载中断。
我发现这里提出了同样的问题,但那是三年前的事了,我尝试按照公认的答案建议去做,但没有成功。
有人可以帮助我吗?
This one is killing me! In ASP Classic I'm trying to stream users a pdf file, so far i've got the following code:
Response.Buffer = False
'This is download
Response.ContentType = ContentTypeFromFile(DownloadFileName)
'Set file name
Response.AddHeader "Content-Disposition", "inline; filename=myfile.pdf#search=fox"
Response.binarywrite "c:/myfile.pdf"
However it's not working and the ? and # are changed to _ when I run it which causes the file download to break.
I found the same question asked on here but it was 3 years ago and I've tried doing what the accepted answer suggested without any success.
Can anyone help me?
Link to the old question: https://stackoverflow.com/search?q=open+pdf+with+search
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我终于解决了这个问题!另一个问题中给出的答案是实际答案,但理解它是棘手的部分!
在您的页面中添加以下代码:
然后通过 url 将参数传递给 adobe reader!因此,如果上面的代码位于名为 default.asp 的页面中,
则执行以下操作: http://www.yoururl.com/default.asp#search=fox&zoom=20&page=2
这会很不错的!请注意,不在 google chrome 中!我在谷歌上搜索了有关如何在 Chrome 中运行此类内容的信息,但是谷歌没有将参数编码到他们的 pdf 查看器中。
Okay finally I worked this one out! The answer given in the other question is the actual answer, understanding it however was the tricky part!
Have this code in your page:
And then you pass the parameters to the adobe reader through the url! So if the code above is in a page called: default.asp
then do this: http://www.yoururl.com/default.asp#search=fox&zoom=20&page=2
and it will work a treat! Not in google chrome mind you! I googled about getting this sort of thing working in chrome however google didn't code in parameters into their pdf viewer.