diff --git a/examples/example_001.php b/examples/example_001.php
index 82555e6b..4fbf7554 100644
--- a/examples/example_001.php
+++ b/examples/example_001.php
@@ -39,6 +39,7 @@
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 001');
$pdf->setSubject('TCPDF Tutorial');
+$pdf->setDescription('TCPDF Tutorial Description');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
diff --git a/tcpdf.php b/tcpdf.php
index 42c425e9..3a490cca 100644
--- a/tcpdf.php
+++ b/tcpdf.php
@@ -508,6 +508,12 @@ class TCPDF {
*/
protected $keywords = '';
+ /**
+ * Document description.
+ * @protected
+ */
+ protected $description = '';
+
/**
* Document creator.
* @protected
@@ -2960,6 +2966,17 @@ public function setSubject($subject) {
$this->subject = $subject;
}
+ /**
+ * Defines the description of the document.
+ * @param string $description The description.
+ * @public
+ * @since 1.2
+ * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle()
+ */
+ public function setDescription($description) {
+ $this->description = $description;
+ }
+
/**
* Defines the author of the document.
* @param string $author The name of the author.
@@ -9622,6 +9639,10 @@ protected function _putinfo() {
// The subject of the document.
$out .= ' /Subject '.$this->_textstring($this->subject, $oid);
}
+ if (!TCPDF_STATIC::empty_string($this->description)) {
+ // The description of the document.
+ $out .= ' /Description '.$this->_textstring($this->description, $oid);
+ }
if (!TCPDF_STATIC::empty_string($this->keywords)) {
// Keywords associated with the document.
$out .= ' /Keywords '.$this->_textstring($this->keywords, $oid);
@@ -9710,12 +9731,12 @@ protected function _putXMP() {
$xmp .= "\t\t\t".''."\n";
$xmp .= "\t\t\t".''."\n";
$xmp .= "\t\t\t\t".''."\n";
- $xmp .= "\t\t\t\t\t".''.TCPDF_STATIC::_escapeXML($this->subject).''."\n";
+ $xmp .= "\t\t\t\t\t".''.TCPDF_STATIC::_escapeXML($this->description ?: $this->subject).''."\n";
$xmp .= "\t\t\t\t".''."\n";
$xmp .= "\t\t\t".''."\n";
$xmp .= "\t\t\t".''."\n";
$xmp .= "\t\t\t\t".''."\n";
- $xmp .= "\t\t\t\t\t".''.TCPDF_STATIC::_escapeXML($this->keywords).''."\n";
+ $xmp .= "\t\t\t\t\t".''.TCPDF_STATIC::_escapeXML($this->subject).''."\n";
$xmp .= "\t\t\t\t".''."\n";
$xmp .= "\t\t\t".''."\n";
$xmp .= "\t\t".''."\n";