From b41a5ca3114c18214ec2871fb68923e6d7bb9e92 Mon Sep 17 00:00:00 2001
From: nicolaasuni <info@tecnick.com>
Date: Thu, 19 Sep 2019 10:41:12 +0100
Subject: [PATCH] new setExtraXMPRDF function to set custom RDF XMP data

---
 LICENSE.TXT      |   2 ++
 README.md        |   2 +-
 VERSION          |   1 +
 composer.json    |   2 +-
 include/sRGB.icc | Bin 6922 -> 3048 bytes
 tcpdf.php        |  35 +++++++++++++++++++++++++++++------
 6 files changed, 34 insertions(+), 8 deletions(-)
 create mode 100644 VERSION

diff --git a/LICENSE.TXT b/LICENSE.TXT
index daf21f7..49147d0 100644
--- a/LICENSE.TXT
+++ b/LICENSE.TXT
@@ -6,6 +6,8 @@
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation, either version 3 of the
   License, or (at your option) any later version.
+  
+  2002-2019 Nicola Asuni - Tecnick.com LTD
 
 **********************************************************************
 **********************************************************************
diff --git a/README.md b/README.md
index baa5181..734b987 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
 
 * **category**    Library
 * **author**      Nicola Asuni <info@tecnick.com>
-* **copyright**   2002-2018 Nicola Asuni - Tecnick.com LTD
+* **copyright**   2002-2019 Nicola Asuni - Tecnick.com LTD
 * **license**     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
 * **link**        http://www.tcpdf.org
 * **source**      https://github.com/tecnickcom/TCPDF
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..798e389
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+6.3.0
diff --git a/composer.json b/composer.json
index 1f19dfd..04df3a5 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
 {
   "name": "tecnickcom/tcpdf",
-  "version": "6.2.26",
+  "version": "6.3.0",
   "homepage": "http://www.tcpdf.org/",
   "type": "library",
   "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
diff --git a/include/sRGB.icc b/include/sRGB.icc
index 1d8f7419c3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6Er;e8sz%NISN1IS`tHJu?{{>o4Ov`@F2E((VQ?<At
zKdL9d%qI|ScD3{cFn9>uJ$AL?HE`bqMm}!aOpkT1Y&ZsGi>i!Q??8SZSbPD_&Vlg~
f<=XT`jiv*fDmSWbU2a)re}eCNf|sNal{&N^xK(OJ

diff --git a/tcpdf.php b/tcpdf.php
index 3a5fdb0..8d96729 100644
--- a/tcpdf.php
+++ b/tcpdf.php
@@ -1,13 +1,13 @@
 <?php
 //============================================================+
 // File name   : tcpdf.php
-// Version     : 6.2.26
+// Version     : 6.3.0
 // Begin       : 2002-08-03
-// Last Update : 2018-09-14
+// Last Update : 2019-09-19
 // Author      : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
 // License     : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
 // -------------------------------------------------------------------
-// Copyright (C) 2002-2018 Nicola Asuni - Tecnick.com LTD
+// Copyright (C) 2002-2019 Nicola Asuni - Tecnick.com LTD
 //
 // This file is part of TCPDF software library.
 //
@@ -104,7 +104,7 @@
  * Tools to encode your unicode fonts are on fonts/utils directory.</p>
  * @package com.tecnick.tcpdf
  * @author Nicola Asuni
- * @version 6.2.26
+ * @version 6.3.0
  */
 
 // TCPDF configuration
@@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php');
  * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
  * @package com.tecnick.tcpdf
  * @brief PHP class for generating PDF documents without requiring external extensions.
- * @version 6.2.26
+ * @version 6.3.0
  * @author Nicola Asuni - info@tecnick.com
  * @IgnoreAnnotation("protected")
  * @IgnoreAnnotation("public")
@@ -1788,6 +1788,13 @@ class TCPDF {
 	 */
 	protected $custom_xmp = '';
 
+	/**
+	 * Custom XMP RDF data.
+	 * @protected
+	 * @since 6.3.0 (2019-09-19)
+	 */
+	protected $custom_xmp_rdf = '';
+
 	/**
 	 * Overprint mode array.
 	 * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
@@ -1999,6 +2006,7 @@ class TCPDF {
 		$this->default_graphic_vars = $this->getGraphicVars();
 		$this->header_xobj_autoreset = false;
 		$this->custom_xmp = '';
+		$this->custom_xmp_rdf = '';
 		// Call cleanup method after script execution finishes or exit() is called.
 		// NOTE: This will not be executed if the process is killed with a SIGTERM or SIGKILL signal.
 		register_shutdown_function(array($this, '_destroy'), true);
@@ -7788,6 +7796,9 @@ class TCPDF {
 				}
 				closedir($handle);
 			}
+			foreach($this->imagekeys as $file) {
+				unlink($file);
+			}
 		}
 		$preserve = array(
 			'file_id',
@@ -8401,7 +8412,7 @@ class TCPDF {
 							if (is_string($pl['txt']) && !empty($pl['txt'])) {
 								if ($pl['txt'][0] == '#') {
 									// internal destination
-									$annots .= ' /Dest /'.TCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1));
+									$annots .= ' /A <</S /GoTo /D '.TCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1)).'>>';
 								} elseif ($pl['txt'][0] == '%') {
 									// embedded PDF file
 									$filename = basename(substr($pl['txt'], 1));
@@ -9533,6 +9544,17 @@ class TCPDF {
 		$this->custom_xmp = $xmp;
 	}
 
+	/**
+	 * Set additional XMP data to be added on the default XMP data just before the end of "rdf:RDF" tag.
+	 * IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method!
+	 * @param $xmp (string) Custom XMP RDF data.
+	 * @since 6.3.0 (2019-09-19)
+	 * @public
+	 */
+	public function setExtraXMPRDF($xmp) {
+		$this->custom_xmp_rdf = $xmp;
+	}
+
 	/**
 	 * Put XMP data object and return ID.
 	 * @return (int) The object ID.
@@ -9660,6 +9682,7 @@ class TCPDF {
 		$xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
 		$xmp .= "\t\t\t".'</pdfaExtension:schemas>'."\n";
 		$xmp .= "\t\t".'</rdf:Description>'."\n";
+		$xmp .= $this->custom_xmp_rdf;
 		$xmp .= "\t".'</rdf:RDF>'."\n";
 		$xmp .= $this->custom_xmp;
 		$xmp .= '</x:xmpmeta>'."\n";