如何获取.pdf文档的标题以显示为页面标题? [英] How do I get the title of a .pdf document to appear as the page title?

查看:603
本文介绍了如何获取.pdf文档的标题以显示为页面标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在网站上发布PDF,并具有指向该文件的链接,与任何其他文件相同.如果浏览器有能力,它将在新选项卡中显示PDF.但是,URL(以及一个笨拙的URL)显示在通常位于文档title所在的选项卡的顶部. PDF文件是否有我可以调整的参数?还是有一种方法可以将文件包装在可以做的事情中?

I'm posting a PDF at a website and have a link pointing to it, the same as any other file. If the browser is capable, it displays the PDF in a new tab. But the URL (and an unwieldy one at that) is showing up on the top of the tab where the document title usually goes. Do PDF files have a parameter for this I can adjust? Or is there a way to wrap the file in something that does?

(我尝试在Acrobat的选项中检查显示文档标题",但没有这样做.)

(I've tried checking "display document title" in Acrobat's options, that doesn't do it.)

推荐答案

我不认为您可以在PDF本身中对此进行控制.它由提供PDF的网络应用程序和浏览器的PDF插件控制,后者很可能仅将PDF的URL用作<title>. Web应用程序可以通过在HTTP响应中设置 content-disposition 标头来指定所提供的PDF的文件名,但这又是您无法控制的.

I don't think this is something you can control within the PDF itself. It's controlled by the web app serving the PDF, and your browser's PDF plugin, which will most likely just use the PDF's URL as the <title>. The filename of the served PDF can specified by the web app by setting a content-disposition header in the HTTP response, but again this isn't something you can control.

这篇关于如何获取.pdf文档的标题以显示为页面标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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