SetAuthor()
(mPDF ≥ 1.0)
SetAuthor – Set the document Author
Description
void SetAuthor ( string $text )
Set the Author for the document. This metadata can be seen when inspecting the document properties in Adobe Reader.
Note: Adobe Reader uses system fonts to display the document metadata, therefore any Unicode text can be used, even if a unibyte codepage is being used for the document.
Parameters
- $text
-
Defines the text to appear as the Author. 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.
Examples
Example #1
<?php
$mpdf = new \Mpdf\Mpdf();
$mpdf->SetAuthor('My Name');
$mpdf->WriteHTML('Hello World');
$mpdf->Output('filename.pdf');
Example #2
<?php
$mpdf = new \Mpdf\Mpdf();
// The library defines a function strcode2utf() to convert htmlentities to UTF-8 encoded text
$md = strcode2utf("&#1575;&#1610;&#1604;&#1575;&#1578; &#1601;&#1610;&#1605;&#1575; &#1575;&#1610;&#1604;&#1575;&#1578; &#1601;&#1610;&#1605;&#1575;");
$mpdf->SetAuthor($md);
$mpdf->WriteHTML('Hello World');
$mpdf->Output('filename.pdf');
See Also
- SetTitle() - Set document Title 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