What PDF meta data does dompdf support?

狂风中的少年 提交于 2019-12-01 23:31:10

问题


When using dompdf what PDF meta data can be set in the document information dictionary?

Originally asked elsewhere:

Are you able to parse more META info to be added to PDF information during PDF generation?

/Creator (DOMPDF) /CreationDate (D:20150818031116-05'00') /ModDate (D:20150818031116-05'00')

Can you specify Author, Copyright, etc..?

I cannot find ANY reference to this. Only just saw your: Creator, Creation Date and Modification Date!


回答1:


In the current stable release (0.6.1) the HTML <title> element and some <meta> elements (author, keywords, description) are used to set the relevant PDF meta data.

<html>
<head>
  <title>Ehhhhhhh</title>
  <meta name="author" content="Arthur Herbert Fonzarelli">
  <meta name="keywords" content="fonzie, cool, ehhhhhhh">
</head>
<body>
  <p>Ehhhhhhh</p>
</body>
</html>

In addition, you can add other info to the PDF using the $dompdf->add_info() method. The full list of supported metadata info that you can set is: Title, Author, Subject, Keywords, Creator, Producer, CreationDate, ModDate, Trapped.

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->add_info('Subject', 'Cool');


来源:https://stackoverflow.com/questions/32233664/what-pdf-meta-data-does-dompdf-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!