修改
按照@Will建议这里是一个简化的问题...
我是否可以在TCPDF PDF Creator文件(example_003.php)中使用标签将浏览器标题设置为除php文件的完整URL之外的任何其他内容?
我在许多其他事情中尝试了这一点,但它似乎没有发挥。
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Author');
$pdf->SetTitle('Title');
$pdf->SetSubject('Subject');
$pdf->SetKeywords('Keywords');
$pdf->setHeaderData($ht='Browser Title?');
任何帮助都会很棒,谢谢
答案 0 :(得分:1)
浏览器是否会显示除下载文件的URL以外的任何内容(无论浏览器是否显示PDF)都完全取决于供应商。我的测试并未表明PDF中的任何数据都显示在浏览器的标题栏中。
您可以做的事情是为PDF文件提供备用文件名,这样当用户保存文件时,他们的PDF上就不会出现奇怪的.php扩展名。您可以使用Content-Disposition HTTP标头执行此操作。在PHP中可以这样做:
header('Content-Disposition: attachment; filename=document-name.pdf');
答案 1 :(得分:0)
如果您使用html2pdf
tcpdf
作为基类,它确实包含SetTitle
函数。您只需在html2pdf.class
中创建一个函数覆盖。
/**
* Defines the title of the document.
* @param string $title The title.
* @access public
* @since 1.2
* @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject()
*/
public function SetTitle($title) {
//Title of document
$this->pdf->SetTitle($title);
return $this;
}