Document Metadata
A PDF file contains metadata about the title, author, subject, creation date, keywords. The title is usually shown in the top of the screen when a user views the file; the rest of the metadata can be accessed by viewing Document properties in Adobe Reader.
You can set the metadata directly using:
Metadata is also set automatically if you pass full HTML code to WriteHTML() including:
- title is read from
<title>...</title>
tags - subject, keywords and author are read from
<meta ... />
tags
Whichever is set later will override previous settings.
The text should be UTF-8 encoded, but should not contain HTML mark-up tags. strcode2utf() is a useful function provided with mPDF which converts HTML numerical entities to UTF-8 encoded string.
Note: Adobe Reader uses system fonts to display the document metadata, therefore any Unicode text can be used, even if core fonts only are being used for the document.
Example
<?php
$mpdf = new \Mpdf\Mpdf();
$md = strcode2utf("ايلات فيما
ايلات فيما");
$mpdf->SetTitle($md);
$mpdf->WriteHTML('Hello World');
$mpdf->Output();
See Also
- SetTitle() - Set document Title in metadata
- SetAuthor() - Set document Author in metadata
- SetCreator() - Set document Creator in metadata
- SetSubject() - Set document Subject in metadata
- SetKeywords() - Set document Keywords in metadata
- strcode2utf() - Convert HTML numerical entities to UTF-8 encoded string