Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract method to get TCPDF producer #572

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions tcpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,13 @@ class TCPDF {
*/
protected $creator = '';

/**
* Document producer.
* @private
* @var string
*/
private $_TCPDFProducer = '';

/**
* Starting page number.
* @protected
Expand Down Expand Up @@ -9582,7 +9589,7 @@ protected function _putinfo() {
// restore previous isunicode value
$this->isunicode = $prev_isunicode;
// default producer
$out .= ' /Producer '.$this->_textstring(TCPDF_STATIC::getTCPDFProducer(), $oid);
$out .= ' /Producer '.$this->_textstring($this->_getTCPDFProducer(), $oid);
// The date and time the document was created, in human-readable form
$out .= ' /CreationDate '.$this->_datestring(0, $this->doc_creation_timestamp);
// The date and time the document was most recently modified, in human-readable form
Expand Down Expand Up @@ -9677,7 +9684,7 @@ protected function _putXMP() {
$xmp .= "\t\t".'</rdf:Description>'."\n";
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'."\n";
$xmp .= "\t\t\t".'<pdf:Keywords>'.TCPDF_STATIC::_escapeXML($this->keywords).'</pdf:Keywords>'."\n";
$xmp .= "\t\t\t".'<pdf:Producer>'.TCPDF_STATIC::_escapeXML(TCPDF_STATIC::getTCPDFProducer()).'</pdf:Producer>'."\n";
$xmp .= "\t\t\t".'<pdf:Producer>'.TCPDF_STATIC::_escapeXML($this->_getTCPDFProducer()).'</pdf:Producer>'."\n";
$xmp .= "\t\t".'</rdf:Description>'."\n";
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'."\n";
$uuid = 'uuid:'.substr($this->file_id, 0, 8).'-'.substr($this->file_id, 8, 4).'-'.substr($this->file_id, 12, 4).'-'.substr($this->file_id, 16, 4).'-'.substr($this->file_id, 20, 12);
Expand Down Expand Up @@ -24743,6 +24750,20 @@ protected function fileExists($file)
return TCPDF_STATIC::file_exists($file);
}

/**
* Return the current TCPDF producer.
* @return string TCPDF producer string
* @private
*/
private function _getTCPDFProducer()
{
if (!TCPDF_STATIC::empty_string($this->_TCPDFProducer)) {
return $this->_TCPDFProducer;
}

return TCPDF_STATIC::getTCPDFProducer();
}

} // END OF TCPDF CLASS

//============================================================+
Expand Down
Loading