new setExtraXMPRDF function to set custom RDF XMP data

This commit is contained in:
nicolaasuni 2019-09-19 10:41:12 +01:00
parent b00a4ed46c
commit b41a5ca311
6 changed files with 34 additions and 8 deletions

View File

@ -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
**********************************************************************
**********************************************************************

View File

@ -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

1
VERSION Normal file
View File

@ -0,0 +1 @@
6.3.0

View File

@ -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.",

Binary file not shown.

View File

@ -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";