Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What PDF meta data does dompdf support?

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!

like image 786
BrianS Avatar asked Dec 11 '22 21:12

BrianS


1 Answers

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');
like image 153
BrianS Avatar answered Dec 28 '22 11:12

BrianS