"名称" web pdf是否可以更好地在Acrobat中保存文件名? [英] "name" web pdf for better default save filename in Acrobat?

查看:170
本文介绍了"名称" web pdf是否可以更好地在Acrobat中保存文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用会生成供用户使用的PDF。 Content-Dispositionhttp标头的设置如此处所述。这被设置为inline; filename = foo.pdf,这足以让Acrobat在保存pdf时将foo.pdf作为文件名。

My app generates PDFs for user consumption. The "Content-Disposition" http header is set as mentioned here. This is set to "inline; filename=foo.pdf", which should be enough for Acrobat to give "foo.pdf" as the filename when saving the pdf.

但是,单击嵌入浏览器的Acrobat中的保存按钮后,要保存的默认名称不是该文件名,而是带有斜杠的URL更改为下划线。巨大而丑陋。有没有办法在Adobe中影响这个默认文件名?

However, upon clicking the "Save" button in the browser-embedded Acrobat, the default name to save is not that filename but instead the URL with slashes changed to underscores. Huge and ugly. Is there a way to affect this default filename in Adobe?

URL中有一个查询字符串,这是不可协商的。这可能很重要,但在URL的末尾添加& foo = / title.pdf不会影响默认文件名。

There IS a query string in the URLs, and this is non-negotiable. This may be significant, but adding a "&foo=/title.pdf" to the end of the URL doesn't affect the default filename.

更新2:我已经尝试了两个

Update 2: I've tried both

content-disposition  inline; filename=foo.pdf
Content-Type         application/pdf; filename=foo.pdf

content-disposition  inline; filename=foo.pdf
Content-Type         application/pdf; name=foo.pdf

(通过Firebug验证)可悲的是,没有工作。

(as verified through Firebug) Sadly, neither worked.

示例网址

/bar/sessions/958d8a22-0/views/1493881172/export?format=application/pdf&no-attachment=true

转换为默认的Acrobat保存为文件名

which translates to a default Acrobat save as filename of

http___localhost_bar_sessions_958d8a22-0_views_1493881172_export_format=application_pdf&no-attachment=true.pdf

更新3:Julian Reschke为这种情况带来了实际的洞察力和严谨性。请提出他的回答。
这似乎在FF中被打破( https://bugzilla.mozilla。 org / show_bug.cgi?id = 433613 )和IE,但在Opera,Safari和Chrome中工作。 http://greenbytes.de/tech/tc2231/#inlwithasciifilenamepdf

Update 3: Julian Reschke brings actual insight and rigor to this case. Please upvote his answer. This seems to be broken in FF (https://bugzilla.mozilla.org/show_bug.cgi?id=433613) and IE but work in Opera, Safari, and Chrome. http://greenbytes.de/tech/tc2231/#inlwithasciifilenamepdf

推荐答案

部分问题在于相关的 RFC 2183 并没有真正说明如何处理内联和文件名的处置类型。

Part of the problem is that the relevant RFC 2183 doesn't really state what to do with a disposition type of "inline" and a filename.

此外,目前为止据我所知,实际使用type = inline文件名的唯一UA是Firefox(参见测试用例)。

Also, as far as I can tell, the only UA that actually uses the filename for type=inline is Firefox (see test case).

最后,插件API实际上使这些信息可用并不明显(也许熟悉API的人可以详细说明)。

Finally, it's not obvious that the plugin API actually makes that information available (maybe someboy familiar with the API can elaborate).

话虽如此,我已向Adobe人发送了一个指向此问题的指针;也许合适的人会看看。

That being said, I have sent a pointer to this question to an Adobe person; maybe the right people will have a look.

相关:请参阅 draft-reschke-rfc2183-in-http - 这是早期的工作进展,反馈意见赞赏。

Related: see attempt to clarify Content-Disposition in HTTP in draft-reschke-rfc2183-in-http -- this is early work in progress, feedback appreciated.

更新:我添加了测试用例,这似乎表明Acrobat reader插件不使用响应头(在Firefox中),尽管插件API提供了对它们的访问。

Update: I have added a test case, which seems to indicate that the Acrobat reader plugin doesn't use the response headers (in Firefox), although the plugin API provides access to them.

这篇关于"名称" web pdf是否可以更好地在Acrobat中保存文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆