pdf文档-设置窗口标题(html标题

问题描述 投票:0回答:2

我正在用这个来输出一个pdf文档。

$response = new \Symfony\Component\HttpFoundation\Response(file_get_contents($thefile), 200, [
    'Content-Description' => 'File transfer',
    'Content-Disposition' => 'filename="' . $filename . '"',
    'Content-Transfer-Encoding' => 'binary',
    'Content-Type' => 'application/pdf',
]);

unlink($thefile);

$response->send();

在生成的页面中,标题是指向页面的链接。

我怎样才能自定义标题?

php pdf-generation symfony-http-foundation
2个回答
-1
投票

你必须在pdf中包含标题。


-2
投票

我只需要从一个脚本中生成pdf作为iframe的src!

这样就可以保留标题了!

<head>
  <title>THE TITLE</title>
</head>
<body>
  <iframe src="process.php"></iframe>
</body>
</html>

或者我可以用ajax的方式来生成php脚本,然后用一个容器元素(比如div)来返回结果。

© www.soinside.com 2019 - 2024. All rights reserved.