设置PDF文件的名称动态 [英] Setting PDF file name dynamically
问题描述
我希望我能够准确地解释我的处境。
I hope I am able to explain my situation accurately.
我有转储出的PDF文件中使用下列code用户的ASP.NET页面:
I have an ASP.NET page that dumps out PDF files for the users with the following code:
Response.ContentType = "application/pdf";
Response.AppendHeader("content-disposition", string.Format("inline; filename={0}", getFileName(DateTime.Now)));
为什么我用内联,而不是附件究其原因,这样我就可以迫使用户直接在浏览器,而不是开放的Acrobat查看PDF文件阅览PDF格式。一切都很好,到目前为止,但如果用户想保存一个文件,它应该被设置为文件名的的getFileName(DateTime.Now),而是它只是需要页面的名称,如< STRONG> myPDFpage.pdf
The reason why I use "inline" instead of "attachment", so I can force the users to view the PDF directly in the browsers instead of opening up the acrobat to view the PDFs. Everything is fine so far, but when users want to save a file, the file name which should be set to "getFileName(DateTime.Now)", instead it just takes the name of the page like myPDFpage.pdf.
反正是有,而且不设置内容处置,以附件,为用户节省与我同的getFileName()方法指定文件名的文件?
Is there anyway, without setting the content-disposition to "attachment", for the users to save the file with the name I specify with the getFileName() method?
在此先感谢。
badallen
Thanks in advance. badallen
推荐答案
这是方式的简单行为杂技演员处理文件时,你必须打开它内联。据我所知,没有办法决定这种开放的时候内联,因为这成为Acrobat中的责任。
This is a simple behavior of the way that acrobat handles the file when you have it open inline. As far as I know there is not a way to dictate this when opening inline, as that becomes the responsibility of Acrobat.
这篇关于设置PDF文件的名称动态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!